Good news! The HID report parser I started work on last night is in a working state, even if it isn’t fully completed and compliant yet. Despite that, I can now plug in any keyboard in the house and have both the formatted report data printed out, and the keypresses indicated on the USBKEY’s LED irrespective of the report formatting of the device.
I’ve had to cut a few corners to keep it all statically allocated, avoiding problematic dynamic memory allocation at runtime. To that end, the stack depth of the parser (HID reports have the capability of pushing and popping the state table onto a custom stack) and the total number of HID report items which can be parsed into a table is limited by constants set at compile time. I’ve also tried to keep it simple so that it supports devices utilizing a single HID report - multiple-report devices are rare anyway and the multi-report support can be added by the user.
The demo now dumps out both the parser’s internal strings (for each report item processed), as well as the contents of the finalized report table. The latter gives out a bunch of entries on startup similar to the following:
Item 0:
Type: IN
BitOffset: 0
BitSize: 1
Usage Page: 7
Usage: 6
Usage Min: 224
Usage Max: 231
Unit Type: 0
Unit Exp: 0
Log Min: 0
Log Max: 1
Phy Min: 0
Phy Max: 0
I should be able to complete it next week. As far as I’m aware no one else has written a full parser for the AVR microcontrollers, so this is a great jump!
Recent Comments