Skip to content

FIX: Detect Xbox controllers on macOS when manufacturer string is "Microsoft Corporation"#2432

Open
jfreire-unity wants to merge 1 commit into
developfrom
fix-detecting-xbox-360-controller-on-macos
Open

FIX: Detect Xbox controllers on macOS when manufacturer string is "Microsoft Corporation"#2432
jfreire-unity wants to merge 1 commit into
developfrom
fix-detecting-xbox-360-controller-on-macos

Conversation

@jfreire-unity

@jfreire-unity jfreire-unity commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Xbox 360 (and other Xbox) controllers on macOS were falling back to the generic HID joystick layout instead of XboxGamepadMacOSNative.
  • Root cause: XInputSupport.cs used .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 as U+FFFD. Neither matches "Microsoft" exactly.
  • Fix: switch to 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, PID 0x028E) on macOS Tahoe surfaced in the Input Debugger as:

  • Layout: HID::�Microsoft Corporation Controller (generic HID fallback)
  • Type: Joystick
  • Product: Controller
  • Manufacturer: �Microsoft Corporation

Test plan

  • Plug an Xbox controller into a macOS machine and confirm the device shows up as XboxGamepadMacOSNative (type: Gamepad) in the Input Debugger instead of a generic HID joystick.
  • Confirm existing matchers (XboxGamepadMacOS, XboxGamepadMacOSWireless, XboxOneGampadMacOSWireless) are unaffected.
  • Run the Input System editor + standalone tests on macOS.

🤖 Partially generated with Claude Code

…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").

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect

A focused fix for Xbox controller detection on macOS that correctly addresses a manufacturer string mismatch.

🤖 Helpful? 👍/👎

@codecov-github-com

codecov-github-com Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

All 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     
Flag Coverage Δ
inputsystem_MacOS_6000.0 5.31% <ø> (ø)
inputsystem_MacOS_6000.0_project 77.47% <ø> (+0.22%) ⬆️
inputsystem_MacOS_6000.3 5.31% <ø> (ø)
inputsystem_MacOS_6000.3_project 77.46% <ø> (+0.24%) ⬆️
inputsystem_MacOS_6000.4 5.32% <ø> (ø)
inputsystem_MacOS_6000.4_project 77.48% <ø> (+0.24%) ⬆️
inputsystem_MacOS_6000.5 5.31% <ø> (ø)
inputsystem_MacOS_6000.5_project 77.51% <ø> (+0.25%) ⬆️
inputsystem_MacOS_6000.6 5.31% <ø> (ø)
inputsystem_MacOS_6000.6_project 6.59% <ø> (-70.67%) ⬇️
inputsystem_Ubuntu_6000.0 5.32% <ø> (ø)
inputsystem_Ubuntu_6000.0_project 77.38% <ø> (+0.22%) ⬆️
inputsystem_Ubuntu_6000.3 5.32% <ø> (ø)
inputsystem_Ubuntu_6000.3_project 77.37% <ø> (+0.24%) ⬆️
inputsystem_Ubuntu_6000.4 5.32% <ø> (ø)
inputsystem_Ubuntu_6000.4_project 77.38% <ø> (+0.24%) ⬆️
inputsystem_Ubuntu_6000.5 5.31% <ø> (ø)
inputsystem_Ubuntu_6000.5_project 77.42% <ø> (+0.25%) ⬆️
inputsystem_Ubuntu_6000.6 5.31% <ø> (ø)
inputsystem_Ubuntu_6000.6_project 6.55% <ø> (-70.62%) ⬇️
inputsystem_Windows_6000.0 5.31% <ø> (ø)
inputsystem_Windows_6000.0_project 77.59% <ø> (+0.21%) ⬆️
inputsystem_Windows_6000.3 5.31% <ø> (ø)
inputsystem_Windows_6000.3_project 77.59% <ø> (+0.24%) ⬆️
inputsystem_Windows_6000.4 5.32% <ø> (ø)
inputsystem_Windows_6000.4_project 77.59% <ø> (+0.24%) ⬆️
inputsystem_Windows_6000.5 5.31% <ø> (ø)
inputsystem_Windows_6000.5_project 77.64% <ø> (+0.24%) ⬆️
inputsystem_Windows_6000.6 5.31% <ø> (ø)
inputsystem_Windows_6000.6_project 6.38% <ø> (-71.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...nputSystem/Runtime/Plugins/XInput/XInputSupport.cs 100.00% <ø> (+100.00%) ⬆️

... and 278 files with indirect coverage changes

ℹ️ Need help interpreting these results?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant