Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6960

Advanced users • USB multitouch HID not working

$
0
0
Hi, I have a multi-touch display. I have connected the USB of the touch display to the RPI and used a gadget device to connect to the PC from the RPI. When I connect my display to the laptop, I can see all 10 touch points working. Now I am trying to forward the received data from the touch display to my PC, I am using the same HID descriptor as I read from the display, Posted below, My PC detects the RPI as a touch screen gadget, I can see the forwarded data on Wireshark, But touch doesn't work, Am I missing anything here?

HID read from display and using same in report_desc

Code:

0x05, 0x0D,        // Usage Page (Digitizer)0x09, 0x04,        // Usage (Touch Screen)0xA1, 0x01,        // Collection (Application)0x85, 0x04,        //   Report ID (4)0x09, 0x22,        //   Usage (Finger)0xA1, 0x02,        //   Collection (Logical)0x05, 0x0D,        //     Usage Page (Digitizer)0x95, 0x01,        //     Report Count (1)0x75, 0x06,        //     Report Size (6)0x09, 0x51,        //     Usage (0x51)0x15, 0x00,        //     Logical Minimum (0)0x25, 0x3F,        //     Logical Maximum (63)0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x09, 0x42,        //     Usage (Tip Switch)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)0x75, 0x01,        //     Report Size (1)0x95, 0x01,        //     Report Count (1)0x81, 0x03,        //     Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)0x75, 0x10,        //     Report Size (16)0x55, 0x0E,        //     Unit Exponent (-2)0x65, 0x11,        //     Unit (System: SI Linear, Length: Centimeter)0x09, 0x30,        //     Usage (X)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x35, 0x00,        //     Physical Minimum (0)0x46, 0x15, 0x0C,  //     Physical Maximum (3093)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0x09, 0x31,        //     Usage (Y)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x46, 0xCB, 0x06,  //     Physical Maximum (1739)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0xC0,              //   End Collection0x05, 0x0D,        //   Usage Page (Digitizer)0x09, 0x22,        //   Usage (Finger)0xA1, 0x02,        //   Collection (Logical)0x05, 0x0D,        //     Usage Page (Digitizer)0x95, 0x01,        //     Report Count (1)0x75, 0x06,        //     Report Size (6)0x09, 0x51,        //     Usage (0x51)0x15, 0x00,        //     Logical Minimum (0)0x25, 0x3F,        //     Logical Maximum (63)0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x09, 0x42,        //     Usage (Tip Switch)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)0x75, 0x01,        //     Report Size (1)0x95, 0x01,        //     Report Count (1)0x81, 0x03,        //     Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)0x75, 0x10,        //     Report Size (16)0x55, 0x0E,        //     Unit Exponent (-2)0x65, 0x11,        //     Unit (System: SI Linear, Length: Centimeter)0x09, 0x30,        //     Usage (X)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x35, 0x00,        //     Physical Minimum (0)0x46, 0x15, 0x0C,  //     Physical Maximum (3093)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0x09, 0x31,        //     Usage (Y)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x46, 0xCB, 0x06,  //     Physical Maximum (1739)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0xC0,              //   End Collection0x05, 0x0D,        //   Usage Page (Digitizer)0x09, 0x22,        //   Usage (Finger)0xA1, 0x02,        //   Collection (Logical)0x05, 0x0D,        //     Usage Page (Digitizer)0x95, 0x01,        //     Report Count (1)0x75, 0x06,        //     Report Size (6)0x09, 0x51,        //     Usage (0x51)0x15, 0x00,        //     Logical Minimum (0)0x25, 0x3F,        //     Logical Maximum (63)0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x09, 0x42,        //     Usage (Tip Switch)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)0x75, 0x01,        //     Report Size (1)0x95, 0x01,        //     Report Count (1)0x81, 0x03,        //     Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)0x75, 0x10,        //     Report Size (16)0x55, 0x0E,        //     Unit Exponent (-2)0x65, 0x11,        //     Unit (System: SI Linear, Length: Centimeter)0x09, 0x30,        //     Usage (X)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x35, 0x00,        //     Physical Minimum (0)0x46, 0x15, 0x0C,  //     Physical Maximum (3093)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0x09, 0x31,        //     Usage (Y)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x46, 0xCB, 0x06,  //     Physical Maximum (1739)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0xC0,              //   End Collection0x05, 0x0D,        //   Usage Page (Digitizer)0x09, 0x22,        //   Usage (Finger)0xA1, 0x02,        //   Collection (Logical)0x05, 0x0D,        //     Usage Page (Digitizer)0x95, 0x01,        //     Report Count (1)0x75, 0x06,        //     Report Size (6)0x09, 0x51,        //     Usage (0x51)0x15, 0x00,        //     Logical Minimum (0)0x25, 0x3F,        //     Logical Maximum (63)0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x09, 0x42,        //     Usage (Tip Switch)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)0x75, 0x01,        //     Report Size (1)0x95, 0x01,        //     Report Count (1)0x81, 0x03,        //     Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)0x75, 0x10,        //     Report Size (16)0x55, 0x0E,        //     Unit Exponent (-2)0x65, 0x11,        //     Unit (System: SI Linear, Length: Centimeter)0x09, 0x30,        //     Usage (X)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x35, 0x00,        //     Physical Minimum (0)0x46, 0x15, 0x0C,  //     Physical Maximum (3093)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0x09, 0x31,        //     Usage (Y)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x46, 0xCB, 0x06,  //     Physical Maximum (1739)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0xC0,              //   End Collection0x05, 0x0D,        //   Usage Page (Digitizer)0x09, 0x22,        //   Usage (Finger)0xA1, 0x02,        //   Collection (Logical)0x05, 0x0D,        //     Usage Page (Digitizer)0x95, 0x01,        //     Report Count (1)0x75, 0x06,        //     Report Size (6)0x09, 0x51,        //     Usage (0x51)0x15, 0x00,        //     Logical Minimum (0)0x25, 0x3F,        //     Logical Maximum (63)0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x09, 0x42,        //     Usage (Tip Switch)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)0x75, 0x01,        //     Report Size (1)0x95, 0x01,        //     Report Count (1)0x81, 0x03,        //     Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)0x75, 0x10,        //     Report Size (16)0x55, 0x0E,        //     Unit Exponent (-2)0x65, 0x11,        //     Unit (System: SI Linear, Length: Centimeter)0x09, 0x30,        //     Usage (X)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x35, 0x00,        //     Physical Minimum (0)0x46, 0x15, 0x0C,  //     Physical Maximum (3093)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0x09, 0x31,        //     Usage (Y)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x46, 0xCB, 0x06,  //     Physical Maximum (1739)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0xC0,              //   End Collection0x05, 0x0D,        //   Usage Page (Digitizer)0x09, 0x22,        //   Usage (Finger)0xA1, 0x02,        //   Collection (Logical)0x05, 0x0D,        //     Usage Page (Digitizer)0x95, 0x01,        //     Report Count (1)0x75, 0x06,        //     Report Size (6)0x09, 0x51,        //     Usage (0x51)0x15, 0x00,        //     Logical Minimum (0)0x25, 0x3F,        //     Logical Maximum (63)0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x09, 0x42,        //     Usage (Tip Switch)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)0x75, 0x01,        //     Report Size (1)0x95, 0x01,        //     Report Count (1)0x81, 0x03,        //     Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)0x75, 0x10,        //     Report Size (16)0x55, 0x0E,        //     Unit Exponent (-2)0x65, 0x11,        //     Unit (System: SI Linear, Length: Centimeter)0x09, 0x30,        //     Usage (X)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x35, 0x00,        //     Physical Minimum (0)0x46, 0x15, 0x0C,  //     Physical Maximum (3093)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0x09, 0x31,        //     Usage (Y)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x46, 0xCB, 0x06,  //     Physical Maximum (1739)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0xC0,              //   End Collection0x05, 0x0D,        //   Usage Page (Digitizer)0x09, 0x22,        //   Usage (Finger)0xA1, 0x02,        //   Collection (Logical)0x05, 0x0D,        //     Usage Page (Digitizer)0x95, 0x01,        //     Report Count (1)0x75, 0x06,        //     Report Size (6)0x09, 0x51,        //     Usage (0x51)0x15, 0x00,        //     Logical Minimum (0)0x25, 0x3F,        //     Logical Maximum (63)0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x09, 0x42,        //     Usage (Tip Switch)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)0x75, 0x01,        //     Report Size (1)0x95, 0x01,        //     Report Count (1)0x81, 0x03,        //     Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)0x75, 0x10,        //     Report Size (16)0x55, 0x0E,        //     Unit Exponent (-2)0x65, 0x11,        //     Unit (System: SI Linear, Length: Centimeter)0x09, 0x30,        //     Usage (X)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x35, 0x00,        //     Physical Minimum (0)0x46, 0x15, 0x0C,  //     Physical Maximum (3093)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0x09, 0x31,        //     Usage (Y)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x46, 0xCB, 0x06,  //     Physical Maximum (1739)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0xC0,              //   End Collection0x05, 0x0D,        //   Usage Page (Digitizer)0x09, 0x22,        //   Usage (Finger)0xA1, 0x02,        //   Collection (Logical)0x05, 0x0D,        //     Usage Page (Digitizer)0x95, 0x01,        //     Report Count (1)0x75, 0x06,        //     Report Size (6)0x09, 0x51,        //     Usage (0x51)0x15, 0x00,        //     Logical Minimum (0)0x25, 0x3F,        //     Logical Maximum (63)0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x09, 0x42,        //     Usage (Tip Switch)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)0x75, 0x01,        //     Report Size (1)0x95, 0x01,        //     Report Count (1)0x81, 0x03,        //     Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)0x75, 0x10,        //     Report Size (16)0x55, 0x0E,        //     Unit Exponent (-2)0x65, 0x11,        //     Unit (System: SI Linear, Length: Centimeter)0x09, 0x30,        //     Usage (X)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x35, 0x00,        //     Physical Minimum (0)0x46, 0x15, 0x0C,  //     Physical Maximum (3093)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0x09, 0x31,        //     Usage (Y)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x46, 0xCB, 0x06,  //     Physical Maximum (1739)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0xC0,              //   End Collection0x05, 0x0D,        //   Usage Page (Digitizer)0x09, 0x22,        //   Usage (Finger)0xA1, 0x02,        //   Collection (Logical)0x05, 0x0D,        //     Usage Page (Digitizer)0x95, 0x01,        //     Report Count (1)0x75, 0x06,        //     Report Size (6)0x09, 0x51,        //     Usage (0x51)0x15, 0x00,        //     Logical Minimum (0)0x25, 0x3F,        //     Logical Maximum (63)0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x09, 0x42,        //     Usage (Tip Switch)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)0x75, 0x01,        //     Report Size (1)0x95, 0x01,        //     Report Count (1)0x81, 0x03,        //     Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)0x75, 0x10,        //     Report Size (16)0x55, 0x0E,        //     Unit Exponent (-2)0x65, 0x11,        //     Unit (System: SI Linear, Length: Centimeter)0x09, 0x30,        //     Usage (X)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x35, 0x00,        //     Physical Minimum (0)0x46, 0x15, 0x0C,  //     Physical Maximum (3093)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0x09, 0x31,        //     Usage (Y)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x46, 0xCB, 0x06,  //     Physical Maximum (1739)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0xC0,              //   End Collection0x05, 0x0D,        //   Usage Page (Digitizer)0x09, 0x22,        //   Usage (Finger)0xA1, 0x02,        //   Collection (Logical)0x05, 0x0D,        //     Usage Page (Digitizer)0x95, 0x01,        //     Report Count (1)0x75, 0x06,        //     Report Size (6)0x09, 0x51,        //     Usage (0x51)0x15, 0x00,        //     Logical Minimum (0)0x25, 0x3F,        //     Logical Maximum (63)0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x09, 0x42,        //     Usage (Tip Switch)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)0x75, 0x01,        //     Report Size (1)0x95, 0x01,        //     Report Count (1)0x81, 0x03,        //     Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)0x75, 0x10,        //     Report Size (16)0x55, 0x0E,        //     Unit Exponent (-2)0x65, 0x11,        //     Unit (System: SI Linear, Length: Centimeter)0x09, 0x30,        //     Usage (X)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x35, 0x00,        //     Physical Minimum (0)0x46, 0x15, 0x0C,  //     Physical Maximum (3093)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0x09, 0x31,        //     Usage (Y)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x46, 0xCB, 0x06,  //     Physical Maximum (1739)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0xC0,              //   End Collection0x05, 0x0D,        //   Usage Page (Digitizer)0x09, 0x56,        //   Usage (0x56)0x55, 0x00,        //   Unit Exponent (0)0x65, 0x00,        //   Unit (None)0x27, 0xFF, 0xFF, 0xFF, 0x7F,  //   Logical Maximum (2147483646)0x95, 0x01,        //   Report Count (1)0x75, 0x20,        //   Report Size (32)0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x09, 0x54,        //   Usage (0x54)0x25, 0x7F,        //   Logical Maximum (127)0x95, 0x01,        //   Report Count (1)0x75, 0x08,        //   Report Size (8)0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x75, 0x08,        //   Report Size (8)0x95, 0x08,        //   Report Count (8)0x81, 0x03,        //   Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x85, 0x02,        //   Report ID (2)0x09, 0x55,        //   Usage (0x55)0x25, 0x0A,        //   Logical Maximum (10)0x75, 0x08,        //   Report Size (8)0x95, 0x01,        //   Report Count (1)0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)0x06, 0x00, 0xFF,  //   Usage Page (Vendor Defined 0xFF00)0x09, 0xC5,        //   Usage (0xC5)0x85, 0x06,        //   Report ID (6)0x15, 0x00,        //   Logical Minimum (0)0x26, 0xFF, 0x00,  //   Logical Maximum (255)0x75, 0x08,        //   Report Size (8)0x96, 0x00, 0x01,  //   Report Count (256)0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)0xC0,              // End Collection0x06, 0x00, 0xFF,  // Usage Page (Vendor Defined 0xFF00)0x09, 0x01,        // Usage (0x01)0xA1, 0x01,        // Collection (Application)0x09, 0x01,        //   Usage (0x01)0x85, 0x03,        //   Report ID (3)0x15, 0x00,        //   Logical Minimum (0)0x26, 0xFF, 0x00,  //   Logical Maximum (255)0x75, 0x08,        //   Report Size (8)0x95, 0x3F,        //   Report Count (63)0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x06, 0x00, 0xFF,  //   Usage Page (Vendor Defined 0xFF00)0x09, 0x01,        //   Usage (0x01)0x15, 0x00,        //   Logical Minimum (0)0x26, 0xFF, 0x00,  //   Logical Maximum (255)0x75, 0x08,        //   Report Size (8)0x95, 0x3F,        //   Report Count (63)0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)0xC0,              // End Collection0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)0x09, 0x02,        // Usage (Mouse)0xA1, 0x01,        // Collection (Application)0x85, 0x05,        //   Report ID (5)0x09, 0x01,        //   Usage (Pointer)0xA1, 0x00,        //   Collection (Physical)0x05, 0x09,        //     Usage Page (Button)0x19, 0x01,        //     Usage Minimum (0x01)0x29, 0x05,        //     Usage Maximum (0x05)0x15, 0x00,        //     Logical Minimum (0)0x25, 0x01,        //     Logical Maximum (1)0x95, 0x05,        //     Report Count (5)0x75, 0x01,        //     Report Size (1)0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)0x95, 0x01,        //     Report Count (1)0x75, 0x03,        //     Report Size (3)0x81, 0x01,        //     Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)0x75, 0x10,        //     Report Size (16)0x95, 0x01,        //     Report Count (1)0x55, 0x0E,        //     Unit Exponent (-2)0x65, 0x11,        //     Unit (System: SI Linear, Length: Centimeter)0x09, 0x30,        //     Usage (X)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x35, 0x00,        //     Physical Minimum (0)0x46, 0x15, 0x0C,  //     Physical Maximum (3093)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0x09, 0x31,        //     Usage (Y)0x26, 0x00, 0x40,  //     Logical Maximum (16384)0x46, 0xCB, 0x06,  //     Physical Maximum (1739)0x81, 0x42,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)0xC0,              //   End Collection0xC0,              // End Collection// 850 bytes
Code to forward the data to PC

Code:

#!/usr/bin/env python3import osr = os.open('/dev/hidraw0', os.O_RDONLY)g = os.open('/dev/hidg0',   os.O_WRONLY)try:    while True:        pkt = os.read(r, 64)        if len(pkt)==64:            os.write(g, pkt)finally:    os.close(r)    os.close(g)
Gadget device creation

Code:

#!/bin/bashset -exGADGET_NAME="touchscreen_gadget"UDC=$(ls /sys/class/udc | head -n 1)cd /sys/kernel/config/usb_gadget/# Clean up[ -d $GADGET_NAME ] && rm -rf $GADGET_NAMEmkdir -p $GADGET_NAMEcd $GADGET_NAMEecho 0x1d6b > idVendor     # Example Vendor IDecho 0x0002 > idProduct    # Product ID (change if needed)echo 0x0200 > bcdUSB       # USB 2.0mkdir -p strings/0x409echo "1234567890" > strings/0x409/serialnumberecho "Testing Device" > strings/0x409/manufacturerecho "Multi Touch Panel" > strings/0x409/productmkdir -p configs/c.1mkdir -p configs/c.1/strings/0x409echo "Config 1: Multi Touch" > configs/c.1/strings/0x409/configurationecho 400 > configs/c.1/MaxPower# Create HID functionmkdir -p functions/hid.usb0echo 0 > functions/hid.usb0/protocolecho 0 > functions/hid.usb0/subclassecho 64 > functions/hid.usb0/report_lengthxxd -r -p /home/karthik/gadget/touch-hid > functions/hid.usb0/report_descln -s functions/hid.usb0 configs/c.1/sleep 1echo "$UDC" > UDCecho "✅ Single touch USB gadget active"

Statistics: Posted by Karthikb20 — Mon May 26, 2025 9:16 am — Replies 3 — Views 56



Viewing all articles
Browse latest Browse all 6960

Trending Articles