修改 hid.c 文件,此文件在 kernel/drivers/usb/gadget/legacy/目录下,增加以下内容:
增加 hidg_func_descriptor 结构变量
static struct hidg_func_descriptor my_hid_data = {
.subclass = 0, /* No subclass */
.protocol = 2, /* Keyboard */
//.report_length = 6,
.report_length = 62,//14,//13,//6,
// .report_desc_length = 74,
.report_desc_length = 489,//515,//176
.report_desc = {
#if 1
0x05, 0x0D, // Usage Page (Digitizer)
0x09, 0x04, // Usage (Touch Screen)
0xA1, 0x01, // Collection (Application)
0x85, 0x02, // Report ID (2)
0x09, 0x22, // Usage (Finger)
0xA1, 0x02, // Collection (Logical)
0x05, 0x0D, // Usage Page (Digitizer)
0x09, 0x42, // Usage (Tip Switch)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x32, // Usage (In Range)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x47, // Usage (0x47)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x95, 0x05, // Report Count (5)
0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x75, 0x08, // Report Size (8)
0x09, 0x51, // Usage (0x51)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x7F, // Logical Maximum (32767)
//0x26, 0x56, 0x05,// LOGICAL_MAXIMUM (1366)
0x75, 0x10, // Report Size (16)
0x55, 0x0E, // Unit Exponent (-2)
//0x55,0x00,
0x65, 0x11, // Unit (System: SI Linear, Length: Centimeter)
0x09, 0x30, // Usage (X)
0x35, 0x00, // Physical Minimum (0)
0x46, 0x51, 0x22, // Physical Maximum (8785)
//0x46, 0x00, 0x05,// PHYSICAL_MAXIMUM (1280)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x46, 0xAB, 0x13, // Physical Maximum (5035)
//0x46, 0x20, 0x03, //800
0x09, 0x31, // Usage (Y)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x0D, // Usage Page (Digitizer)
0x09, 0x48, // Usage (0x48)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x49, // Usage (0x49)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0, // End Collection
0xA1, 0x02, // Collection (Logical)
0x05, 0x0D, // Usage Page (Digitizer)
0x09, 0x42, // Usage (Tip Switch)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, //