Use bus_id() instead of busnum() when constructing/matching on DeviceArg#60
Open
dingari wants to merge 3 commits into
Open
Use bus_id() instead of busnum() when constructing/matching on DeviceArg#60dingari wants to merge 3 commits into
bus_id() instead of busnum() when constructing/matching on DeviceArg#60dingari wants to merge 3 commits into
Conversation
…ching on DeviceArg busnum() is only available on Linux. The cross-platform equivalent is bus_id(). * Linux: String version of the busnum (e.g. \"001\") * MacOS: Top byte of the location ID (e.g. \"01\") * Windows: Unsure In any case, it should be consistent with the output of the `list` command in the example
sjoerdsimons
requested changes
Jun 16, 2026
sjoerdsimons
left a comment
Collaborator
There was a problem hiding this comment.
Changes seems fine; If you could fix the libusb example so CI succeeds then this should be ready to merge
f053ba1 to
3db3a72
Compare
dingari
commented
Jun 16, 2026
| .iter() | ||
| .find(|d| match d { | ||
| Ok(device) => { | ||
| device.bus_number() == dev.bus_number && device.address() == dev.address |
Contributor
Author
There was a problem hiding this comment.
Don't know which is better...
let bus_number = dev.bus_id.parse().unwrap();
device.bus_number() == bus_number && device.address() == dev.address
or
let bus_id = format!("{:03}", device.bus_number());
bus_id == dev.bus_id && device.address() == dev.address
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.
busnum()is only available on Linux. The cross-platform equivalent isbus_id().In any case, it should be consistent with the output of the
listcommand in the example.