drivers/hid/bpf/progs/XPPen__Deco01V3.bpf.c

Source file repositories/reference/linux-study-clean/drivers/hid/bpf/progs/XPPen__Deco01V3.bpf.c

File Facts

System
Linux kernel
Corpus path
drivers/hid/bpf/progs/XPPen__Deco01V3.bpf.c
Extension
.c
Size
14539 bytes
Lines
306
Domain
Driver Families
Bucket
drivers/hid
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2025 Red Hat
 */

#include "vmlinux.h"
#include "hid_bpf.h"
#include "hid_bpf_helpers.h"
#include "hid_report_helpers.h"
#include <bpf/bpf_tracing.h>

#define VID_UGEE 0x28BD /* VID is shared with SinoWealth and Glorious and prob others */
#define PID_DECO_01_V3 0x0947

HID_BPF_CONFIG(
	HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, VID_UGEE, PID_DECO_01_V3),
);

/*
 * Default report descriptor reports:
 * - a report descriptor for the pad buttons, reported as key sequences
 * - a report descriptor for the pen
 * - a vendor-specific report descriptor
 *
 * The Pad report descriptor, see
 * https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/issues/54
 *
 * # Report descriptor length: 102 bytes
 * 0x05, 0x01,                    // Usage Page (Generic Desktop)              0
 * 0x09, 0x02,                    // Usage (Mouse)                             2
 * 0xa1, 0x01,                    // Collection (Application)                  4
 * 0x85, 0x09,                    //   Report ID (9)                           6
 * 0x09, 0x01,                    //   Usage (Pointer)                         8
 * 0xa1, 0x00,                    //   Collection (Physical)                   10
 * 0x05, 0x09,                    //     Usage Page (Button)                   12
 * 0x19, 0x01,                    //     UsageMinimum (1)                      14
 * 0x29, 0x03,                    //     UsageMaximum (3)                      16
 * 0x15, 0x00,                    //     Logical Minimum (0)                   18
 * 0x25, 0x01,                    //     Logical Maximum (1)                   20
 * 0x95, 0x03,                    //     Report Count (3)                      22
 * 0x75, 0x01,                    //     Report Size (1)                       24
 * 0x81, 0x02,                    //     Input (Data,Var,Abs)                  26
 * 0x95, 0x05,                    //     Report Count (5)                      28
 * 0x81, 0x01,                    //     Input (Cnst,Arr,Abs)                  30
 * 0x05, 0x01,                    //     Usage Page (Generic Desktop)          32
 * 0x09, 0x30,                    //     Usage (X)                             34
 * 0x09, 0x31,                    //     Usage (Y)                             36
 * 0x26, 0xff, 0x7f,              //     Logical Maximum (32767)               38
 * 0x95, 0x02,                    //     Report Count (2)                      41
 * 0x75, 0x10,                    //     Report Size (16)                      43
 * 0x81, 0x02,                    //     Input (Data,Var,Abs)                  45
 * 0x05, 0x0d,                    //     Usage Page (Digitizers)               47
 * 0x09, 0x30,                    //     Usage (Tip Pressure)                  49
 * 0x26, 0xff, 0x07,              //     Logical Maximum (2047)                51
 * 0x95, 0x01,                    //     Report Count (1)                      54
 * 0x75, 0x10,                    //     Report Size (16)                      56
 * 0x81, 0x02,                    //     Input (Data,Var,Abs)                  58
 * 0xc0,                          //   End Collection                          60
 * 0xc0,                          // End Collection                            61
 * 0x05, 0x01,                    // Usage Page (Generic Desktop)              62
 * 0x09, 0x06,                    // Usage (Keyboard)                          64
 * 0xa1, 0x01,                    // Collection (Application)                  66
 * 0x85, 0x06,                    //   Report ID (6)                           68
 * 0x05, 0x07,                    //   Usage Page (Keyboard/Keypad)            70
 * 0x19, 0xe0,                    //   UsageMinimum (224)                      72
 * 0x29, 0xe7,                    //   UsageMaximum (231)                      74
 * 0x15, 0x00,                    //   Logical Minimum (0)                     76
 * 0x25, 0x01,                    //   Logical Maximum (1)                     78
 * 0x75, 0x01,                    //   Report Size (1)                         80
 * 0x95, 0x08,                    //   Report Count (8)                        82
 * 0x81, 0x02,                    //   Input (Data,Var,Abs)                    84
 * 0x05, 0x07,                    //   Usage Page (Keyboard/Keypad)            86
 * 0x19, 0x00,                    //   UsageMinimum (0)                        88
 * 0x29, 0xff,                    //   UsageMaximum (255)                      90
 * 0x26, 0xff, 0x00,              //   Logical Maximum (255)                   92
 * 0x75, 0x08,                    //   Report Size (8)                         95
 * 0x95, 0x06,                    //   Report Count (6)                        97
 * 0x81, 0x00,                    //   Input (Data,Arr,Abs)                    99
 * 0xc0,                          // End Collection                            101
 *
 * And key events for buttons top->bottom are:
 * Buttons released: 06 00 00 00 00 00 00 00
 * Button1:          06 00 05 00 00 00 00 00 -> b
 * Button2:          06 00 08 00 00 00 00 00 -> e
 * Button3:          06 04 00 00 00 00 00 00 -> LAlt
 * Button4:          06 00 2c 00 00 00 00 00 -> Space
 * Button5:          06 01 16 00 00 00 00 00 -> LControl + s
 * Button6:          06 01 1d 00 00 00 00 00 -> LControl + z
 * Button7:          06 01 57 00 00 00 00 00 -> LControl + Keypad Plus
 * Button8:          06 01 56 00 00 00 00 00 -> LControl + Keypad Dash
 *

Annotation

Implementation Notes