Enumerate more subsystems without libudev #238
Merged
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.
The serialport crate currently has two different port enumeration strategies on Linux: using libudev and manually scanning
/sys/class/tty
.But there is a discrepancy between the ports returned. For example, the serial ports from a PCI card are not enumerated by the latter. Ports returned with the libudev enumeration on this machine:
And the ports returned without:
This PR sets out to close this gap by using the device subsystem as criterion whether to report a certain device or not. Previously, presence and contents of the
driver_override
file in the sysfs tree was used but this excluded PCI devices as well as the UARTs of Raspberry Pi devices.Enumeration of ports without libudev with the changes from this PR:
There might be corner cases still not caught by this PR. But it improves the enumeration results for cases which knowingly failed beforehand.