Libusb Python Package (Installer)

1.0.26.3 · active · verified Sat Apr 11

libusb-package is a Python library that functions primarily as an installation vehicle for the libusb shared C libraries, making it easier to install tools and applications that require libusb, such as pyusb. It bundles the necessary libusb binaries for various platforms and architectures, simplifying deployment by avoiding manual libusb installation. The package is actively maintained, with version 1.0.26.3 being the latest, and receives updates to support new Python versions and upstream libusb releases.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import `libusb_package` and use its `find_library` function to provide a backend for `pyusb`, allowing `pyusb` to utilize the libusb shared library bundled within `libusb-package`. It then attempts to find a generic USB device (replace with your actual Vendor/Product ID).

import libusb_package
import usb.core
import usb.backend.libusb1

# Get a PyUSB backend using the bundled libusb library
backend = usb.backend.libusb1.get_backend(find_library=libusb_package.find_library)

# Use the backend to find USB devices (example with pyusb)
dev = usb.core.find(idVendor=0xffff, idProduct=0xffff, backend=backend)

if dev is None:
    print("Device not found. Make sure it's connected and drivers are installed (especially on Windows).")
else:
    print(f"Found device: {dev.product} (Bus {dev.bus}, Address {dev.address})")
    # Further operations with 'dev' using pyusb

view raw JSON →