Repository navigation
fix: skip DFU runtime interfaces when scanning for devices - #15
Merged
Merged
Conversation
This was referenced Nov 1, 2026
Devices exposing a DFU runtime interface were opened during the scan, so one the user has no permission to access failed the whole search. Runtime interfaces cannot be used without a detach, which is not supported, so ignore them. Keep open failures fatal for devices in DFU mode, as skipping them could bypass the multiple device check and flash the wrong board, but log which device failed.
Logging is not visible to C++ callers, as the library installs no logger. Report the device in the error itself instead, so that every front end shows which one failed.
raphaelcoeffic
force-pushed
the
fix/skip-runtime-dfu-interfaces
branch
from
November 21, 2026 07:38
78347f9 to
5f31f75
Compare
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.
Alternative to #14, which reports the same bug: while scanning,
rdfufails entirely because it can't open a device unrelated to the one being flashed.Problem
is_dfu_devicematches on class and subclass only, so any device with a DFU runtime interface (protocol 1) gets opened during the scan. These are often ordinary peripherals in normal operation. If the user has no permission to open one, the whole search fails with errno 13.Changes
DFU_DETACHcode path here, so a runtime interface couldn't be used anyway. Protocol 0 is still accepted, for DFU 1.0 devices.DfuError::Openvariant carries the VID:PID, so the CLI and C++ callers both see it, for exampleUnable to open 30C9:00F3: failed to open device (errno 13). This adds a variant to the publicDfuErrorenum, which affects any external Rust code matching on it exhaustively.Why not skip devices that fail to open?
#14 logs the failure and carries on. Open errors stay fatal here because a failure on a device in DFU mode matters:
get_dfu_devicewould see a single device, pass theManyDFUDevicescheck and flash the other board. The reconnect paths could pick the wrong board the same way.rdfu listwould exit 0.Behaviour changes
rdfu listand the C++ device list no longer show devices that only have a runtime interface.--vendor/--productcan exclude it, because that filter is applied before any device is opened.Testing
cargo fmt --check,cargo clippy --workspace --all-targetsandcargo testpass on macOS.rdfu listonly reported "No DFU device found".Still to confirm
The device in #14 (
30C9:00F3) is assumed to expose a runtime interface, because it passes the current filter but is described as unrelated. Itslsusb -voutput would confirm that. If it reports protocol 0 or 2 instead, the scan will still fail on it, with an error naming the device.