:snake: Python wrapper for the hidapi. https://github.com/trezor/cython-hidapi
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Pavol Rusnak 6a0af0ab6c
bump version to 0.9.0 (to match hidapi version)
2 weeks ago
appveyor appveyor: create wheels instead of msi/exe 3 years ago
hidapi @ 7da5cc91fc switch to libusb branch of hidapi (#64) 2 weeks ago
.gitignore add more stuff to gitignore 3 years ago
.gitmodules switch to libusb branch of hidapi (#64) 2 weeks ago
.travis.yml TravisCI: add --with-system-hidapi to test-matrix (#37) 2 years ago
LICENSE-bsd.txt changing the license according to https://github.com/gbishop/cython-hidapi/issues/19 4 years ago
LICENSE-gpl3.txt changing the license according to https://github.com/gbishop/cython-hidapi/issues/19 4 years ago
LICENSE-orig.txt changing the license according to https://github.com/gbishop/cython-hidapi/issues/19 4 years ago
LICENSE.txt changing the license according to https://github.com/gbishop/cython-hidapi/issues/19 4 years ago
MANIFEST.in enable build against hidapi installed on system (#36) 2 years ago
README.rst switch to libusb branch of hidapi (#64) 2 weeks ago
appveyor.yml appveyor: add Python 3.7 support 10 months ago
chid.pxd Added call to hid_exit() in close() (#53) 8 months ago
hid.pyx return IOError when get_*_string fails (#62) 1 month ago
hidraw.pyx cleanup setup.py once again 6 years ago
requirements.txt update requirements for travis 3 years ago
setup.py bump version to 0.9.0 (to match hidapi version) 2 weeks ago
tests.py Add Travis CI support for automated testing on Linux 4 years ago
tox.ini tests: use tox-travis 2 years ago
try.py update example script (try.py) to work with Python3 2 years ago

README.rst

cython-hidapi
=============

.. image:: https://travis-ci.org/trezor/cython-hidapi.svg?branch=master
:target: https://travis-ci.org/trezor/cython-hidapi

.. image:: https://ci.appveyor.com/api/projects/status/t6ismmehxcvwp3tq?svg=true
:target: https://ci.appveyor.com/project/prusnak/cython-hidapi

.. contents::

Description
-----------

A Cython interface to `HIDAPI <https://github.com/libusb/hidapi>`_ library.

This has been tested with:

* `TREZOR <https://trezor.io/>`_ Hardware Wallet
* the PIC18F4550 on the development board from CCS with their example program
* the Fine Offset WH3081 Weather Station

It works on Linux, Windows and macOS.

Software Dependencies
---------------------

* `Python <http://python.org>`_
* `Cython <http://cython.org>`_
* hidraw or libusb+libudev on Linux

License
-------

cython-hidapi may be used by one of three licenses as outlined in LICENSE.txt

Install
-------

::

$ sudo apt-get install python-dev libusb-1.0-0-dev libudev-dev
$ sudo pip install --upgrade setuptools
$ sudo pip install hidapi

For other download options visit the `PyPi page <https://pypi.python.org/pypi/hidapi/>`_.

Build from source
-----------------

1. Download cython-hidapi archive::

$ git clone https://github.com/trezor/cython-hidapi.git
$ cd cython-hidapi

2. Initialize hidapi submodule::

$ git submodule update --init

3. Build cython-hidapi extension module::

$ python setup.py build

To use hidraw API instead of libusb add --without-libusb option::

$ python setup.py build --without-libusb

4. Install cython-hidapi module into your Python distribution::

$ sudo python setup.py install

5. Test install::

$ python
>>> import hid
>>>

6. Try example script::

$ python try.py

Udev rules
----------

For correct functionality under Linux, you need to create a rule file similar
to `this one <https://raw.githubusercontent.com/trezor/trezor-common/master/udev/51-trezor.rules>`_
in your udev rules directory.

Also you might need to call ``udevadm control --reload-rules`` to reload the rules.