I tried it with 0.006 and every thing worked fine.
With 0.007 i have problems with more than one controller.
In OSMC I turn both xbox360 controllers on. Only the first controller is working and the led is on 1. On the second controller every leds are flashing and buttons not working (this is right behavior).
Then i start the retropielauncher addon. The led from first controller is going on 3 and the leds from the second controller ends flashing and go on 1. Now the second controller is working in Emustation and in all games, the first controller do nothing. Only one controller is recognized by Emustation.
I just wanted to keep this thread alive. I just followed the instructions from Yggdrasil in the OP on retrosmc 0.007 and the latest OSMC with Kodi/Jarvis using a new RaspberryPi 3. As a couple people mentioned, the config would work to control the emulation station menus, but not in the games themselves. I was getting the following error when the switchtoxpad.sh script would run.
Error couldn’t claim the USB interface: LIBUSB_ERROR_BUSY
This would block the first controller from working in RetroPie. After a lot of tinkering, I got things working. I saw in other posts people blacklisted xpad on boot, which may or may not be needed.
sudo nano /etc/modprobe.d/raspi-blacklist.conf
Add the text:
blacklist xpad
Reboot. With this out of the way I could remove the calls to “rmmod xpad”.
I then added a long sleep to my switchtoxpad.sh after the kill command.
I was using the xboxdrv bin installed by retrosmc in /opt/retropie/… (I don’t have the full path handy) rather than the apt-get binary shown above (again, this might not matter). With these changes in place the switchtoxpad.sh and switchtoxboxdrv.sh scripts seemed to hand off ok, which you can check with :
ps aux | grep xboxdrv
In the original directions the first controller (wid 0) wouldn’t be running. With these in place I was able to configure the button mapping in the RetroPie GUI where you map every button on the xbox controller. I managed to do this for two controllers and verify they worked in a couple SNES games. Victory! I did a couple reboots and switched between Kodi and RetroPie a few times, showing the controller settings persist. I have a new SD card coming soon, so I get to do this all over again on a fresh install. Hopefully I can follow my own instructions. I think adding the long sleep was the crux of getting this working, though I didn’t seem to need it in my switchtoxboxdrv.sh script.
Thanks to Yggdrasil and everyone who contributed to this thread. We may not get world peace, but at least we can have Mario with wireless controllers.
I’m having trouble getting this to work with Rpi3, wireless dongle and 2 xbox 360 controllers.
If I SSH in an manually run the scripts then it works. i.e run start.sh and it works in OSMC, then switch to RetroPi and xboxdrv stops, but doesn’t seem to restart with the retropie config. If I run the switchtoxpad.sh script it works for MegaDrive but not for Dreamcast (only 2 emulators I tried). Then when I exit back to OSMC again xboxdrv stops but doesn’t restart with OSMC config.
It seems the scripts are running when you start/leave retropie as it kills the last xboxdrv process, but can’t seem to start the new one unless I manually do it via SSH. Anyone know why this might be the case? permissions error?
Also, is there anything I need to do to get the controller to work with Dreamcast?
Got exactly the same situation, previously I used to have the very same setup running with Xbox 360 controller (non wireless) and it was working without any issues (besides the fact that from time to time when I reboot OSMC it does not respond, had to go into retropie to be able to use the pad, this was not an issue as I used the pad only for emulators, not XBMC itself). Today I received “Microsoft Xbox 360 Wireless Controller (PC)” , changed the config to reflect the new device name and apparently the behavior is exactly the same as in your case, if I run the script or the commands via SSH it works, also from time to time when I reboot kodi the controller is working there as well, yet, after launching retropie the very same LED stays lit (#1, top left), and cannot get controller to respond, after running switchtoxpad scripts it is working as expected. Interesting is that if I force the pad to work with the script and I go back to OSMC the pad is still working and LED #2 stays lit, then when I launch retropie again there are no changes to the LEDs (still #2 lit) and controller is not working.
switchtoxpad < works, (does not necessarily always work in OSMC after start, but after I launch retropie it switches led from 1 to 2 (also restarts xboxdrv) and I can use the pad both in games and in emulation station)
Controller: Microsoft Xbox 360 Wireless Controller
Vendor/Product: 045e:0291
USB Path: 001:004
Wireless Port: 0
Controller Type: Xbox360 (wireless)
– [ ERROR ] ------------------------------------------------------
Error couldn’t claim the USB interface: LIBUSB_ERROR_BUSY
Try to run ‘rmmod xpad’ and then xboxdrv again or start xboxdrv with the option --detach-kernel-driver.
I have blacklisted xpad as tried detach kernel option.
my understanding is that this is expected behavior since the pad is already connected and running (led lit). You still cannot control OSMC AFTER leaving retropie with start -> quit -> restart (first option from top, this is the option that should be ran)?
BTW, got it to work fully:
1)Once I reboot PI in OSMC its flashing all the time (no led lit, yet its working as expected)
2)When I go into retropi LED #2 stays lit and its working (no gamepads detected message is displayed, wait couple of seconds and press right trigger)
3) When I quit to OSMC wait couple of seconds and its working ( led #1 lit)
So after a waaay too long break I wanted to give this another go with a single wireless 360 controller. To prevent any old stuff getting in the way, I started with a fresh installation of the 2016.07-1 image (Raspi 2). Installed the updates, changed as little as possible (disabled CEC and HDMI audio due to CRT TV, switched to classic Kodi skin) and rebooted. SSH’d into the RPi and went through steps 1 to 4 word by word, command by command from Yggdrasil’s initial post, as I first wanted to get the wireless 360 controller working reliably in OSMC before even trying out retrosmc.
Result: It’s still a mess. And the infuriating thing is that I can’t tell what going wrong when. Sometimes the LED keeps flashing, sometimes it stays in position 1 as it is supposed to, sometimes no button or dpad works at all, sometimes they work if I press the dpad as soon as the home screen shows up after a reboot, sometimes I have to let it sit for a few seconds after reboot and then press the dpad. Same for reconnecting the controller once it goes into standby: half of the time it works flawlessly, I can take out the battery, put it back in and let it reconnect as often as I want; the other times it’s dead after disconnecting once.
I’ve played around with different values for sleep in /home/osmc/start.sh and /etc/rc.local.
I’ve blacklisted xpad in /etc/modprobe.d/raspi-blacklist.conf.
I’ve changed device-name = "Microsoft Xbox 360 Controller" to device-name = "Microsoft Xbox 360 Wireless Controller (PC)" in /home/osmc/xbmc.ini in step 2.
I’ve even tried different options from the xboxdrv manual like --type xbox360-wireless and --daemon.
No avail. And I hadn’t even touched steps 5 and 6!
sudo xboxdrv just says its old Error couldn't claim the USB interface: LIBUSB_ERROR_BUSY, no matter if the controller is working right now or not.
–
Is this due to a change in the kernel that came with the April update?
appearing ONLY in the working version (thirteenth to the last line) and NOT in the non-working version. While I do have basic knowledge of programming microcontrollers in ASM, this is way above my head, even reading the manpage of futex didn’t clear things up. I’d really like to be able to solve this on my own, but I lack the knowledge where to even start looking. Can anybody read what’s going on from the logs?
You shouldn’t have this problem with sudo though. What does ls -l /dev/bus/usb/001 show. You can also try chown -R osmc:osmc this path. If that works, then we need to set up a udev rule.
futex() is just a fast (userspace mutex) implementation. It locks until it gets access to a resource.
Edit: also check xpad stuff definitely isn’t loading with lsmod
osmc@RASPI2:~$ ls -l /dev/bus/usb/001
total 0
crw-rw-r-- 1 root root 189, 0 Aug 18 13:51 001
crw-rw-r-- 1 root root 189, 1 Aug 18 13:51 002
crw-rw-r-- 1 root root 189, 2 Aug 18 13:51 003
crw-rw-r-- 1 root root 189, 3 Aug 18 13:52 004
so I changed its ownership by sudo chown -R osmc:osmc /dev/bus/usb/001 as you suggested. xpad is definitely not loaded, it never shows up in lsmod, neither when working nor when not-working:
Here’s a log after the ownership change and when working. A little different, now the old
write(1, " Error couldn’t claim the USB in"…, 59 Error couldn’t claim the USB interface: LIBUSB_ERROR_BUSY
) = 59
write(1, “Try to run ‘rmmod xpad’ and then”…, 104Try to run ‘rmmod xpad’ and then xboxdrv again or start xboxdrv with the option --detach-kernel-driver.
) = 104
turns up again in the last lines. xpad isn’t loaded then, either, I checked again via lsmod.
Nope, no -D or --deamon option, neither in /home/osmc/start.sh, /home/osmc/xbmc.ini or /etc/rc.local. Just as in step 2 of Yggdrasil’s initial post. Also deleted the /home/osmc/buttonswap.ini because it has [xboxdrv-daemon] in it, although I had no call to it at this point, just to make sure. No change in behaviour.
I have a Wired Xbox 360 Controller. If you have a wired one and can replicate the problem with that I can try and look at this.
Hehe. I formed the company using a website that does it all for you and they set up a mail forwarding address for anonymity. I need to update that as we have an actual office now.
Hold off for now on spending money, because even if I get one, I may not necessarily be able to fix the problem.
That’s it. But you want to disable the xpad modules from being built, so you need to check for CONFIG_XPAD (may not be exact option name) in patches/rbp2-000-add-kernel-config.patch and remove it. Ideally you want to set to IS NOT SET or use make menuconfig to properly generate the kernel configuration.