buttonxboxgamepad

How to check if Xbox series controller "share" button is pressed?


New Xbox gamepads have a new "share" button and I can't find a way to check if it's pressed. It is possible?


Solution

  • Yes, Xbox Wireless Controller Model 1914 (aka "Xbox Series X|S Controller") sends the Share button as the first bit of the last byte of the controller data report. Over Bluetooth HID the button uses the Record usage from the Consumer usage page.

    Most platform gamepad APIs don't support the Share button. That includes XInput and Windows.Gaming.Input on Windows and joydev on Linux. Also on Linux, the xpad module (the driver for USB-connected Xbox controllers) doesn't support the Share button over USB. You'd need to install xpad-neo, which maps it to the KEY_RECORD input event code. (This is the same event code that the Consumer Record HID usage is normally mapped to.) macOS supports the Share button through the Game Controller framework. Recent versions of Android include a keylayout file to map the button to MEDIA_RECORD.