Linux target device HID support

1

1

I want my Linux target 3.10 embedded ARM device to recv and send commands to a HOST PC via USB HID. The HOST PC will have a GUI that communicates via HID USB to the Linux target device. Usually I'd use a non-HID driver for this type of thing, but that is not an option now. On the target side I have created a platform struct hidg_func_descriptor for the "hidg" driver. The report ID is 5, which I use for the first byte of the DATA. I created "/dev/hidg0". I can write back to the HOST PC with the write() to hidg0. It arrives as an interrupt with data on the analyzer. But I need to read() the HID_SET_REPORT from the PC HOST USB. Currently the read() just hangs no matter what the HOST sends. On the USB analyzer I can see it send the USB_REQ_SET_CONFIGURATION (0x9) at the UDC level. Next the data goes to the hidg_setup (HID_REQ_SET_REPORT) and does a goto stall.

Q1. Is hidg0 designed to handle HID_SET/GET_REPORTs as a target?

Q2. As a target device, should I use a different /dev/xxx for this type of operation?

Q3. Is it better to use /dev/hidraw0 for this somewhat custom HID platform.

platform configuration:
static struct hidg_func_descriptor hcr4_usb_hid_data = {
               .subclass       = 0,
               .protocol       = 0,
               .report_length  = 64,
               .report_desc_length = 41,
                .report_desc      = {
                    0x06, 0x20, 0xFF,  // Usage Page (Vendor Defined 0xFF20)
                    0x09, 0x01,        // Usage (0x01)
                    0xA1, 0x01,        // Collection (Application)
                    0x75, 0x08,        //   Report Size (8)
                    0x15, 0x00,        //   Logical Minimum (0)
                    0x26, 0xFF, 0x00,  //   Logical Maximum (255)
                    0x85, 0x05,        //   Report ID (5)
                    0x09, 0x05,        //   Usage (0x05)
                    0x95, 0x3F,        //   Report Count (63)
                    0xB2, 0x02, 0x01,  //   Feature ()
                    0x85, 0x02,        //   Report ID (2)
                    0x09, 0x20,        //   Usage (0x20)
                    0x95, 0x3F,        //   Report Count (63)
                    0x82, 0x02, 0x01,  //   Input ()
                    0x85, 0x03,        //   Report ID (3)
                    0x09, 0x21,        //   Usage (0x21)
                    0x95, 0x05,        //   Report Count (5)
                    0x91, 0x02,        //   Output ()
                    0xC0,              // End Collection
    },
};

Crizzo

Posted 2016-10-24T16:26:51.973

Reputation: 26

No answers