Improve FIDO USB detection with HID descriptor parsing + fixes#285
Open
Improve FIDO USB detection with HID descriptor parsing + fixes#285
Conversation
- Replace subclass check with HID usage page (0xF1D0) detection - Iterate all HID interfaces with proper resource cleanup - Add fallback for descriptor length read failures - Add comprehensive test suite Fixes reliability issues when USB devices have multiple HID interfaces.
Replace synchronized access with volatile keyword to fix inconsistent synchronization warning. Volatile is sufficient for this replace-only field pattern. Fixes SpotBugs IS2 warning
Change checkVendorProductIds() and checkUsbDevice() from package-private to public visibility. These methods are intended to be overridden by custom DeviceFilter implementations and require public access. Also update YubicoVendorFilter override to maintain consistency.
Add suppressions for getParcelableExtra() backward compatibility.
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.
Summary
Improves FIDO USB device detection by parsing HID report descriptors to identify devices by their FIDO Alliance usage page (0xF1D0), replacing the previous interface subclass check. This ensures more reliable detection when USB devices have multiple HID interfaces.
Changes
🔧 Main Refactoring
🐛 Bug Fixes
UsbDeviceManagerusingvolatilekeywordDeviceFiltermethods public to allow proper extensionWhy These Changes?
Problem
The previous implementation relied on interface subclass checks, which could fail to identify FIDO devices when:
Solution
By parsing the HID report descriptor and checking for the FIDO usage page (0xF1D0), we accurately identify FIDO-capable interfaces regardless of subclass value or other interfaces present.
Testing
@RunWith(Enclosed.class)patternBreaking Changes
None. The changes are backward compatible.
Commits
refactor: FIDO USB detection with HID parsing- Main improvementfix: resolve inconsistent synchronization- SpotBugs IS2 warning fixfix: make DeviceFilter methods public- API visibility correctionfix: suppress deprecation warnings for backward compatibility- Build warning cleanup