Xbox One controller via Bluetooth
-
Just a few more (positive) updates:
I now have my Xbox One S Wireless controller (h/w version 1708, latest firmware as of 3/2/17) working 100% in PSX and N64 emus.
For N64 emu, I use the non-lr mupen64plus, so I manually edited the mupen64plus.cfg file (/opt/retropie/configs/n64/) to get the mappings correct.
Similarly, I manually edited the PSX config (/opt/retropie/configs/psx/retroarch.cfg) and adjusted the player 1 input mappings to match what SDL is seeing (see below).
For me, the breakthrough was using 'jstest' to identify which buttons and axis were actually being detected by SDL, since the confusion seems to be how emulation station attempts but fails to correctly write the config for this controller via bluetooth. Of note, the 'select' button is the only button that is still not properly registered by SDL: in jstest, the select button on the controller gives a '@' symbol in the shell, rather than a value next to an axis or button).
The mappings I had for my h/w and firmware combo (and SDL 2.1) are:
On the controller: --> SDL Map:
Left analog stick U,D --> axis 0 (-1,+1)
Left analog stick L,R --> axis 1 (-1,+1)
Left shoulder button --> btn 6
Right shoulder button --> btn 7
Select (left small button) --> ERROR (so I use left joy button, 13)
Start (right small button) --> btn 11
A --> btn 0
X --> btn 3
B --> btn 1
Y --> btn 4
Left Trigger --> axis 5+/-
Right Trigger --> axis 4+/-
D-pad Left / Right --> axis 6- / 6+
D-pad Up / Down --> axis 7- / 7+
Right analog stick U,D --> axis 3 (-1,+1)
Right analog stick L,R --> axis 2 (-1,+1)
Left joy button --> btn 13
Right joy button --> btn 14 -
There seem to be relevant SDL2 commits that might fix this:
https://github.com/spurious/SDL-mirror/commit/c0bf85bee4bdc7cfeadccbf2e2a426d11620a357
Has anyone tried building sdl2 from the latest source to try it out? I found the following file, that I believe if you changed the branch to master would selected the latest code:
https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/supplementary/sdl2.sh#L45 which lives at /home/pi/RetroPie-Setup/scriptmodules/supplementary/sdl2.sh on your pi.
However I don't know how to trigger it to rebuild/install an updated library...
-
I did some more testing, when pressing the select button it is coming in as a keydown/up event for the backspace key, rather than a standard joystick button press. Examples:
sudo evtest /dev/input/event1
...
Event: time 1487664811.714827, -------------- EV_SYN ------------
Event: time 1487664811.744826, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0224
Event: time 1487664811.744826, type 1 (EV_KEY), code 158 (KEY_BACK), value 1
Event: time 1487664811.744826, -------------- EV_SYN ------------
Event: time 1487664812.022398, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0224
Event: time 1487664812.022398, type 1 (EV_KEY), code 158 (KEY_BACK), value 0
Event: time 1487664812.022398, -------------- EV_SYN ------------sudo ./sdl2-jstest -e 0
...
Joystick Name: 'Xbox Wireless Controller'
Joystick GUID: 050000005e040000fd02000003090000
Joystick Number: 0
Number of Axes: 6
Number of Buttons: 15
Number of Hats: 1
Number of Balls: 0
GameController:
not a gamepadEntering joystick test loop, press Ctrl-c to exit
SDL_JOYDEVICEADDED which:0
SDL_JOYDEVICEADDED which:1
SDL_CONTROLLERDEVICEADDED which:0
SDL_JOYAXISMOTION: joystick: 0 axis: 4 value: -32768
SDL_JOYAXISMOTION: joystick: 0 axis: 5 value: -32768
Error: Unhandled event type: 768
Error: Unhandled event type: 769
Error: Unhandled event type: 768
Error: Unhandled event type: 769And if you look at the source, 768/769 is SDL_KEYDOWN / SDL_KEYUP, events that don't seem to be handled under the normal joystick loops in emulationstation/libretro.
For reference I did try building the latest libsdl2 and emulationstation from source, it didn't resolve the problem.
I don't know the Linux driver hierarchy well enough to suggest a fix, but it would be ideal to remap this to an actual button press in the kernel, before it gets exposed up through the /dev/inputs/[jsX/eventX] interfaces. Maybe the xpad driver could do this? I don't know how the bluetooth driver exposes things to the rest of the system.
Alternatively some combination of sdl2/emulationstation would need to be patched, as well as libretro to watch for the key events.
-
Is there more information/update on this? Select button is the only thing not working for me other than the wonky triggers. If this could finally work it would be the best controller to use for retropie.
-
I set up my Pi3 and had the hardest time setting up my Xbox One Controller. It would work in RetroPie but wouldn't work in any game. I tried manually editing retroarch.cfs, every input I could think of, etc.
Finally, What did it for me was a complete reset. I reformatted my SD card, installed RetroPie again including all the roms. Forced the bluetooth param to allow paring following @sos_retropie 's instructions... mapped and rebooted.. and now it works seamlessly (select button and all).
I tried adding in my second Xbox One Controller and RetroArch went crazy. I hooked up a PS3 controller via USB and it worked fine. Anyway, if anybody has figured out how to get two Xbox One Controller working, let me know :)
-
@alaindesjardins said in Xbox One controller via Bluetooth:
Is there more information/update on this? Select button is the only thing not working for me other than the wonky triggers. If this could finally work it would be the best controller to use for retropie.
I've sent pull requests that will fix this issue.
-RetroArch https://github.com/libretro/RetroArch/commit/da8662bb4acd1d0e67402197f448767964d5690d (this is merged)
-RetroPie - https://github.com/RetroPie/SDL-mirror/pull/4 https://github.com/RetroPie/SDL-mirror/pull/5 https://github.com/RetroPie/SDL-mirror/pull/6 - these are currently not merged. If you want to chime in on pull request #4 to get it merged that would be helpful. I plan on writing instructions on how to use this code prior to it being merged mainline, but haven't had time to put it together yet. -
@halcyon I just bought two PS4 controllers. I am going to hold on to them as long as I can without opening the package to return them in a heartbeat if this gets fixed. I would much rather use the XBox1 controller because it is my favorite. I really like the D-Pad and I have an XBox so they are more valuable to me. Really thanks for submitting what you did. I really wish I knew how to do some of this work because there are so many things I would like to do. Maybe this can be an inspiration but the learning curve is so high I think and without projects to start on, I have nowhere to begin.
-
@halcyon said in Xbox One controller via Bluetooth:
@alaindesjardins said in Xbox One controller via Bluetooth:
Is there more information/update on this? Select button is the only thing not working for me other than the wonky triggers. If this could finally work it would be the best controller to use for retropie.
I've sent pull requests that will fix this issue.
-RetroArch https://github.com/libretro/RetroArch/commit/da8662bb4acd1d0e67402197f448767964d5690d (this is merged)
-RetroPie - https://github.com/RetroPie/SDL-mirror/pull/4 https://github.com/RetroPie/SDL-mirror/pull/5 https://github.com/RetroPie/SDL-mirror/pull/6 - these are currently not merged. If you want to chime in on pull request #4 to get it merged that would be helpful. I plan on writing instructions on how to use this code prior to it being merged mainline, but haven't had time to put it together yet.Funny, I just reread your post. I asked on the pull request on how to use the code so I could test it right away. I'm desperate on getting everything working and wanted to use it. I had another question too about the XBox Guide (Home button? the one that is lit up) to see if maybe that one could be fixed as well. I know when wired it works as a button, but wireless it doesn't seem to do anything. I didn't know if it was broken in the same way the select button was.
Anyways, thanks for helping with this. I'm very excited to see this select button fixed :) I keep checking every day! I got my controller to reconnect during start up and waking it up... previously I was not able to do this as it would hang and not reconnect, but it's working now. The other problem I have is my bluetooth keyboard (logitech) seems to gain a lot of lag when my XBox controller is using bluetooth. I can press a key and count to 3 before it actually fires off... if I type too long thinking it will catch up, it stalls and repeats letters multiple times. Kind of a strange problem but I can live with it if my xbox controller works.
-
Thanks for this, I fought with this configuration for several hours the last time that I tried to get it working. Found this thread when I was re-building my pi setup and managed to get it working within a few minutes.
I'm running RetroPie from OSMC using the RetroOSMC script. In order to get things working I needed to add the disable_ertm line to a different script since "/opt/retropie/configs/all/autostart.sh" doesn't exist for me. Adding the disable_ertm command to line 13 of "/home/osmc/Retropie/scripts/retropie.sh" did the trick.
Hopefully this helps someone.
-
Does anyone know how to use the code submitted by @halcyon without waiting for the pull request to be merged? I'd like to see about fixing the select button soon and not have to wait. Also, is the guide button working for others? It doesn't do anything for me unlike when i use USB with the controller, I can map it.
-
Any updates on this thread? I just bought an Xbox One Controller with Bluetooth. Updated the firmware via Windows - Xbox Accessories. And I can't get the SELECT button to register. However, when I use the USB cable, all the buttons work. In the links above, there seem to be fixes for this, that are dated back to 2016. Just not sure what is going on...
Thanks,
~Aaron -
@memphis2k I can tell you that my controller was working perfect with the select button, then I updated the firmware to the newest version through Windows 10 and now the select button can't be used. So this seems to be a firmware issue with the controller.
Hopefully this helps narrow down a fix in the future.
-
Anyone got this working??
-
I'd very much like to know this too!
Does anyone have a fully functioning Xbox One S / Bluetooth controller set up with Retropie - including the Select button?
-
@eggsnbacon: A (potential) firmware problem also gives me headaches. I recently tried to use a brand new xbox one wireless controller with retropie. No luck so far. I did, as all posts mentioned that I could find about it (including this one). The steps:
- A firmware upgrade to the controller. If you don't have an XBox One, this one has to be done using windows. If you are on OSX or Linux, well, Virtualbox might help (as in my case).
- Disable bluetooth ertm setting "/sys/module/bluetooth/parameters/disable_ertm" to "Y"
- Then go to Blootooth and pair the device.
My problem: The XBox Controller appears there, but not with the correct name. The device just shows up in the bluetooth setup as: "6F:AC:C1:21:94:E5 6F:AC:C1:21:94:E5". So there is the BT id twice but no assignment to a human readable configuration. I can pair it but then the device can not be configured.
Hence I think it is time to get some more detailed info about when it should work and under what conditions. In all posts I could find nobody actually talked about the systems and versions they were using which is of no help if you are debugging. Hence here is min (which is not working):
Controller:
- Microsoft Xbox One Wireless Model 1708
- Firmware version 3.1.1221.0
Firmware update system
- Windows 10 Enterprise V1704, Build 15063.540
- XBox Accessory App (No version available)
System
- Raspberry Pi 3 B
- Linux 4.9.35-v7+ armv7l GNU/Linux
- Emulationstation V2.1.5RP
-
I have no problems getting my Xbox (One) Wireless Controller to pair with either internal BT or a dongle - allowing me to setup input in Emulationstation. However, when starting a game it takes a long time for the controllers to become active.
It does register immediately with “Xbox wireless controller on port #0” but sometimes takes a few minutes of butting mashing before it becomes usable. Obviously in USB mode they work fine.
Does anyone have any thoughts?
-
@KAJed I have the same problem, i have to either turn the controller off and on again,
OR just press right trigger, then somehow the controller responds in game (At least better than mashing random buttons).
Xbox One (1708) -
I had issues with the standard method for configuring an X-Box One S Pad for wireless. It'd get picked up as a 360 controller, vibration -would not - work in the default PSX emulator. Additionally, I had a trouble with the "Home" button being recognized correctly. Triggers were goofy too, if I remember correctly. I ended up reimaging my device (had issues removing the configs, must have missed some) and switched to corded ONLY. Vibration and the "Home" button work, triggers are better but still wonky in the autoconfig via Emulation Station. Good luck!
-
Doing that didn’t work at all for me. I have an Xbox One S controller that is Bluetooth compatible. (Yes I am absolutely sure of this, don’t ask me if it is, because I checked.) I changed the internal settings to disable emtr and the only thing that pops up when trying to add a Bluetooth device is my speaker and four other options with a series of letters and numbers. (Somewhat like this: A1-B2-C3-D4-E5-F6) Can someone please help?
-
This thread has 67 THOUSAND views! This seems to be a popular controller, is it just not being used by the people who matter?
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.