Skip to content

Commit 556bb7e

Browse files
committed
Merge remote-tracking branch 'origin/master' into develop
2 parents 470a812 + a738fad commit 556bb7e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

docs/features/rawhid.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ To send data to the keyboard, you must first find a library for communicating wi
2828
* **Node.js:** [node-hid](https://github.com/node-hid/node-hid)
2929
* **C/C++:** [hidapi](https://github.com/libusb/hidapi)
3030
* **Java:** [purejavahidapi](https://github.com/nyholku/purejavahidapi) and [hid4java](https://github.com/gary-rowe/hid4java)
31-
* **Python:** [pyhidapi](https://pypi.org/project/hid/) and [pywinusb](https://pypi.org/project/pywinusb)
31+
* **Python:** [hid](https://pypi.org/project/hid/) and [pywinusb](https://pypi.org/project/pywinusb)
3232

3333
Please refer to these libraries' own documentation for instructions on usage. Remember to close the device once you are finished with it!
3434

35+
::: tip
36+
The `hid` package is installed with `pip install hid` and imported as `import hid`. Avoid installing the unrelated `pyhidapi` package from PyPI, which is a different, unmaintained project despite the similar name.
37+
:::
38+
3539
Next, you will need to know the USB Vendor and Product IDs of the device. These can easily be found by looking at your keyboard's `info.json`, under the `usb` object (alternatively, you can also use Device Manager on Windows, System Information on macOS, or `lsusb` on Linux). For example, the Vendor ID for the Planck Rev 6 is `0x03A8`, and the Product ID is `0xA4F9`.
3640

3741
It's also a good idea to narrow down the list of potential HID devices the library may give you by filtering on the usage page and usage ID, to avoid accidentally opening the interface on the same device for the keyboard, or mouse, or media keys, etc.
@@ -72,7 +76,7 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
7276
}
7377
```
7478

75-
On the host side (here we are using Python and the `pyhidapi` library), the HID device is opened by enumerating the interfaces on the USB device, then filtering on the usage page and usage ID. Then, a report containing a single ASCII "A" (hex `0x41`) is constructed and sent.
79+
On the host side (here we are using Python and the `hid` package), the HID device is opened by enumerating the interfaces on the USB device, then filtering on the usage page and usage ID. Then, a report containing a single ASCII "A" (hex `0x41`) is constructed and sent.
7680

7781
For demonstration purposes, the manufacturer and product strings of the device, along with the request and response, are also printed.
7882

0 commit comments

Comments
 (0)