File tree Expand file tree Collapse file tree 2 files changed +22
-11
lines changed
examples/HID/hid_generic_inout Expand file tree Collapse file tree 2 files changed +22
-11
lines changed Original file line number Diff line number Diff line change 1515 *
1616 * There are 2 ways to test the sketch
1717 * 1. Using nodejs
18- * - Install nodejs and nmp to your PC
19- * - Install execellent node-hid (https://github.com/node-hid/node-hid) by
20- * $ npm install node-hid
21- * - Run provided hid test script
22- * $ node hid_test.js
23- *
24- * 2. Using python hidRun
25- * - Python and `hid` package is required, for installation please follow https://pypi.org/project/hid/
26- * - Run provided hid test script to send and receive data to this device.
27- * $ python3 hid_test.py
18+ * - Install nodejs and npm to your PC
19+ *
20+ * - Install excellent node-hid (https://github.com/node-hid/node-hid) by
21+ * $ npm install node-hid
22+ *
23+ * - Run provided hid test script
24+ * $ node hid_test.js
25+ *
26+ * 2. Using python
27+ * - Install `hid` package (https://pypi.org/project/hid/) by
28+ * $ pip install hid
29+ *
30+ * - hid package replies on hidapi (https://github.com/libusb/hidapi) for backend,
31+ * which already available in Linux. However on windows, you may need to download its dlls from their release page and
32+ * copy it over to folder where python is installed.
33+ *
34+ * - Run provided hid test script to send and receive data to this device.
35+ * $ python3 hid_test.py
2836 */
2937
3038#include " Adafruit_TinyUSB.h"
Original file line number Diff line number Diff line change 1212 if dev :
1313 while True :
1414 # Get input from console and encode to UTF8 for array of chars.
15- str_out = input ("Send text to HID Device : " ).encode ('utf-8' )
15+ # hid generic inout is single report therefore by HIDAPI requirement
16+ # it must be preceeded with 0x00 as dummy reportID
17+ str_out = b'\x00 '
18+ str_out += input ("Send text to HID Device : " ).encode ('utf-8' )
1619 dev .write (str_out )
1720 str_in = dev .read (64 )
1821 print ("Received from HID Device:" , str_in , '\n ' )
You can’t perform that action at this time.
0 commit comments