Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second Controller not working #148

Open
BoBBer446 opened this issue Mar 25, 2017 · 10 comments
Open

Second Controller not working #148

BoBBer446 opened this issue Mar 25, 2017 · 10 comments
Labels

Comments

@BoBBer446
Copy link

All Versions up to day by today.

Hi again,
i use one controller and it works fine with "XBOX Gamepad (Userspace driver)"

But now i want to add a second Gamepad i can only choose my Tastatur "Logitech K400 Plus" as source :/

I installed moonlight-embedded like the description and my rc.local looks now like this:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

xboxdrv --detach-kernel-driver --trigger-as-button --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 6 --deadzone 4000 --silent &

exit 0

Can anyone help me please?

@wackerl91
Copy link
Owner

Heya!
I'm glad you got your first controller working (and sorry that I didn't respond to your previous issue anymore, there's a lot on my plate currently).

xboxdrv requires a separate driver thread per controller, which is why you're seeing only one. Easiest way to get this working is using xboxdrv's daemon mode which allows for controller hotplugging (i.e. you can use any number of controllers by just switching them on).
E.g.

xboxdrv --daemon \
	--led 2 --deadzone 4000 --dpad-rotation 90 --axismap -DPAD_X=DPAD_X --trigger-as-button \
	--next-controller \
	--led 3 --deadzone 4000 --dpad-rotation 90 --axismap -DPAD_X=DPAD_X --trigger-as-button

for two controllers (add more lines starting with --next-controller for more controllers).
You can simply add this directly to your rc.local.

For daemon mode to work, you need to allow DBus access to the system bus:
create / edit (as root): sudo nano /etc/dbus-1/system.d/org.seul.Xboxdrv.conf and fill it with:

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus
Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
  <policy context="default">
    <allow own="org.seul.Xboxdrv"/>
    <allow send_type="method_call" log="true"/>   
  </policy>
</busconfig>

Afterwards, either reboot your Pi or shut down any running instance of xboxdrv using sudo pkill xboxdrv and launch it again using sudo /etc/rc.local

Hope this helps!

@BoBBer446
Copy link
Author

Thanks for your reaction!
You do not have to apologize! Thank you very much for your help. I tried it the same time:
sudo nano /etc/rc.local

Xboxdrv --daemon \
--default-kernel-driver -trigger-as-button -type xbox360-wireless -wid 0 -buttonmap du = dl, dl = du, dd = dr, dr = dd, x = y, y = x --led 2 --deadzone 4000 --silent \
--next-controller \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 1 --buttonmap du = dl, dl = du, dd = dr, dr = dd, x = y, y = x --led 3 --deadzone 4000 --silent \
--next-controller \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 2 --buttonmap du = dl, dl = du, dd = dr, dr = dd, x = y, y = x --led 4 --deadzone 4000 --silent \
--next-controller \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 3 --buttonmap du = dl, dl = du, dd = dr, dr = dd, x = y, y = x --led 5 --deadzone 4000 --silent

sudo nano /etc/dbus-1/system.d/org.seul.Xboxdrv.conf

<! DOCTYPE busconfig PUBLIC "- // freedesktop // DTD D-BUS bus
Configuration 1.0 // EN "
 "Http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<Busconfig>
  <Policy context = "default">
    <Allow own = "org.seul.Xboxdrv" />
    <Allow send_type = "method_call" log = "true" />
  </ Policy>
</ Busconfig>

Sudo reboot

Now I can configure all. Same Mappingset. However, I can not now control Kodi. Did I forgot something?

@wackerl91
Copy link
Owner

wackerl91 commented Mar 28, 2017

Have you tried reconfiguring your controller with Kodi? I remember I had to do that a couple of times, but don't know what I changed that I had to do so :/

Btw, there's a typo in the first and second line of your xboxdrv command, xboxdrv should be written all lowercase and your second line misses a dash for trigger-as-button, type, wid and buttonmap (you only got one, should be two (--trigger-as-button, ...) :) )

@BoBBer446
Copy link
Author

BoBBer446 commented Mar 28, 2017

I am very sorry, I try to find a solution myself. But I'm stuck.
I have reinstalled everything.
Noobs OSMC
Important:
The latest Kodi version - the xpad also - accepts the Xbox 360 Wirless Recieiver!
This is under input devices also so timed.

However, the keys are wrong. As with the xboxdrv. Only one can configure with xboxdrv more.
But I follow the tutorial, uninstall xpad etc.

The file called/etc/dbus-1/system.d/org.seul.Xboxdrv.confIs as you said

The rc.local looks now:

osmc@osmc:~$ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

xboxdrv --daemon \
--default-kernel-driver -trigger-as-button --type xbox360-wireless --wid 0 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 2 --deadzone 4000 --silent \
--next-controller \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 1 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 3 --deadzone 4000 --silent \
--next-controller \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 2 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 4 --deadzone 4000 --silent \
--next-controller \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 3 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 5 --deadzone 4000 --silent
exit 0
osmc@osmc:~$

Now the user space drive is no longer displayed and I can not select it!

Now i Type in terminal:

osmc@osmc:~$ sudo xboxdrv
xboxdrv 0.8.5 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <[email protected]>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details.

Controller:        Microsoft Xbox 360 Wireless Controller (PC)
Vendor/Product:    045e:0719
USB Path:          001:004
Wireless Port:     0
Controller Type:   Xbox360 (wireless)

Your Xbox/Xbox360 controller should now be available as:
  /dev/input/js0
  /dev/input/event2

Press Ctrl-c to quit, use '--silent' to suppress the event output
X1:  2201 Y1:   980  X2: -2032 Y2:  1279  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1:  2201 Y1: -1380  X2: -2032 Y2:  1279  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0

LED Flashlight 1 is on.
It works.

But im not sure why the deamon is not working :/

if i set the rc.local :

osmc@osmc:~$ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

xboxdrv --detach-kernel-driver --trigger-as-button --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 2 --wid 0 --deadzone 4000 --silent &
sleep 1
xboxdrv --detach-kernel-driver --trigger-as-button --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 3 --wid 1 --deadzone 4000 --silent &
sleep 1

exit 0
osmc@osmc:~$

Controller 1 : LED 1 is flashing
Controller 2: LED 2 is flashing

I can set up both controller but only one controller (Controller 2) is for using on streaming.
The first controller dosent work. If i try only one line in rc.local the first controller is working.

I think there is an issue in my deamon config because the driver is working but not the deamon

If you do not find a solution: I try it myself. As soon as I have a solution I will give you modest.
I like moonlight and your Luna Script really great! It feels like an XBOX ONE S or PS4 Pro at home

@BoBBer446
Copy link
Author

BoBBer446 commented Mar 28, 2017

Ah, all back!

There is an issue in the code! Not default-kernel!
This is the right code, now i see all 4 Controllers in Luna and Kodi:

xboxdrv --daemon \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 0 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 2 --deadzone 4000 --silent \
--next-controller \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 1 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 3 --deadzone 4000 --silent \
--next-controller \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 2 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 4 --deadzone 4000 --silent \
--next-controller \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 3 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 5 --deadzone 4000 --silent

If the controllers in poer off and i wake him up all LEDs flashing, but Controller 1 is working also in kodi!
Now i wake the second controller and the LED 2 is Flashing nut not working in kodi.

If i Searching for connection on Controller 1 he loose function to control Kodi
Also it is not working in Luna after start Steam Big Picture mode.

I have to reboot while controller searching for signal (all leds flashing)

After reboot
Controller 1 - LED 1 is running
Controller 2 - LED 2 is running
But it is not possible to control Kodi.

Now Run Luna:
Settings for Controller 1 and 2 are saved

Now run Steam over Luna:
Controller 1 and 2 not working.

Try to restart controller. Power off and on. Then special Button to wake up. The second controller are off.

Only one controller is looking for signal:
not working

Okay, now i try to run:

xboxdrv --daemon \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 0 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 2 --deadzone 4000 --silent \
--next-controller \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 1 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 3 --deadzone 4000 --silent \
--next-controller \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 2 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 4 --deadzone 4000 --silent \
--next-controller \
--detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 3 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 5 --deadzone 4000 --silent

in terminal:

osmc@osmc:~$ xboxdrv --daemon \
> --detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 0 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 2 --deadzone 4000 --silent \
> --next-controller \
> --detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 1 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 3 --deadzone 4000 --silent \
> --next-controller \
> --detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 2 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 4 --deadzone 4000 --silent \
> --next-controller \
> --detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 3 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 5 --deadzone 4000 --silent
xboxdrv 0.8.5 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <[email protected]>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details.

[ERROR] XboxdrvDaemon::process_match(): failed to launch ControllerThread: USBController::USBController(): libusb_open() failed: LIBUSB_ERROR_ACCESS
[ERROR] XboxdrvDaemon::run(): fatal exception: failed to open connection to bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
osmc@osmc:~$

no i try to run as sudo

osmc@osmc:~$ sudo xboxdrv --daemon --detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 0 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 2 --deadzone 4000 --silent --next-controller --detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 1 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 3 --deadzone 4000 --silent --next-controller --detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 2 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 4 --deadzone 4000 --silent --next-controller --detach-kernel-driver --trigger-as-button --type xbox360-wireless --wid 3 --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --led 5 --deadzone 4000 --silent
xboxdrv 0.8.5 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <[email protected]>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details.

[ERROR] XboxdrvDaemon::process_match(): failed to launch ControllerThread:  Error couldn't claim the USB interface: LIBUSB_ERROR_NOT_FOUND
Try to run 'rmmod xpad' and then xboxdrv again or start xboxdrv with the option --detach-kernel-driver.
[ERROR] XboxdrvDaemon::run(): fatal exception: DBusSubsystem::request_name(): failed to become primary owner of dbus name
osmc@osmc:~$

now i grep dbus:

osmc@osmc:~$ ps wwaux | grep dbus
message+   272  0.1  0.3   4908  2660 ?        Ss   18:40   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
osmc      1500  0.0  0.0   2156   548 pts/0    S+   18:49   0:00 grep dbus
osmc@osmc:~$

maybe it is better to use the lastes version of xboxdrv:

osmc@osmc:~$ xboxdrv -V
xboxdrv 0.8.5 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <[email protected]>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain
conditions; see the file COPYING for details.
osmc@osmc:~$

but i dont know ho i can compile it
Here i found a solution but the installation on osmc is not the same as on ubuntu or debian :/
http://www.htpc-forum.de/forum/index.php?showtopic=10404&view=findpost&p=73663

Edit:
Here are some lines from log file.
Receiver found on startup:

Mar 28 19:04:16 osmc kernel: usb 1-1.3: new full-speed USB device number 4 using dwc_otg
Mar 28 19:04:16 osmc kernel: usb 1-1.3: New USB device found, idVendor=045e, idProduct=0719
Mar 28 19:04:16 osmc kernel: usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Mar 28 19:04:16 osmc kernel: usb 1-1.3: Product: Xbox 360 Wireless Receiver for Windows
Mar 28 19:04:16 osmc kernel: usb 1-1.3: Manufacturer: <C2><A9>Microsoft
Mar 28 19:04:16 osmc kernel: usb 1-1.3: SerialNumber: E19BA350
Mar 28 19:04:16 osmc kernel: usb 1-1.5: new full-speed USB device number 5 using dwc_otg
Mar 28 19:04:16 osmc kernel: usb 1-1.5: New USB device found, idVendor=046d, idProduct=c52b
Mar 28 19:04:16 osmc kernel: usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Mar 28 19:04:16 osmc kernel: usb 1-1.5: Product: USB Receiver
Mar 28 19:04:16 osmc kernel: usb 1-1.5: Manufacturer: Logitech

DBUS is starting

Mar 28 19:04:17 osmc systemd[1]: Listening on Avahi mDNS/DNS-SD Stack Activation Socket.
Mar 28 19:04:17 osmc systemd[1]: Starting D-Bus System Message Bus Socket.
Mar 28 19:04:17 osmc systemd[1]: Listening on D-Bus System Message Bus Socket.

now he loads the two Controller (now i have only controller 1 and 2 in rc.local)

Mar 28 19:04:18 osmc rc.local[311]: xboxdrv 0.8.5 - http://pingus.seul.org/~grumbel/xboxdrv/
Mar 28 19:04:18 osmc rc.local[311]: Copyright <C2><A9> 2008-2011 Ingo Ruhnke <[email protected]>
Mar 28 19:04:18 osmc kernel: input: Xbox Gamepad (userspace driver) as /devices/virtual/input/input3
Mar 28 19:04:18 osmc kernel: input: Xbox Gamepad (userspace driver) #2 as /devices/virtual/input/input4
Mar 28 19:04:18 osmc kernel: brcmfmac: brcmf_add_if: ERROR: netdev:wlan0 already exists
Mar 28 19:04:18 osmc kernel: brcmfmac: brcmf_add_if: ignore IF event

@wackerl91
Copy link
Owner

This error:
[ERROR] XboxdrvDaemon::process_match(): failed to launch ControllerThread: Error couldn't claim the USB interface: LIBUSB_ERROR_NOT_FOUND
happens if you already got a xboxdrv instance running when trying to start another.
Remember that your rc.local is executed when your system starts, if you want to play around with xboxdrv from terminal you'll need to shut this instance down first: sudo pkill xboxdrv
You can also reload your rc.local by shutting down xboxdrv and then calling it directly, i.e. sudo /etc/rc.local. Saves you all the time needed to reboot the entire system ;)

If the controllers in poer off and i wake him up all LEDs flashing, but Controller 1 is working also in kodi!
Now i wake the second controller and the LED 2 is Flashing nut not working in kodi.

To be honest, I've never tried if any but the first controller is able to control Kodi. I do know that both controllers work in games on my end (using the config I posted earlier), though only the first one is working in Steam Big Picture Mode IIRC. My xboxdrv version is the same as yours.

@BoBBer446
Copy link
Author

Okay, i try thousend of things but it wont work perfect / right
I use you Configuaration from Your Post 5 Days ago:
#148 (comment)

The first Controller is working very well. Only issue is that the LEDs all are flashing.
I can controller Kodi and play games. Thats awesome !

But i would be great if i can play with my lady together games like Sacred III.

The Second Controller is not working. The LED 2 is constant on but i cant use the controller in Kodi or as example in steams Big Picture.

The Controller 2 has cinfigure in luna under "Controlers" and have the same mapping file like the first controler.

Is this an issue for moonlight or is it possible that you can helping me?
If i type
moonlight map test.map

and try config the second it dosent work. Only first Controller is working too.

if i try this:
sudo pkill xboxdrv

and then in terminal

xboxdrv --daemon \
	--led 2 --wid 0 --deadzone 4000 --type xbox360-wireless --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --trigger-as-button \
	--next-controller \
	--led 3 --wid 1 --deadzone 4000 --type xbox360-wireless --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --trigger-as-button

i get the same issue above:

osmc@osmc:~$ sudo pkill xboxdrv
osmc@osmc:~$ xboxdrv --daemon \
> --led 2 --wid 0 --deadzone 4000 --type xbox360-wireless --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --trigger-as-button \
> --next-controller \
> --led 3 --wid 1 --deadzone 4000 --type xbox360-wireless --buttonmap du=dl,dl=du,dd=dr,dr=dd,x=y,y=x --trigger-as-button
xboxdrv 0.8.5 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <[email protected]>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details.

[ERROR] XboxdrvDaemon::process_match(): failed to launch ControllerThread: USBController::USBController(): libusb_open() failed: LIBUSB_ERROR_ACCESS
[ERROR] XboxdrvDaemon::run(): fatal exception: failed to open connection to bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
osmc@osmc:~$

mybe it helps.

@wackerl91
Copy link
Owner

Not good news, but still:
After a couple of restarts I was able to reproduce all the issues mentioned in your last comment (xboxdrv not starting even after killing the process, second controller not working even though the second segment of the ring is lit up, first controller flashing constantly). I did not change my config and this has worked in the past (played some Divinity: OS in coop).
Not sure what exactly is causing this but once I figure it out I'll let you know!

I deeply apologize that this is causing you so much trouble, I completely understand your wish to be able to play with your lady or friends (gaming is just way more fun if you're able to share the experience, right?).

@BoBBer446
Copy link
Author

BoBBer446 commented Apr 29, 2017

I think i found it....
https://discourse.osmc.tv/t/howto-moonlight-embedded-former-limelight-using-luna-launcher/5848/369

rc.local starts first, then Kodi. Kodi grabs the controller at last and so i get issues.

A working solution is:
just kill xboxdrv (sudo pkill xboxdrv)
execute my rc,local (sudo /etc/rc.local).

Now Controller works fine.
I think it where nice if i can run the script AFTER Kodi is starded...

Okay, only one Controller is working. Everytime i try to use the second one i get this:
osmc@osmc:~$ [ERROR] USBController::on_read_data(): USB read failure: 32: LIBUSB_TRANSFER_ERROR

I think i need a more powerful Adapter

@BoBBer446
Copy link
Author

one little Question:
Wich Kodi Version you are using?

I use OSMC ..i would like to try an other Distribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants