drivers/hid/bpf/progs/Huion__Kamvas-Pro-19.bpf.c
Source file repositories/reference/linux-study-clean/drivers/hid/bpf/progs/Huion__Kamvas-Pro-19.bpf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/bpf/progs/Huion__Kamvas-Pro-19.bpf.c- Extension
.c- Size
- 20638 bytes
- Lines
- 367
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
vmlinux.hhid_bpf.hhid_bpf_helpers.hbpf/bpf_tracing.h
Detected Declarations
function BPF_PROGfunction BPF_PROGfunction probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2024 Benjamin Tissoires
*/
#include "vmlinux.h"
#include "hid_bpf.h"
#include "hid_bpf_helpers.h"
#include <bpf/bpf_tracing.h>
#define VID_HUION 0x256C
#define PID_KAMVAS_PRO_19 0x006B
#define PID_KAMVAS_PRO_27 0x006c
#define NAME_KAMVAS_PRO_19 "HUION Huion Tablet_GT1902"
#define NAME_KAMVAS_PRO_27 "HUION Huion Tablet_GT2701"
#define TEST_PREFIX "uhid test "
HID_BPF_CONFIG(
HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8, VID_HUION, PID_KAMVAS_PRO_19),
HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8, VID_HUION, PID_KAMVAS_PRO_27),
);
bool prev_was_out_of_range;
bool in_eraser_mode;
/*
* We need to amend the report descriptor for the following:
* - the second button is reported through Secondary Tip Switch instead of Secondary Barrel Switch
* - the third button is reported through Invert, and we need some room to report it.
*
*/
static const __u8 fixed_rdesc[] = {
0x05, 0x0d, // Usage Page (Digitizers) 0
0x09, 0x02, // Usage (Pen) 2
0xa1, 0x01, // Collection (Application) 4
0x85, 0x0a, // Report ID (10) 6
0x09, 0x20, // Usage (Stylus) 8
0xa1, 0x01, // Collection (Application) 10
0x09, 0x42, // Usage (Tip Switch) 12
0x09, 0x44, // Usage (Barrel Switch) 14
0x09, 0x5a, // Usage (Secondary Barrel Switch) 16 /* changed from Secondary Tip Switch */
0x09, 0x3c, // Usage (Invert) 18
0x09, 0x45, // Usage (Eraser) 20
0x15, 0x00, // Logical Minimum (0) 22
0x25, 0x01, // Logical Maximum (1) 24
0x75, 0x01, // Report Size (1) 26
0x95, 0x05, // Report Count (5) 28 /* changed (was 6) */
0x81, 0x02, // Input (Data,Var,Abs) 30
0x05, 0x09, // Usage Page (Button) /* inserted */
0x09, 0x4a, // Usage (0x4a) /* inserted to be translated as input usage 0x149: BTN_STYLUS3 */
0x95, 0x01, // Report Count (1) /* inserted */
0x81, 0x02, // Input (Data,Var,Abs) /* inserted */
0x05, 0x0d, // Usage Page (Digitizers) /* inserted */
0x09, 0x32, // Usage (In Range) 32
0x75, 0x01, // Report Size (1) 34
0x95, 0x01, // Report Count (1) 36
0x81, 0x02, // Input (Data,Var,Abs) 38
0x81, 0x03, // Input (Cnst,Var,Abs) 40
0x05, 0x01, // Usage Page (Generic Desktop) 42
0x09, 0x30, // Usage (X) 44
0x09, 0x31, // Usage (Y) 46
0x55, 0x0d, // Unit Exponent (-3) 48
0x65, 0x33, // Unit (EnglishLinear: in³) 50
0x26, 0xff, 0x7f, // Logical Maximum (32767) 52
0x35, 0x00, // Physical Minimum (0) 55
0x46, 0x00, 0x08, // Physical Maximum (2048) 57
0x75, 0x10, // Report Size (16) 60
0x95, 0x02, // Report Count (2) 62
0x81, 0x02, // Input (Data,Var,Abs) 64
0x05, 0x0d, // Usage Page (Digitizers) 66
0x09, 0x30, // Usage (Tip Pressure) 68
0x26, 0xff, 0x3f, // Logical Maximum (16383) 70
0x75, 0x10, // Report Size (16) 73
0x95, 0x01, // Report Count (1) 75
0x81, 0x02, // Input (Data,Var,Abs) 77
0x09, 0x3d, // Usage (X Tilt) 79
0x09, 0x3e, // Usage (Y Tilt) 81
0x15, 0xa6, // Logical Minimum (-90) 83
0x25, 0x5a, // Logical Maximum (90) 85
0x75, 0x08, // Report Size (8) 87
0x95, 0x02, // Report Count (2) 89
0x81, 0x02, // Input (Data,Var,Abs) 91
0xc0, // End Collection 93
0xc0, // End Collection 94
0x05, 0x0d, // Usage Page (Digitizers) 95
0x09, 0x04, // Usage (Touch Screen) 97
0xa1, 0x01, // Collection (Application) 99
0x85, 0x04, // Report ID (4) 101
0x09, 0x22, // Usage (Finger) 103
0xa1, 0x02, // Collection (Logical) 105
Annotation
- Immediate include surface: `vmlinux.h`, `hid_bpf.h`, `hid_bpf_helpers.h`, `bpf/bpf_tracing.h`.
- Detected declarations: `function BPF_PROG`, `function BPF_PROG`, `function probe`.
- Atlas domain: Driver Families / drivers/hid.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.