drivers/hid/bpf/progs/XPPen__Deco02.bpf.c

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

File Facts

System
Linux kernel
Corpus path
drivers/hid/bpf/progs/XPPen__Deco02.bpf.c
Extension
.c
Size
14447 bytes
Lines
360
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

switch (data[d]) {
		case 0x2e:
			dial_code = 1;
			break;
		case 0x2d:
			dial_code = -1;
			break;
		/* below are buttons, top to bottom */
		case 0x05:
			button_mask |= BIT(0);
			break;
		case 0x2c:
			button_mask |= BIT(1);
			break;
		case 0x08:
			button_mask |= BIT(2);
			break;
		case 0x0c:
			button_mask |= BIT(3);
			break;
		case 0x1d:
			button_mask |= BIT(4);
			break;
		case 0x16:
			button_mask |= BIT(05);
			break;
		default:
			break;
		}
	}

	__u8 report[8] = { REPORT_ID_BUTTONS, dial_code, button_mask, 0x00 };

	__builtin_memcpy(data, report, sizeof(report));
	return 0;
}

HID_BPF_OPS(xppen_deco02) = {
	.hid_rdesc_fixup = (void *)xppen_deco02_rdesc_fixup,
	.hid_device_event = (void *)xppen_deco02_device_event,
};

SEC("syscall")
int probe(struct hid_bpf_probe_args *ctx)
{
	ctx->retval = ctx->rdesc_size != RDESC_SIZE_PAD ? -EINVAL : 0;
	return 0;
}

char _license[] SEC("license") = "GPL";

Annotation

Implementation Notes