gs-usb WinUSB support and timeout=none is forever#2031
Open
BenGardiner wants to merge 7 commits intohardbyte:mainfrom
Open
gs-usb WinUSB support and timeout=none is forever#2031BenGardiner wants to merge 7 commits intohardbyte:mainfrom
BenGardiner wants to merge 7 commits intohardbyte:mainfrom
Conversation
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>
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>
pass '0' when timeout=None (as proposed by @zariiii9003 in hardbyte#2026 (comment))
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>
Contributor
Author
|
I'm not even sure these unit tests proposed by the LLM are needed for gs_usb interface. (I also wonder if a removal or deprecation of gs_usb here should be considered because cantact is in tree and is more performant and python-can-candle works is more portable and more performant still) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
This changes gs_usb handling of timeout=None to 'forever' by passing 0 to the underlying layer as suggested by @zariiii9003 in #2026 .
But first I needed to make gs_usb use WinUSB instead of libusbK because I didn't want to zadig anymore. I had no clue how to do this so I got copilot claude opus 4.6 to make those base changes. Here's what they said in BenGardiner#1
I have tested here on a 500Kbps medium load bus; I used the same device and setup with all of the cantact, candle and gs_usb python-can drivers and got the same results
Related Issues / Pull Requests
Type of Change
Checklist
tox).Additional Notes
I will add news frag once I know what the PR # is.