Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Trying to get my xbox-controller-clone to work
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 354
Location: the Netherlands

PostPosted: Fri May 03, 2019 3:35 pm    Post subject: [Solved] Trying to get my xbox-controller-clone to work Reply with quote

Hi,

I bought a (cheap, i must say) controller so my son can play games on the 'living room' Kodi mediacenter.

It is a USB-connected XBOX-style controller . DMESG shows:
Manufacturer: CHIPUNION Co.,Ltd
However, it does not seem to work (I am also not sure what to expect. Running xfce +kodi, mouse+keyboard + mouse-like remote work fine).


DMESG shows:

Code:
[  537.121656] xpad 1-4:1.0: xpad_try_sending_next_out_packet - usb_submit_urb failed with result -19
[  537.616356] usb 1-4: new full-speed USB device number 22 using xhci_hcd
[  537.915347] usb 1-4: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.10
[  537.915351] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  537.915354] usb 1-4: Product: XBOX 360 For Windows
[  537.915356] usb 1-4: Manufacturer: CHIPUNION Co.,Ltd
[  537.926389] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:01.2/0000:15:00.0/usb1/1-4/1-4:1.0/input/input151
[  540.939292] usb 1-4: USB disconnect, device number 22


Also, regarding xpad:

Code:
# lsmod |grep xpad
xpad                   36864  0




Any tips on what to activate kernel wise?

Thanks!

Alex.


Last edited by lexflex on Tue May 07, 2019 5:41 am; edited 1 time in total
Back to top
View user's profile Send private message
argen
n00b
n00b


Joined: 26 Apr 2019
Posts: 24

PostPosted: Fri May 03, 2019 6:09 pm    Post subject: Reply with quote

It looks like it tried the xpad driver but failed. Have you tried Linux 5.0?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43208
Location: 56N 3W

PostPosted: Fri May 03, 2019 6:18 pm    Post subject: Reply with quote

lexflex,

Its one of these

dmesg correctly identified it but it says nothing about finding a driver.
It ident only requires that the kernel can read idVendor=045e, idProduct=028e from the device and look it up in a database. That does not require the driver loaded.

Your lsmod shows that its there .. so far so good.

I guess you are using Xorg?
Is xorg-drivers built with USE=joystick ?

-- edit --
Code:
[  537.926389] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:01.2/0000:15:00.0/usb1/1-4/1-4:1.0/input/input151

Eww .. input device 151. I guess it keeps trying and failing?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
argen
n00b
n00b


Joined: 26 Apr 2019
Posts: 24

PostPosted: Fri May 03, 2019 8:04 pm    Post subject: Reply with quote

Code:
[  537.121656] xpad 1-4:1.0: xpad_try_sending_next_out_packet - usb_submit_urb failed with result -19

This line makes me think it tried the driver.

I wonder if /dev/input/event151 exists and has output when the controller has a button pressed before the disconnect.

edit:
Quote:
It ident only requires that the kernel can read idVendor=045e, idProduct=028e from the device and look it up in a database. That does not require the driver loaded.

Oh that makes more sense, it just tries it if it's ID matches. I see.
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 354
Location: the Netherlands

PostPosted: Sat May 04, 2019 9:25 am    Post subject: Reply with quote

Hi Neddy and Argen,

Thanks for your replies!

NeddySeagoon wrote:
I guess you are using Xorg? Is xorg-drivers built with USE=joystick ?


Yes, using Xorg. At first , I did not build with Joystick.
Now I did rebuild Xorg using
Code:
' INPUT_DEVICES="joystick"

However, that did not make a difference.

Quote:
Have you tried Linux 5.0?

Yes,
Code:
 $ uname -r
5.0.9-gentoo


Quote:

Code:
[  537.926389] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:01.2/0000:15:00.0/usb1/1-4/1-4:1.0/input/input151

Eww .. input device 151. I guess it keeps trying and failing?

Indeed, that seems to be the case. A new entry appears every couple of seconds.

Any other hints/things to try?

Alex.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43208
Location: 56N 3W

PostPosted: Sat May 04, 2019 9:40 am    Post subject: Reply with quote

lexflex,

Put
Code:
lsusb -vvv
onto a pastebin please.
Make sure your X-Box controller is listed in the output.

The controller driver keeps being reset for reasons we don't yet know.

As its a module, please post
Code:
modinfo  xpad


Long shot ...
Code:
modprobe -r xpad
modprobe xpad

If it works, it can be automated.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 354
Location: the Netherlands

PostPosted: Sat May 04, 2019 10:43 am    Post subject: Reply with quote

NeddySeagoon wrote:

Put
Code:
lsusb -vvv
onto a pastebin please.
Make sure your X-Box controller is listed in the output.


http://dpaste.com/3HH7A42
The device is listed around line 700

Quote:

The controller driver keeps being reset for reasons we don't yet know.
As its a module, please post
Code:
modinfo  xpad


modinfo xpad:

http://dpaste.com/03PVW4D
Quote:

Long shot ...
Code:
modprobe -r xpad
modprobe xpad

If it works, it can be automated.

Yes, I tried that but that didnt make a difference....
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43208
Location: 56N 3W

PostPosted: Sat May 04, 2019 2:27 pm    Post subject: Reply with quote

lexflex,

There are no useful module parameters you can supply at module load time.
Condensing your lsusv -vvv we have
Code:

$ grep -e Bus -e MaxPower  lexflex_lsusb.txt
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    MaxPower                0mA
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    MaxPower                0mA
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    MaxPower                0mA
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    MaxPower                0mA
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    MaxPower                0mA
Bus 001 Device 004: ID 8087:0aa7 Intel Corp.
    MaxPower              100mA
Bus 001 Device 030: ID 045e:028e Microsoft Corp. Xbox360 Controller
      (Bus Powered)
    MaxPower        can't get debug descriptor: Resource temporarily unavailable
  (Bus Powered)
Bus 001 Device 002: ID 046d:c077 Logitech, Inc. M105 Optical Mouse
      (Bus Powered)
    MaxPower              100mA
  (Bus Powered)
Bus 001 Device 005: ID 073a:2330 Chaplet Systems, Inc.
      (Bus Powered)
    MaxPower              100can't get debug descriptor: Resource temporarily unavailable
  (Bus Powered)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    MaxPower                0mA


That tells us that you have six USB buses and all your USB devices are connected to Bus 001.
Bus 1 is a USB2 root hub, so it can supply at most 500mA for all connected devices.
It looks like you already use 300mA.

Move your USB devices around, so that they are not all on Bus 001, if you can.
lsusb will show where they are.
I suspect that you may have a bus power problem.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 354
Location: the Netherlands

PostPosted: Sat May 04, 2019 4:24 pm    Post subject: Reply with quote

Thanks, I didn't consider the power consumption up to now.

I unplugged all other devices ( which where an optical receiver for my kodi remote and a keyboard). It does not yet seem to provide any result...

http://dpaste.com/39FV9TR
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43208
Location: 56N 3W

PostPosted: Sat May 04, 2019 4:32 pm    Post subject: Reply with quote

lexflex,

Code:
    MaxPower        can't get debug descriptor: Resource temporarily unavailable
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
      500mA


Its a 500mA device, so it should be on a USB bun of its own.
A powered USB hub might work too.

Don't go there just yet, unless you happen to have a powered hub you can borrow.
USB hubs cause problems of there own.
Different USB ports do different things in the face of bus power overloads too, so it might not be a bus power issue.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 354
Location: the Netherlands

PostPosted: Sat May 04, 2019 4:43 pm    Post subject: Reply with quote

Yes, you are right! ( as often is the case ;-) )
I moved it arounf a bit more, and now I found a port that did give a 'sensable' output for the power:


Code:
MaxPower              500mA


See
http://dpaste.com/2YR0D07

But, still a retry on dmesg every 3 seconds or so....
Code:
165.184448] xpad 3-2:1.0: xpad_try_sending_next_out_packet - usb_submit_urb failed with result -19
[  165.618020] usb 3-2: new full-speed USB device number 47 using xhci_hcd
[  165.772046] usb 3-2: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.10
[  165.772048] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  165.772050] usb 3-2: Product: XBOX 360 For Windows
[  165.772051] usb 3-2: Manufacturer: CHIPUNION Co.,Ltd
[  165.791157] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:08.1/0000:38:00.3/usb3/3-2/3-2:1.0/input/input51
[  168.797765] usb 3-2: USB disconnect, device number 47
[  168.797879] xpad 3-2:1.0: xpad_try_sending_next_out_packet - usb_submit_urb failed with result -19
[  169.226318] usb 3-2: new full-speed USB device number 48 using xhci_hcd
[  169.380979] usb 3-2: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.10
[  169.380981] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  169.380983] usb 3-2: Product: XBOX 360 For Windows
[  169.380984] usb 3-2: Manufacturer: CHIPUNION Co.,Ltd
[  169.404801] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:08.1/0000:38:00.3/usb3/3-2/3-2:1.0/input/input52
[  172.410903] usb 3-2: USB disconnect, device number 48
[  172.411036] xpad 3-2:1.0: xpad_try_sending_next_out_packet - usb_submit_urb failed with result -19
[  172.842332] usb 3-2: new full-speed USB device number 49 using xhci_hcd
[  172.995908] usb 3-2: New USB device found, idVendor=045e, idProduct=028e, bcdDevice= 1.10
[  172.995911] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  172.995912] usb 3-2: Product: XBOX 360 For Windows
[  172.995914] usb 3-2: Manufacturer: CHIPUNION Co.,Ltd
[  173.017838] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:08.1/0000:38:00.3/usb3/3-2/3-2:1.0/input/input53




I probably should just spend some more money on a decent device ;-)
( however, I would like to do that once I am confident I can get it to work...)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43208
Location: 56N 3W

PostPosted: Sat May 04, 2019 5:51 pm    Post subject: Reply with quote

lexflex,

What kernel are you using. Google suggests that xpad is broken in 4.20.
Its worth trying a different kernel anyway.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 354
Location: the Netherlands

PostPosted: Sat May 04, 2019 6:44 pm    Post subject: Reply with quote

NeddySeagoon wrote:
What kernel are you using. Google suggests that xpad is broken in 4.20.
Its worth trying a different kernel anyway.


Code:
 ~ $ uname -r
5.0.9-gentoo


I can try to use some older kernel ( or the latest one).
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 354
Location: the Netherlands

PostPosted: Sat May 04, 2019 8:09 pm    Post subject: Reply with quote

Ok, I now seem to get some reaction.

I found this link:
https://forums.linuxmint.com/viewtopic.php?t=290677


Which brought me to the following:


Code:
 xboxdrv -v --no-uinput --detach-kernel-driver


Which actually provides a string of outputs which do correspond to buttons pressed etc on the controller:

Code:
X1:     0 Y1:     0  X2:     0 Y2:     0  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:     0 Y1:     0  X2:     0 Y2:     0  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:     0 Y1:     0  X2:     0 Y2:     0  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:     0 Y1:     0  X2:     0 Y2:     0  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:     0 Y1:     0  X2:     0 Y2:     0  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:  3584 Y1:     0  X2:     0 Y2:     0  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: 10496 Y1:     0  X2:     0 Y2:     0  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: 17152 Y1:     0  X2:     0 Y2:     0  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: 22784 Y1:  8448  X2:     0 Y2:     0  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: 29184 Y1: 22528  X2:     0 Y2:     0  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: 32767 Y1: 32767  X2:     0 Y2:     0  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: 32767 Y1: 32767  X2:     0 Y2:     0  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: 28928 Y1: 32767  X2:     0 Y2:     0  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: 22528 Y1: 32767  X2:     0 Y2:     0  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




However, I still cannot control the pointer or anything with the controller. So I am not completely sure if this is what I should expect, and how I should run this consistently.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43208
Location: 56N 3W

PostPosted: Sat May 04, 2019 8:21 pm    Post subject: Reply with quote

lexflex,

That looks promising. Going back to
Code:
modinfo xpad

Code:
parm:           dpad_to_buttons:Map D-PAD to buttons rather than axes for unknown pads (bool)
parm:           triggers_to_buttons:Map triggers to buttons rather than axes for unknown pads (bool)
parm:           sticks_to_null:Do not map sticks at all for unknown pads (bool)
parm:           auto_poweroff:Power off wireless controllers on suspend (bool)


You can pass these parameters to xpad at module load time to influence its behaviour.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 354
Location: the Netherlands

PostPosted: Sat May 04, 2019 8:28 pm    Post subject: Reply with quote

I also notice that I can see the device under /dev/imput:

Code:

cat /dev/input/js0



show output of the controller and reacts to controller activity.

The strange thing is, after I have done that cat-command, the kernel stops detaching every couple of seconds ( or at least, it stops retrying).
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 354
Location: the Netherlands

PostPosted: Sat May 04, 2019 8:45 pm    Post subject: Reply with quote

NeddySeagoon wrote:
[/code]
That looks promising. Going back to
Code:
modinfo xpad

Code:
parm:           dpad_to_buttons:Map D-PAD to buttons rather than axes for unknown pads (bool)
parm:           triggers_to_buttons:Map triggers to buttons rather than axes for unknown pads (bool)
parm:           sticks_to_null:Do not map sticks at all for unknown pads (bool)
parm:           auto_poweroff:Power off wireless controllers on suspend (bool)


You can pass these parameters to xpad at module load time to influence its behaviour.


I am a bit confused. Since I use the following I thought I am no longer using the xpad module, and that adding parameters thus would not do anything.:
Code:
xboxdrv -v --no-uinput --detach-kernel-driver


I am not sure which parameters to add to get it working. I tried mapping the controls In a game, but there they are not recognised ( i.e. nothing happens...)


Last edited by lexflex on Tue May 07, 2019 5:40 am; edited 1 time in total
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 354
Location: the Netherlands

PostPosted: Sun May 05, 2019 3:05 pm    Post subject: Reply with quote

Hi,

I tried playing around with the parameters. Mainly, I shut off the auto_poweroff and enabled the ' map dpad to buttons' .

Code:
Module: xpad
Parameter: auto_poweroff --> N
Parameter: dpad_to_buttons --> Y
Parameter: sticks_to_null --> N
Parameter: triggers_to_buttons --> N


However, the xpad module keeps dis/reconnecting every three seconds.
Just to be sore: If I would want to use xboxdrv module, would I need to blacklist the xpad one? Since it keeps trying. Or would they work in conjunction ?
Since I now see /dev/input/js0 , does that mean that the device is actually working ( at least at a kernel level) and that the real challenge now is to get xorg and/or any games to recognise it ?
Thanks!

Alex.
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 354
Location: the Netherlands

PostPosted: Mon May 06, 2019 7:16 pm    Post subject: Reply with quote

Ok, an update after some more trying. I now have succes so far using xboxdrv, and removing xpad.


- I blacklisted xpad in /etc/modprobe.d

After this, dmesg still shows the same behaviour with retrying the device every three seconds. So apparently it is trying even without xpad

- manually loaded uinput (joydev was already loaded for some reason) using
Code:
 modprobe uinput

- start xboxdrv using /etc/init.d/xboxdrv start


After starting xboxdrv, dmesg shows:
Code:
[18957.994478] input: Xbox Gamepad (userspace driver) as /devices/virtual/input/input13

Also, Kodi now recognises the device and asks me to set up the controller.

Next step is that I will try to get it to work with some of the other games, but so far this approach seems to work!

Thanks so far for all your hints! I will mark it as solved, since it works using xboxdrv .
Alex.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum