Android HID 多点触摸设备描述符调试实现USB反控电脑pc,亲测有效。

修改 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,        //    

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值