ctypes bindings for hidapi
To install pyhidapi, use the standard module install procedure:
python setup.py install. You also need to ensure that you have the required hidapi shared library. On Linux distributions, this is generally in the repositories (for instance, under Debian you can install either libhidapi-hidraw0 or libhidapi-libusb0 depending on which backend you want to use).
TODO I don't know the installation procedure for Windows or other Linux distributions. If there is anything special needed, please add docs for it here.
pyhidapi works on OSX, but requires that you first build a shared library. There may be better ways to do this, but what I did was as follows:
- Download the latest hidapi release from https://github.com/signal11/hidapi/downloads and unzip
- Navigate to the mac directory
- Modify the Makefile to include -fPIC on the CFLAGS line. My CFLAGS now look like this:
CFLAGS+=-I../hidapi -Wall -g -c -fPIC
make. You should now have a hid.o file in this directory.
- Create the shared library by running:
gcc -shared -o libhidapi-iohidmanager.so hid.o -framework IOKit -framework CoreFoundation
- Copy the resulting libhidapi-iohidmanager.so to /usr/local/lib (or somewhere in the libs search path)
- Install pyhidapi as normal:
python setup.py install
- Verify by running python interactively and typing the following lines:
import hid hid.enumerate()
You should see a list of all USB hid devices on your system.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash||File type||Python version||Upload date|
|hid-1.0.3-py2-none-any.whl (3.7 kB) View hashes||Wheel||py2|
|hid-1.0.3.tar.gz (3.7 kB) View hashes||Source||None|