jbaiter / hidapi-cffi Goto Github PK
View Code? Open in Web Editor NEWPython bindings for hidapi via CFFI
License: BSD 3-Clause "New" or "Revised" License
Python bindings for hidapi via CFFI
License: BSD 3-Clause "New" or "Revised" License
send_feature_report
and get_feature_report
have report_id
parameters whose type is documented to be int
. send_feature_report
defaults the parameter to 0x0
, an int
.
However, they both write the report ID to the first byte of a CFFI buffer, which fails on Python 3:
Suppose I have this code:
dev.send_feature_report(b"\x00", 0x20)
It fails:
Traceback (most recent call last):
File "./test.py", line 23, in <module>
dev.send_feature_report(b"\x00", 0x20)
File "/home/rprichard/proj/logitech-g400-config/hidapi_cffi/hidapi.py", line 284, in send_feature_report
buf[0] = report_id
TypeError: must assign a bytes of length 1, not int
To make it work, I must instead pass a 1-byte bytestring for the report ID:
dev.send_feature_report(b"\x00", b"\x20")
I'm using:
I also tried replacing python3-cffi with one installed by pip3, but it made no difference.
Aside: is it actually useful to default the report_id for send_feature_report
to 0x0? I think it'd might make sense if the default behavior instead omitted the report ID from the buffer passed to hidapi.hid_send_feature_report
, but that's not what happens.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.