I am trying to write to a USB device attached to raspberry pi 3 installed with raspbian.
Error:
File "<stdin>", line 1
h.write([81 80 73 71 83 183 169 13])
^
SyntaxError: invalid syntax
code
#!/usr/bin/python
import hid
h = hid.device()
h.open(0x0665, 0x5161)
h.set_nonblocking(1) // Returns 0
h.write([0, 63, 35, 35] + [0] * 61) // Returns -1
h.write([81 80 73 71 83 183 169 13]) //Throws error above.
Whats wrong with this code? Based on the documentation in the library, it accepts any list of integers.
I used this as a ref: https://github.com/trezor/cython-hidapi/blob/master/try.py
Missing comma separation in the list.
List should be ,
(comma) separated,
Change h.write([81 80 73 71 83 183 169 13])
to
h.write([81, 80, 73, 71, 83, 183, 169, 13])