Skip to content

bkarstens/pyhidapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installing pyhidapi

This branch of pyhidapi is not currently on PyPI, so you must download the source. From the root of this repository:

pip install .

pyhidapi is dependant upon the hidapi library, which must be installed separately.

Installing hidapi

Linux

Installation procedures vary depending on your distribution.

Arch Linux

Binary distributions are available in the community repository.

  1. Enable the community repository in /etc/pacman.conf
[community]
Include = /etc/pacman.d/mirrorlist
  1. Install hidapi
pacman -Sy hidapi

CentOS/RHEL

Binary distributions are available through EPEL.

yum install hidapi

Fedora

Binary distributions are available.

dnf install hidapi

Ubuntu/Debian

Binary distributions are available.

apt install libhidapi-hidraw0

or

apt install libhidapi-libusb0

Others

Binary distributions may be available in your package repositories. If not, you can build from source as described in the libusb/hidapi README.

Windows

Installation procedure for Windows is described in the libusb/hidapi README

Binary distributions are provided by libusb/hidapi

Windows install location for dlls is C:\Windows\System32. Copy them into this folder to install. If you have 32-bit python, the 32-bit dll is requrired. Simillarly, if you have 64-bit python, the 64-bit dll is required.

OSX

There are currently no official binary distributions for Mac, so you must build hidapi yourself.

Installation instructions are described in the libusb/hidapi README

You can also use brew:

brew install hidapi

It should be noted that at this time, brew still uses the old signal11 repository which has long since been abandond. See Homebrew/homebrew-core#41122.

Sample usage code

The details about a HID device can be printed with following code:

import hid

vid = 0x046d	# Change it for your device
pid = 0xc534	# Change it for your device

with hid.Device(vid, pid) as h:
	print(f'Device manufacturer: {h.manufacturer}')
	print(f'Product: {h.product}')
	print(f'Serial Number: {h.serial}')

About

hidapi bindings in ctypes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%