drivers/hid/hid-uclogic-rdesc-test.c

Source file repositories/reference/linux-study-clean/drivers/hid/hid-uclogic-rdesc-test.c

File Facts

System
Linux kernel
Corpus path
drivers/hid/hid-uclogic-rdesc-test.c
Extension
.c
Size
6111 bytes
Lines
221
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

struct uclogic_template_case {
	const char *name;
	const __u8 *template;
	size_t template_size;
	const s32 *param_list;
	size_t param_num;
	const __u8 *expected;
};

static const s32 params_pen_all[UCLOGIC_RDESC_PH_ID_NUM] = {
	[UCLOGIC_RDESC_PEN_PH_ID_X_LM] = 0xAA,
	[UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0xBB,
	[UCLOGIC_RDESC_PEN_PH_ID_Y_LM] = 0xCC,
	[UCLOGIC_RDESC_PEN_PH_ID_Y_PM] = 0xDD,
	[UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM] = 0xEE,
};

static const s32 params_pen_some[] = {
	[UCLOGIC_RDESC_PEN_PH_ID_X_LM] = 0xAA,
	[UCLOGIC_RDESC_PEN_PH_ID_X_PM] = 0xBB,
};

static const s32 params_frame_all[UCLOGIC_RDESC_PH_ID_NUM] = {
	[UCLOGIC_RDESC_FRAME_PH_ID_UM] = 0xFF,
};

static const __u8 template_empty[] = { };
static const __u8 template_small[] = { 0x00 };
static const __u8 template_no_ph[] = { 0xAA, 0xFE, 0xAA, 0xED, 0x1D };

static const __u8 template_pen_ph_end[] = {
	0xAA, 0xBB, UCLOGIC_RDESC_PEN_PH_HEAD
};

static const __u8 template_btn_ph_end[] = {
	0xAA, 0xBB, UCLOGIC_RDESC_FRAME_PH_BTN_HEAD
};

static const __u8 template_pen_all_params[] = {
	UCLOGIC_RDESC_PEN_PH(X_LM),
	0x47, UCLOGIC_RDESC_PEN_PH(X_PM),
	0x27, UCLOGIC_RDESC_PEN_PH(Y_LM),
	UCLOGIC_RDESC_PEN_PH(Y_PM),
	0x00, UCLOGIC_RDESC_PEN_PH(PRESSURE_LM),
};

static const __u8 expected_pen_all_params[] = {
	0xAA, 0x00, 0x00, 0x00,
	0x47, 0xBB, 0x00, 0x00, 0x00,
	0x27, 0xCC, 0x00, 0x00, 0x00,
	0xDD, 0x00, 0x00, 0x00,
	0x00, 0xEE, 0x00, 0x00, 0x00,
};

static const __u8 template_frame_all_params[] = {
	0x01, 0x02,
	UCLOGIC_RDESC_FRAME_PH_BTN,
	0x99,
};

static const __u8 expected_frame_all_params[] = {
	0x01, 0x02,
	0x2A, 0xFF, 0x00,
	0x99,
};

static const __u8 template_pen_some_params[] = {
	0x01, 0x02,
	UCLOGIC_RDESC_PEN_PH(X_LM),
	0x03, UCLOGIC_RDESC_PEN_PH(X_PM),
	0x04, 0x05,
};

static const __u8 expected_pen_some_params[] = {
	0x01, 0x02,
	0xAA, 0x00, 0x00, 0x00,
	0x03, 0xBB, 0x00, 0x00, 0x00,
	0x04, 0x05,
};

static const __u8 template_params_none[] = {
	0x27, UCLOGIC_RDESC_PEN_PH(Y_LM),
	UCLOGIC_RDESC_PEN_PH(Y_PM),
	0x00, UCLOGIC_RDESC_PEN_PH(PRESSURE_LM),
};

static struct uclogic_template_case uclogic_template_cases[] = {
	{
		.name = "empty_template",
		.template = template_empty,

Annotation

Implementation Notes