From c37c556e912f1ac81c017251f331a1e367443728 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Tue, 26 Oct 2021 20:40:35 +0200 Subject: [PATCH] use `pyusb_libusb1_backend` on Linux/macOS This will make it easier to get libusb installed on those platforms. --- plover_stenograph_usb.py | 6 +++++- setup.cfg | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plover_stenograph_usb.py b/plover_stenograph_usb.py index e5420d0..377876f 100644 --- a/plover_stenograph_usb.py +++ b/plover_stenograph_usb.py @@ -488,6 +488,8 @@ else: from usb import core, util + from pyusb_libusb1_backend import get_pyusb_backend + class StenographMachine(AbstractStenographMachine): def __init__(self): @@ -503,8 +505,10 @@ else: if self._connected: self.disconnect() + backend = get_pyusb_backend() + # Find the device by the vendor ID. - usb_device = core.find(idVendor=VENDOR_ID) + usb_device = core.find(backend=backend, idVendor=VENDOR_ID) if not usb_device: # Device not found return self._connected diff --git a/setup.cfg b/setup.cfg index e9bd8b7..ac397da 100644 --- a/setup.cfg +++ b/setup.cfg @@ -26,7 +26,8 @@ tests_require = install_requires = plover>=4.0.0.dev5 more_itertools - pyusb>=1.0.0;platform_system!="Windows" + pyusb>=1.0.0; platform_system != "Windows" + pyusb_libusb1_backend; platform_system != "Windows" py_modules = plover_stenograph_usb