I would like to implement the read and write calls of the python hidapi, in pysub.
An example code using the python hidapi, looks like this:
import hid
hdev = hid.device()
h = hdev.open_path( path )
h.write( send_buffer )
res = h.read( 64 )
receive_buffer = bytearray( res )
The main problem that I have with this is that the python hidapi read() returns a list of ints (one python int for each byte in the buffer received from the hardware), and I need the buffer as bytes and faithful to what was received.(*)
A secondary issue is that open, read and write are the only things I need and I need to keep the system as light as possible. Therefore I want to avoid the extra dependencies.
(*) bytearray() is not a good solution in this case, for reasons beyond the scope of this question.