Repository navigation
Conversation
In UMDF, returning TRUE from EvtUsbTargetPipeReadersFailed never resets the pipe or restarts the reader. The framework first checks that the port is connected, and FxUsbDevice::IsConnected always fails in user mode, so one transient read error left the controller silent until it was replugged, with the buttons it last reported still held. The driver now releases all controls when the reader fails, and a work item resets the input pipe and starts the reader again. When the reset fails, or the reader fails again within 5 s, it asks for a device restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The status report gains the USBD status of the last reader failure, the counts of reader failures, pipe resets and device restarts, and the number of input reports received. Setting the status report with command 1 runs the recovery as if the reader had failed, which status.ps1 -TestRecovery uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Over USB, the controller sometimes stops sending input for good. Games keep seeing the buttons it last reported as held, and only replugging the cable brings it back. For me it happened every so often in hectic fights, several times a day.
Cause
When the continuous reader on the interrupt IN pipe fails,
EvtUsbReadersFailedreturns TRUE, which should make the framework reset the pipe and send the readers again. In UMDF that never happens. The framework first asks whether the port is connected (fxusbpipe.cpp), andFxUsbDevice::IsConnectedsimply returnsSTATUS_UNSUCCESSFULin user mode (fxusbdevice.cpp). The readers are then never sent again.I caught one of these live, by logging the status report next to XInput:
0xC0000001.Change
WdfUsbTargetPipeResetSynchronouslygoes through while the target is stopped (fxusbpipeapi.cpp). The stop is needed becauseWdfIoTargetStartonly sends the readers again after a stop. If the reset fails, or the reader fails again within 5 s, the work item callsWdfDeviceSetFailed(WdfDeviceFailedAttemptRestart).UsbStopclears a running flag and flushes the work item, so a recovery cannot restart the reader during power down.status.ps1 -TestRecoveryuses it, and the README mentions it.Tested
USB only, Windows 11 build 26300. Nothing on the Bluetooth path changes; its transport just gets
NULLfor the test hook.0xC0000001, USBD status0x00000000), all recovered by pipe resets, 0 device restarts, input kept working.-TestRecoverywhile moving a stick: input keeps flowing after each pipe reset. A second failure within 5 s goes to the device restart.Things I found on the way, in case they help:
WdfUsbTargetDeviceResetPortSynchronously) between the pipe reset and the device restart. The reset itself succeeded, but the next rumble write on the interrupt OUT pipe never completed, despite its 500 ms timeout. That heldRumbleLock, so I dropped the port reset.WdfDeviceSetFailed(WdfDeviceFailedAttemptRestart)removes the interface (Kernel-PnP event 1011), and it stays away until the cable is replugged. That still beats stuck buttons, but it is not a real restart. If you know a better last step for UMDF, I'm happy to change it.🤖 Generated with Claude Code