pok3r-custom / pok3rtool

Command line tool and library for keyboards using qmk-pok3r
BSD 3-Clause "New" or "Revised" License
41 stars 7 forks source link

Use LibUSB-1.0 RawHID backend for Windows/macOS/Linux #14

Closed hansemro closed 1 year ago

hansemro commented 1 year ago

In preparation for ISP protocol support for all platforms, this PR replaces platform-specific rawhid backends with a common LibUSB-1.0 backend. With only one backend to maintain, it becomes easier to add control transfer functionality to RawHID and HIDDevice which is required by #13 for working flash programming (see #12 for more information).

Tasks:

hansemro commented 1 year ago

I am going to drop/revert control transfer support in this PR so that it can be included alongside ISP protocol support.

hansemro commented 1 year ago

@ChaoticEnigma This is ready for review.

hansemro commented 1 year ago

Having issues with Windows again. It works for detecting ISP but not keyboards. The error is related to matching Usage and Usage Page in the HID Report descriptor.

hansemro commented 1 year ago

I might be able to workaround this by using libusb/hidapi

hansemro commented 1 year ago

hidapi works much better than the current implementation.

hansemro commented 1 year ago

Reverting libhidapi changes due to odd behavior in macOS that prevents the usb device from being detected on subsequent access attempts.

Related: https://github.com/libusb/hidapi/issues/385

hansemro commented 1 year ago

Workaround for Windows: