# [Solved] Trying to get my xbox-controller-clone to work

## lexflex

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:

```
[  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:

```
# 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

----------

## argen

It looks like it tried the xpad driver but failed. Have you tried Linux 5.0?

----------

## NeddySeagoon

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 --

```
[  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?

----------

## argen

```
[  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.

----------

## lexflex

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

```
' INPUT_DEVICES="joystick"

```

However, that did not make a difference.

 *Quote:*   

> Have you tried Linux 5.0?

 

Yes,

```
 $ uname -r

5.0.9-gentoo
```

 *Quote:*   

> 
> 
> ```
> [  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
> ```
> ...

 

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

Any other hints/things to try?

Alex.

----------

## NeddySeagoon

lexflex,

Put 

```
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 

```
modinfo  xpad
```

Long shot ...

```
modprobe -r xpad

modprobe xpad
```

If it works, it can be automated.

----------

## lexflex

 *NeddySeagoon wrote:*   

> 
> 
> Put 
> 
> ```
> ...

 

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 
> ...

 

modinfo xpad:

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

> 
> 
> Long shot ...
> 
> ```
> ...

 

Yes, I tried that but that didnt make a difference....

----------

## NeddySeagoon

lexflex,

There are no useful module parameters you can supply at module load time.

Condensing your lsusv -vvv we have

```

$ 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.

----------

## lexflex

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

----------

## NeddySeagoon

lexflex,

```
    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.

----------

## lexflex

Yes, you are right! ( as often is the case  :Wink:   )

 I moved it arounf a bit more, and now I found a port that did give a 'sensable' output for the power:

```
MaxPower              500mA

```

See

http://dpaste.com/2YR0D07

But, still a retry on dmesg every 3 seconds or so....

```
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  :Wink: 

( however, I would like to do that once I am confident I can get it to work...)

----------

## NeddySeagoon

lexflex,

What kernel are you using. Google suggests that xpad is broken in 4.20.

Its worth trying a different kernel anyway.

----------

## lexflex

 *NeddySeagoon wrote:*   

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

 

```
 ~ $ uname -r

5.0.9-gentoo

```

I can try to use some older kernel ( or the latest one).

----------

## lexflex

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:

```
 xboxdrv -v --no-uinput --detach-kernel-driver
```

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

```
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.

----------

## NeddySeagoon

lexflex,

That looks promising.  Going back to 

```
modinfo xpad
```

```
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.

----------

## lexflex

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

```

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).

----------

## lexflex

 *NeddySeagoon wrote:*   

> [/code]
> 
> That looks promising.  Going back to 
> 
> ```
> ...

 

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.: 

```
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

----------

## lexflex

Hi,

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

```
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.

----------

## lexflex

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

```
 modprobe uinput

```

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

After starting xboxdrv,  dmesg shows:

```
[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.

----------

## Nemirtingas

 *lexflex wrote:*   

> 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 
> ...

 

Hi,

If you want to fix vibration on this controller, compile xpad module with Oblomov branch: https://github.com/Oblomov/xpad/tree/init-360-control and comment control message 2 and control message 3 before recompiling the module.

It will make the controller stop disconnect and vibration work.

----------

