pyhidapi
pyhidapi copied to clipboard
Please add examples
If you like my example, please add an examples dir and the example Python script.
https://github.com/wadester/wh_test_py/blob/master/hid_test.py
Thank for examples, I really needed them. I agree that is should be added to repo.
if anyone has an example of how to use the write function would be great I'm having issues getting the types right this is what i have tryied and it seams right from what
a = ctypes.c_void_p(0)
b = ctypes.c_char_p(10)
c = ctypes.c_size_t(1)
h.write((a,b,c))
a = ctypes.c_void_p(0)
b = ctypes.c_char_p(10)
c = ctypes.c_size_t(1)
h.write([a,b,c])
h.write((0x0,0x0,0x1))
and I'm not too sure what else to try any advice would be welcomed
This is how I got write working:
dev = hid.Device(vid, pid) # set vid and pid for your device
dev.write(b'\x01\x80\x33\x01\x00\x00\x00\x00') # writing 8 bytes to the device
bytes = dev.read(8, 1000) # reading 8 bytes from the device with a 1s timeout
bytes.hex(' ') # format the result in a human readable format