Open hadess opened 8 years ago
The output of head -n1
in the above command:
8bitdo-native.txt
Hi hadess, which version of hidrd are you using?
That was with git master and the attached file.
main_tag = hidrd_item_main_get_tag(item);
It failed with "main_tag = 0"
Not sure if that means it couldn't parse the main tag, or some other failure.
I'll note that the above rdesc was parsed by the Linux kernel without a problem, so it's very likely to be a valid descriptor.
http://eleccelerator.com/usbdescreqparser/ parses the above descriptor as:
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x09, 0x05, // Usage (Game Pad)
0xA1, 0x01, // Collection (Application)
0x85, 0x03, // Report ID (3)
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x07, // Logical Maximum (7)
0x46, 0x3B, 0x01, // Physical Maximum (315)
0x95, 0x01, // Report Count (1)
0x75, 0x04, // Report Size (4)
0x65, 0x14, // Unit (System: English Rotation, Length: Centimeter)
0x09, 0x39, // Usage (Hat switch)
0x81, 0x42, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)
0x75, 0x01, // Report Size (1)
0x95, 0x04, // Report Count (4)
0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x09, 0x30, // Usage (X)
0x09, 0x31, // Usage (Y)
0x09, 0x32, // Usage (Z)
0x09, 0x35, // Usage (Rz)
0x95, 0x04, // Report Count (4)
0x75, 0x08, // Report Size (8)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x02, // Usage Page (Sim Ctrls)
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x09, 0xC4, // Usage (Accelerator)
0x09, 0xC5, // Usage (Brake)
0x95, 0x02, // Report Count (2)
0x75, 0x08, // Report Size (8)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x09, // Usage Page (Button)
0x19, 0x01, // Usage Minimum (0x01)
0x29, 0x10, // Usage Maximum (0x10)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x10, // Report Count (16)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0, // End Collection
0x00, // Unknown (bTag: 0x00, bType: 0x00)
// 87 bytes
And removing the trailing "00" fixes the parsing by hidrd. That's where the 0 was coming from :)
Thank you for the investigation, @hadess Indeed, a descriptor with trailing zero would be an invalid descriptor. However, hidrd needs to be modified to be more resilient and to produce better error messages. I personally don't have much time for that at the moment, but I would of course welcome patches working towards that.
Doesn't seem to bother Windows, Linux, iOS or Android, FWIW.
@hadess Yes, that's why hidrd needs to be improved. Nevertheless the descriptor is invalid.
Not much that I can do with that though. I'll try adding some better error reporting in lib/item/any.c, see where it fails.