Xbox One controller via Bluetooth
-
@sos_retropie I was wondering if you could share the steps you needed to do in order to get the controller working :) thanks a million!
-
@sos_retropie I would also be interested ina step-by-step set of instruction. Been hitting various forums for a while now. This is the only one that comes close.
-
@rmgreene I just followed the instructions in the first post (edited the bluetooth configuration file to say "N").
- Edit as above
- Launch bluetooth configuration tool from the Emulation Station "Retropie" page
- Detect bluetooth devices
- The device "Xbox One S Wireless" should appear
- Select it - I think I was successful with the first pairing option. If not, keep trying - although it sometimes freezes your system and you have to reboot then start again from step #2
- Once paired, exit back to EmulationStation (don't reboot, or you'll lose the pairing).
- Try to configure your control in the usual fashion in Emulation Station. If your Xbox One S pad is successfully detected, it should work, although you have to fudge the "select button". And the triggers didn't work for me.
- If step 7 works, see if it'll play in a retroarch-capable emulator e.g. lr-glupen64.
Good luck & report back your successes / failures :)
-
I've also been trying to get my xbox one s controller connected and am having little luck.
- Update Controller (Win10 Accessories)
- in terminal: "sudo su"
- then "echo 1 > /sys/module/bluetooth/parameters/disable_ertm"
- Do as @rmgreene does above
Buttons "select" and the xbox button do not seem to register.
Buttons "right trigger"and "left trigger" do some wacky shit (assigns against one of the joystick axis' and then skips the next input....)
So I skip those 4 buttons.I can then use the controller.
Upon restart of the system, "/sys/module/bluetooth/parameters/disable_ertm" has set itself back to "N" and thus won't connect again.Can't seem to find anyone offering alternate solutions....
EDIT: I figured I better try plugging the controller in with USB and see whether it would recognise the device or allow mapping. It did not recognise it
-
I have got my controller working without any faff now. Only the "select" button will not map, but you can use a different input (i remove left thumb and used that for select).
If anyone is interested, give me a shout
-
@OurFriendIrony Yeah, I'm interested. How did you overcome the wacky triggers? Bypass them and use the shoulder buttons instead? How did you get it to recognise and reconnect each boot?
Although I'm perfectly happy with my X360 wireless controller, I would quite like to use (via bluetooth) the slightly nicer Xbox One S sitting on the shelf waiting.
-
@sos_retropie - No problem.
Force bluetooth param to allow pairing
Edit the file /opt/retropie/configs/all/autostart.sh to look like the following:
sudo bash -c 'echo 1 > /sys/module/bluetooth/parameters/disable_ertm' emulationstation #auto
This will stop the error when you try and connect your xbox one s bluetooth controller and insure that when your Pi turns on it will keep the paired device to sync.
Pair Controller
Use the normal mechanism to pair your bluetooth controller (Retropie >> Bluetooth >> Register)
Map Controller
So, baring in mind the Select button does not seem to register but select is typically an important button in games, pick now which button you would like to pretend to be the select button. I chose the left thumb stick button and will explain these steps as such. This set of instructions is a bit dramatic, but i spent about half an hour fighting this damn thing, so save yourself some pain and follow it.
Use the controller mapping feature on emulationstation (Start >> Input) and hold A on your controller.
Skip the following buttons:- select
- left trigger
- right trigger
- left bumper
- right bumper
- left thumb stick button
Now, before you select done, press up on the D pad and travel back up and perform the following actions in order:
- left thumb stick button skip
- right bumper hold right bumper for 2 seconds and let go
- left bumper hold left bumper for 2 seconds and let go
- right trigger hold right trigger for 2 seconds and let go
- left trigger hold left bumper for 2 seconds and let go
- select press left thumb stick in
Go back down to the done button and hit it.
I now have a controller that works perfectly and always connects.
-
@OurFriendIrony Thanks a lot! The controller now pairs at boot up, and after waking from sleep - a major step forward. It configures in ES just as you've outlined.
The only issue for me now is that the triggers (mapped OK in ES) and select button (mapped to left thumb in ES) don't want to work in PSX emulation. Haven't tried with other emulators yet, but will do so tonight.
The terminal / shell shows some error message that SDL doesn't recognise certain input keys, which seem likely the root of the problem, and suggests submitting the error to SDL developers.
Getting closer....
-
@sos_retropie
Damn, they seem to work in n64 emulation, ive been playing Majoras mask which maps somethings to the triggers.Let me know how it goes buddy! It'll be good to find a perfect solution, but at least you can use the controller.
Let me know if you find anything more
-
Help! Trying to get mine to work as well...
RP3B, Latest everything, Xbox One S controller, works wired.
So in the bluetooth settings in Retropie-Setup, it see the controller. When I try to pair it, it asks for a security type. I choose the first one, and I get:
"An error occured connecting to the bluetooth device (Creating device failed: org.bluez.Error.AlreadyExists: Already Exists)."
I tried the next security setting (keyboard something or other) and it errors out and drops me in bash.I tried the echo 1> ... as above, said that I had no permission, even with sudo. So I chmod disable_etrm to 777. Now I have permission, but I'm still not getting anywhere.
Advice? (I'm a linux noob).
-
Alright... so I was getting the prior error when I didn't first "remove" the device and try to re-discover it. After removing and re-discovering the controller (making sure the controller is in discover mode, obv), it drops me out to bash, and this is what I see (copied from a putty window):
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 604, in msg_r eply_handler
reply_handler(*message.get_args_list(**get_args_opts))
File "/home/pi/RetroPie-Setup/scriptmodules/supplementary/bluetooth/bluez-simp le-agent", line 118, in pair_reply
dev_connect(dev_path)
File "/home/pi/RetroPie-Setup/scriptmodules/supplementary/bluetooth/bluez-simp le-agent", line 38, in dev_connect
dev.Connect()
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in call
return self.proxy_method(*args, **keywords)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in call
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call blocking
message, timeout)
dbus.exceptions.DBusException: org.bluez.Error.NotAvailable: Operation currently not available -
@hippoposthumous I'm not sure to be honest. I haven't made many more configurations/tweaks to any settings in retropie, but there may be a dependency/link to something else you've tweaked???
My permissions for the files in question are:
"autostart.sh" = 755
"disable_ertm" = 644I wonder if that has any impact?
-
@hippoposthumous You mentioned putty. Are you doing all this remotely? check the owner of the autostart and the disable_ertm files
autostart is "pi"
ertm is "root" -
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.
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.