FIX: Detect Xbox controllers on macOS when manufacturer string is "Microsoft Corporation"#2432
Open
jfreire-unity wants to merge 1 commit into
Open
FIX: Detect Xbox controllers on macOS when manufacturer string is "Microsoft Corporation"#2432jfreire-unity wants to merge 1 commit into
jfreire-unity wants to merge 1 commit into
Conversation
…crosoft Corporation"
The macOS native matcher used .WithManufacturer("Microsoft"), which is an exact
case-insensitive equality check for plain-letter patterns. Real-world devices
report manufacturer as "Microsoft Corporation" (sometimes prefixed with an
invalid byte rendered as U+FFFD on macOS Tahoe), so the matcher missed and the
device fell back to the generic HID joystick layout. Switched to
WithManufacturerContains("Microsoft").
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop #2432 +/- ##
============================================
+ Coverage 58.58% 79.01% +20.43%
============================================
Files 738 765 +27
Lines 135831 140341 +4510
============================================
+ Hits 79570 110889 +31319
+ Misses 56261 29452 -26809 Flags with carried forward coverage won't be shown. Click here to find out more.
|
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
XboxGamepadMacOSNative.XInputSupport.csused.WithManufacturer("Microsoft")looks for "Microsoft" word only. Real-world devices report manufacturer as"Microsoft Corporation". And on macOS the string is sometimes prefixed with an invalid byte that decodes asU+FFFD. Neither matches"Microsoft"exactly.WithManufacturerContains("Microsoft"), which is what we want to avoid unnecessary characters such as the one we saw in a real example. This is not bulletproof but helps in this particular case.Repro
User reported an Xbox 360 controller (VID
0x045E, PID0x028E) on macOS Tahoe surfaced in the Input Debugger as:HID::�Microsoft Corporation Controller(generic HID fallback)Controller�Microsoft CorporationTest plan
XboxGamepadMacOSNative(type: Gamepad) in the Input Debugger instead of a generic HID joystick.XboxGamepadMacOS,XboxGamepadMacOSWireless,XboxOneGampadMacOSWireless) are unaffected.🤖 Partially generated with Claude Code