Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bus_id and port_chain field to UsbPortInfo (all platforms) #227

Closed
wants to merge 3 commits into from

Conversation

kindermax
Copy link

@kindermax kindermax commented Nov 24, 2024

Add bus_id and port_chain field to UsbPortInfo (all platforms)

Implementation taken and adapted from nusb crate

It returns stable full path to the serial port. Returned value is formatted as `a-b.c` where `a` is a bus_id and `b` and `c` are port numbers.
Implementation taken and adapted from nusb crate
@kindermax kindermax changed the title Add location field to UsbPortInfo Add bus_id and port_chain field to UsbPortInfo (all platforms) Nov 30, 2024
@kindermax kindermax closed this Dec 1, 2024
@sirhcel
Copy link
Contributor

sirhcel commented Dec 1, 2024

Thank you for starting this PR! We've currently got a (CI) issue with one of our sub dependency which is about getting resolved with #229 and #230. So rebasing the changes on #230 will resolve the red herrings arising from #229 in the CI builds here as well. See pipeline run 12108758040 for a rebase test.

Have you completely abandoned this idea or are you still working on it in kindermax#1? In case you are, do you know if there is a cross-platform string representation of a port "path"?

@sirhcel
Copy link
Contributor

sirhcel commented Dec 1, 2024

Have you seen the reference to the nusb crate regarding port chains #222? They seem to use a binary representation. Do you see a big plus for either a string representation or a vector of port numbers?

I have not looked into it but using nusb for determining bus ID and port chain might also be an option.

@kindermax
Copy link
Author

Hi, @sirhcel, I am still working on this functionality, I just mistakenly opened PR to the original repo instead of my fork, because the work wasn't ready to be shown here yet. But, anyway)

In general, I tried to implement this functionality as close as possible to nusb to be able to share the same location representation between nusb part of a program and serialport-rs part of a program.

@kindermax
Copy link
Author

kindermax commented Dec 2, 2024

I have not looked into it but using nusb for determining bus ID and port chain might also be an option.

Theoretically this is possible, if somehow match nusb::DeviceInfo with SerialPortType::UsbPort(UsbPortInfo) then we indeed can use port info from nusb, but I went in other direction and end up with this PR)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants