gs-usb WinUSB support and timeout=none is forever (#2031)
* Update gs_usb driver to support WinUSB by not forcing libusb1 backend Replace GsUsb.scan() and GsUsb.find() calls with local helper functions that call usb.core.find() without specifying a backend, allowing pyusb to auto-detect the best available backend. This enables WinUSB support on Windows in addition to libusbK. Update documentation to reflect WinUSB support and add unit tests. Co-authored-by: BenGardiner <243321+BenGardiner@users.noreply.github.com> * Add pyusb as explicit dependency in gs-usb optional group The gs_usb interface directly imports `usb` (pyusb) for USB device discovery, so pyusb must be an explicit dependency rather than relying on it being a transitive dependency of the gs-usb package. Co-authored-by: BenGardiner <243321+BenGardiner@users.noreply.github.com> * gs_usb: treat timeout=None as forever pass '0' when timeout=None (as proposed by @zariiii9003 in https://github.com/hardbyte/python-can/pull/2026#issuecomment-3941747658) * add news fragment * formatting fixes * gs_usb module needed in tests deps now * Fix gs_usb shutdown to always call parent BusABC.shutdown() BusABC has a class-level _is_shutdown = True attribute. When __init__ was not called (as in test mocks), GsUsbBus.shutdown() resolved this class attribute and returned early, never calling super().shutdown(). Restructure shutdown() to always call super().shutdown(), using the pre-call _is_shutdown state only to guard interface-specific cleanup. Co-authored-by: BenGardiner <243321+BenGardiner@users.noreply.github.com> * note pyusb not WinUSB in news and news frags are a sentence not a list (@zariiii9003) * put gs-usb dep into tox.ini (@zariiii9003) * combine _scan_gs_usb_devices() and _find_gs_usb_device() (@zariiii9003) * don't instantiate a GsUsb device for every one detected (@zariiii9003) * remove gs-usb from mypy (@zariiii9003) * gs_usb: explicitly handle timeout=None separate from =0 (@zariiii9003) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: BenGardiner <243321+BenGardiner@users.noreply.github.com>
B
Ben Gardiner committed
a624fd8793055c44b41fa164995b088fdaec8526
Parent: 31b57a6
Committed by GitHub <noreply@github.com>
on 3/11/2026, 5:38:58 PM