drivers/hid/bpf/progs/WALTOP__Batteryless-Tablet.bpf.c

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

File Facts

System
Linux kernel
Corpus path
drivers/hid/bpf/progs/WALTOP__Batteryless-Tablet.bpf.c
Extension
.c
Size
13642 bytes
Lines
322
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 <bpf/bpf_tracing.h>

#define VID_WALTOP 0x172F
#define PID_BATTERYLESS_TABLET 0x0505

HID_BPF_CONFIG(
	HID_DEVICE(BUS_USB, HID_GROUP_ANY, VID_WALTOP, PID_BATTERYLESS_TABLET)
);

#define EXPECTED_RDESC_SIZE 335
#define PEN_REPORT_ID 16

#define TIP_SWITCH BIT(0)
#define BARREL_SWITCH BIT(1)
#define SECONDARY_BARREL_SWITCH BIT(5)

static __u8 last_button_state;

static const __u8 fixed_rdesc[] = {
	0x05, 0x01,                    // Usage Page (Generic Desktop)
	0x09, 0x02,                    // Usage (Mouse)
	0xa1, 0x01,                    // Collection (Application)
	0x85, 0x01,                    //   Report ID (1)
	0x09, 0x01,                    //   Usage (Pointer)
	0xa1, 0x00,                    //   Collection (Physical)
	0x05, 0x09,                    //     Usage Page (Button)
	0x19, 0x01,                    //     Usage Minimum (1)
	0x29, 0x05,                    //     Usage Maximum (5)
	0x15, 0x00,                    //     Logical Minimum (0)
	0x25, 0x01,                    //     Logical Maximum (1)
	0x75, 0x01,                    //     Report Size (1)
	0x95, 0x05,                    //     Report Count (5)
	0x81, 0x02,                    //     Input (Data,Var,Abs)
	0x75, 0x03,                    //     Report Size (3)
	0x95, 0x01,                    //     Report Count (1)
	0x81, 0x03,                    //     Input (Cnst,Var,Abs)
	0x05, 0x01,                    //     Usage Page (Generic Desktop)
	0x09, 0x30,                    //     Usage (X)
	0x09, 0x31,                    //     Usage (Y)
	0x09, 0x38,                    //     Usage (Wheel)
	0x15, 0x81,                    //     Logical Minimum (-127)
	0x25, 0x7f,                    //     Logical Maximum (127)
	0x75, 0x08,                    //     Report Size (8)
	0x95, 0x03,                    //     Report Count (3)
	0x81, 0x06,                    //     Input (Data,Var,Rel)
	0x05, 0x0c,                    //     Usage Page (Consumer)
	0x15, 0x81,                    //     Logical Minimum (-127)
	0x25, 0x7f,                    //     Logical Maximum (127)
	0x75, 0x08,                    //     Report Size (8)
	0x95, 0x01,                    //     Report Count (1)
	0x0a, 0x38, 0x02,              //     Usage (AC Pan)
	0x81, 0x06,                    //     Input (Data,Var,Rel)
	0xc0,                          //   End Collection
	0xc0,                          // End Collection
	0x05, 0x0d,                    // Usage Page (Digitizers)
	0x09, 0x02,                    // Usage (Pen)
	0xa1, 0x01,                    // Collection (Application)
	0x85, 0x02,                    //   Report ID (2)
	0x09, 0x20,                    //   Usage (Stylus)
	0xa1, 0x00,                    //   Collection (Physical)
	0x09, 0x00,                    //     Usage (0x0000)
	0x15, 0x00,                    //     Logical Minimum (0)
	0x26, 0xff, 0x00,              //     Logical Maximum (255)
	0x75, 0x08,                    //     Report Size (8)
	0x95, 0x09,                    //     Report Count (9)
	0x81, 0x02,                    //     Input (Data,Var,Abs)
	0x09, 0x3f,                    //     Usage (Azimuth)
	0x09, 0x40,                    //     Usage (Altitude)
	0x15, 0x00,                    //     Logical Minimum (0)
	0x26, 0xff, 0x00,              //     Logical Maximum (255)
	0x75, 0x08,                    //     Report Size (8)
	0x95, 0x02,                    //     Report Count (2)
	0xb1, 0x02,                    //     Feature (Data,Var,Abs)
	0xc0,                          //   End Collection
	0x85, 0x05,                    //   Report ID (5)
	0x05, 0x0d,                    //   Usage Page (Digitizers)
	0x09, 0x20,                    //   Usage (Stylus)
	0xa1, 0x00,                    //   Collection (Physical)
	0x09, 0x00,                    //     Usage (0x0000)
	0x15, 0x00,                    //     Logical Minimum (0)
	0x26, 0xff, 0x00,              //     Logical Maximum (255)
	0x75, 0x08,                    //     Report Size (8)
	0x95, 0x07,                    //     Report Count (7)

Annotation

Implementation Notes