diff --git a/pcprox.py b/pcprox.py index 336f186..b3b2e9b 100644 --- a/pcprox.py +++ b/pcprox.py @@ -359,10 +359,10 @@ def read(self): If a message of all NULL bytes is returned, then this method will instead return None. """ - msg = self._dev.get_feature_report(0, 9) + msg = self._dev.get_feature_report(1, 8) # Feature reports have a report number added to them, skip that. - msg = bytes(msg[1:]) + msg = bytes(msg) if self._debug: print('USB RX: >>> ' + _format_hex(msg)) diff --git a/protocol.md b/protocol.md index aab763f..06e7436 100644 --- a/protocol.md +++ b/protocol.md @@ -126,6 +126,16 @@ wLength = 0x08 (bytes) hidapi: `hid_get_feature_report(device, "\0" + 8 byte buffer, 9)` +> **Note:** Due to [a bug in hidapi on OSX][hidapi-osx], we need to send a +> slightly different command: +> +> ```c +> char* buf = "\1\0\0\0\0\0\0"; +> hid_get_feature_report(device, &buf, 8); +> ``` +> +> This results in a different `wValue`, but the device seems to still accept it. + ### write A `write` is a [USB HID][usb-hid] Set Feature Report. Report IDs are not used. @@ -454,4 +464,5 @@ The total bit length of the card is [usb-hid]: https://www.usb.org/sites/default/files/documents/hid1_11.pdf [barkweb-wiegand]: http://cardinfo.barkweb.com.au/ [scancodes]: https://www.win.tue.nl/~aeb/linux/kbd/scancodes-14.html +[hidapi-osx]: https://github.com/signal11/hidapi/pull/219