Skip to content

Commit

Permalink
Add work-around for signal11/hidapi#219, as this is still broken on O…
Browse files Browse the repository at this point in the history
…SX 10.14
  • Loading branch information
micolous committed Nov 9, 2018
1 parent 3bc9ec8 commit 2da2c1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pcprox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
11 changes: 11 additions & 0 deletions protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

0 comments on commit 2da2c1b

Please sign in to comment.