usbreset: return failure when device reset fails - #257
Open
JeffLepp wants to merge 1 commit into
Open
Conversation
usbreset currently returns success after a matching device is found even if open() or USBDEVFS_RESET fails. This prevents scripts from reliably detecting a failed reset. Return EXIT_FAILURE for both failure paths and EXIT_SUCCESS only after USBDEVFS_RESET succeeds. Signed-off-by: Jefferson Kline <jeffersonkline@gmail.com>
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.
Fixes #256: usbreset currently prints an error but returns success when either open() or USBDEVFS_RESET fails.
This PR makes reset_device() return failure for both error paths and return success only after USBDEVFS_RESET completes successfully.
Testing
Looking through the history, it appears the original usbreset behavior returned a nonzero status when open() or the reset ioctl failed but that behavior may have been accidentally removed in the OpenWrt usability refactor in commit 'a02f015'.