paroj / xpad

Linux Kernel Driver for the Xbox/ Xbox 360/ Xbox One Controllers
838 stars 183 forks source link

XBox One S clone controller not initialized #161

Open zskamljic opened 3 years ago

zskamljic commented 3 years ago

I have a wired ZEROPLUS controller that supposedly supports the original xbox one s protocol, however it looks like it requires an initalization sequence in order to work, as the lights keep blinking after being attached.

lsusb lists it as: Bus 003 Device 004: ID 045e:02ea Microsoft Corp. Xbox One S Controller which appears to be supported in the source code. If I attach it to a windows machine the blinking stops, as the sequence appears to be sent, however on linux the lights continue to blink. sys/class/leds/xpadN does not seem to be created, while /dev/input/jsN are created. jstest detects the controller, however no keys are detected.

I have also tried using xboxdrv, however 045e:02ea does not seem officially supported, adding those manually in that source fails as interface class, subclass and protocol dont match, they're 255, 255, 208 in the controller I have, expected values being 88, 66, 0.

It appears to me that the initialization sequence is not being sent, and as a result the controller is not initialized.

I've attached the capture from USBPcap, the whole communication from attaching the USB device. There has also been a "fix" specified on the arch wiki to resolve this issue: https://wiki.archlinux.org/index.php/Gamepad#Using_generic/clone_controllers_2, however it seems to be specific to that kind of controllers, as changing the vendor and device ids allows me to write the data to the controller and I get a reply from it, but it remains uninitalized. output.pcap.txt

zskamljic commented 3 years ago

I have enabled debug logging, and by the looks of it fails with enoent, printed 5 times: [ 6037.026458] xpad 3-1:1.0: xpad_irq_in - urb shutting down with status: -2

zskamljic commented 3 years ago

I've added some extra logs, and additionally enabled DEBUG and DEBUG_VERBOSE, this is what I see when plugging the controller in:

[17291.567396] xpad 3-1:1.0: xpad_irq_in - urb shutting down with status: -2
[17291.750757] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17291.750758] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17291.777424] xpad 3-1:1.0: xpad_irq_in - urb shutting down with status: -2
[17291.816687] xpad 3-1:1.0: xpad_irq_in - urb shutting down with status: -2
[17291.979617] xpad 3-1:1.0: xpad_irq_in - urb shutting down with status: -2
[17292.034554] xpad 3-1:1.0: xpad_irq_in - urb shutting down with status: -2
[17292.066756] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17292.066758] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17292.502759] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17292.502762] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17292.938757] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17292.938767] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17293.378759] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17293.378767] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17293.818759] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17293.818767] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17294.258759] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17294.258765] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17294.694761] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17294.694768] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17295.134759] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17295.134767] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17295.574759] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17295.574767] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17296.010761] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17296.010769] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17296.450760] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17296.450762] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17296.890759] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17296.890768] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17297.326761] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17297.326769] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17297.766760] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17297.766768] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17298.206760] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17298.206768] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17298.642761] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17298.642763] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17299.082761] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17299.082763] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17299.518761] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17299.518763] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[17299.958761] xpad-dbg: 00000000: 02 20 01 1c 7e ed 81 64 e0 24 00 00 5e 04 ea 02 03 00 01 00 c5 04 00 00 04 05 01 00 01 00 01 00
[17299.958763] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// ... same lines repeated over and over

By the looks of it, the hex data logged is only sent from the controller once, to which the host replies with URB_INTERRUPT in, with no extra data, then follows up with 0x04, 0x20, 0x01, 0x00 packet. If I change the xboxone_fw2015_init packet to 0x04, 0x20, 0x00, 0x01, 0x00 instead I get:

[18552.035042] xpad-dbg: 00000000: 04 f0 00 3a da 01 10 00 01 00 00 00 00 00 00 00 00 00 00 00 da 00 9b 00 16 00 3b 00 3c 00 45 00
[18552.035049] xpad-dbg: 00000020: 4d 00 6a 00 00 00 00 00 00 00 00 00 09 01 00 00 00 01 00 01 00 01 00 02 00 01 00 03 00 02 00 00
[18552.039043] xpad-dbg: 00000000: 04 a0 00 3b 3a 00 02 00 01 00 02 00 02 00 02 00 03 00 03 00 01 00 00 08 01 02 03 04 06 07 0c 1e
[18552.039047] xpad-dbg: 00000020: 07 01 04 05 06 0a 0c 1e 01 1a 00 57 69 6e 64 6f 77 73 2e 58 62 6f 78 2e 49 6e 70 75 74 2e 47 61
[18552.043041] xpad-dbg: 00000000: 04 a0 00 3b 75 6d 65 70 61 64 03 56 ff 76 97 fd 9b 81 45 ad 45 b6 45 bb a5 26 d6 2c 40 2e 08 df
[18552.043045] xpad-dbg: 00000020: 07 e1 45 a5 ab a3 12 7a f1 97 b5 e7 1f f3 b8 86 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.047033] xpad-dbg: 00000000: 04 a0 00 2a b0 01 00 01 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 09 3c 00 01 00
[18552.047039] xpad-dbg: 00000020: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.051006] xpad-dbg: 00000000: 04 a0 00 00 da 01 00 01 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 09 3c 00 01 00
[18552.051011] xpad-dbg: 00000020: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.051163] xpad 3-1:1.0: xpad_irq_in - urb shutting down with status: -2
[18552.235044] xpad-dbg: 00000000: 04 f0 03 3a da 01 10 00 01 00 00 00 00 00 00 00 00 00 00 00 da 00 9b 00 16 00 3b 00 3c 00 45 00
[18552.235051] xpad-dbg: 00000020: 4d 00 6a 00 00 00 00 00 00 00 00 00 09 01 00 00 00 01 00 01 00 01 00 02 00 01 00 03 00 02 00 00
[18552.239041] xpad-dbg: 00000000: 04 a0 03 3b 3a 00 02 00 01 00 02 00 02 00 02 00 03 00 03 00 01 00 00 08 01 02 03 04 06 07 0c 1e
[18552.239046] xpad-dbg: 00000020: 07 01 04 05 06 0a 0c 1e 01 1a 00 57 69 6e 64 6f 77 73 2e 58 62 6f 78 2e 49 6e 70 75 74 2e 47 61
[18552.243041] xpad-dbg: 00000000: 04 a0 03 3b 75 6d 65 70 61 64 03 56 ff 76 97 fd 9b 81 45 ad 45 b6 45 bb a5 26 d6 2c 40 2e 08 df
[18552.243042] xpad-dbg: 00000020: 07 e1 45 a5 ab a3 12 7a f1 97 b5 e7 1f f3 b8 86 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.247034] xpad 3-1:1.0: xpad_irq_in - urb shutting down with status: -2
[18552.275008] xpad-dbg: 00000000: 04 a0 03 00 da 01 00 01 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 09 3c 00 01 00
[18552.275016] xpad-dbg: 00000020: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.279043] xpad-dbg: 00000000: 04 f0 06 3a da 01 10 00 01 00 00 00 00 00 00 00 00 00 00 00 da 00 9b 00 16 00 3b 00 3c 00 45 00
[18552.279044] xpad-dbg: 00000020: 4d 00 6a 00 00 00 00 00 00 00 00 00 09 01 00 00 00 01 00 01 00 01 00 02 00 01 00 03 00 02 00 00
[18552.283041] xpad-dbg: 00000000: 04 a0 06 3b 3a 00 02 00 01 00 02 00 02 00 02 00 03 00 03 00 01 00 00 08 01 02 03 04 06 07 0c 1e
[18552.283042] xpad-dbg: 00000020: 07 01 04 05 06 0a 0c 1e 01 1a 00 57 69 6e 64 6f 77 73 2e 58 62 6f 78 2e 49 6e 70 75 74 2e 47 61
[18552.287043] xpad-dbg: 00000000: 04 a0 06 3b 75 6d 65 70 61 64 03 56 ff 76 97 fd 9b 81 45 ad 45 b6 45 bb a5 26 d6 2c 40 2e 08 df
[18552.287044] xpad-dbg: 00000020: 07 e1 45 a5 ab a3 12 7a f1 97 b5 e7 1f f3 b8 86 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.291030] xpad-dbg: 00000000: 04 a0 06 2a b0 01 00 01 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 09 3c 00 01 00
[18552.291031] xpad-dbg: 00000020: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.295002] xpad-dbg: 00000000: 04 a0 06 00 da 01 00 01 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 09 3c 00 01 00
[18552.295003] xpad-dbg: 00000020: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.296893] xpad 3-1:1.0: xpad_irq_in - urb shutting down with status: -2
[18552.379044] xpad-dbg: 00000000: 04 f0 09 3a da 01 10 00 01 00 00 00 00 00 00 00 00 00 00 00 da 00 9b 00 16 00 3b 00 3c 00 45 00
[18552.379046] xpad-dbg: 00000020: 4d 00 6a 00 00 00 00 00 00 00 00 00 09 01 00 00 00 01 00 01 00 01 00 02 00 01 00 03 00 02 00 00
[18552.383044] xpad-dbg: 00000000: 04 a0 09 3b 3a 00 02 00 01 00 02 00 02 00 02 00 03 00 03 00 01 00 00 08 01 02 03 04 06 07 0c 1e
[18552.383045] xpad-dbg: 00000020: 07 01 04 05 06 0a 0c 1e 01 1a 00 57 69 6e 64 6f 77 73 2e 58 62 6f 78 2e 49 6e 70 75 74 2e 47 61
[18552.387042] xpad 3-1:1.0: xpad_irq_in - urb shutting down with status: -2
[18552.419034] xpad-dbg: 00000000: 04 a0 09 2a b0 01 00 01 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 09 3c 00 01 00
[18552.419037] xpad-dbg: 00000020: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.423002] xpad-dbg: 00000000: 04 a0 09 00 da 01 00 01 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 09 3c 00 01 00
[18552.423003] xpad-dbg: 00000020: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.427001] xpad-dbg: 00000000: 04 a0 0c 00 da 01 00 01 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 09 3c 00 01 00
[18552.427002] xpad-dbg: 00000020: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.483558] xpad 3-1:1.0: xpad_irq_in - urb shutting down with status: -2
[18552.523044] xpad-dbg: 00000000: 04 f0 0f 3a da 01 10 00 01 00 00 00 00 00 00 00 00 00 00 00 da 00 9b 00 16 00 3b 00 3c 00 45 00
[18552.523046] xpad-dbg: 00000020: 4d 00 6a 00 00 00 00 00 00 00 00 00 09 01 00 00 00 01 00 01 00 01 00 02 00 01 00 03 00 02 00 00
[18552.527041] xpad-dbg: 00000000: 04 a0 0f 3b 3a 00 02 00 01 00 02 00 02 00 02 00 03 00 03 00 01 00 00 08 01 02 03 04 06 07 0c 1e
[18552.527046] xpad-dbg: 00000020: 07 01 04 05 06 0a 0c 1e 01 1a 00 57 69 6e 64 6f 77 73 2e 58 62 6f 78 2e 49 6e 70 75 74 2e 47 61
[18552.531045] xpad-dbg: 00000000: 04 a0 0f 3b 75 6d 65 70 61 64 03 56 ff 76 97 fd 9b 81 45 ad 45 b6 45 bb a5 26 d6 2c 40 2e 08 df
[18552.531046] xpad-dbg: 00000020: 07 e1 45 a5 ab a3 12 7a f1 97 b5 e7 1f f3 b8 86 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.535030] xpad-dbg: 00000000: 04 a0 0f 2a b0 01 00 01 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 09 3c 00 01 00
[18552.535031] xpad-dbg: 00000020: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.539003] xpad-dbg: 00000000: 04 a0 0f 00 da 01 00 01 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 09 3c 00 01 00
[18552.539004] xpad-dbg: 00000020: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.540240] xpad 3-1:1.0: xpad_irq_in - urb shutting down with status: -2
[18552.579044] xpad-dbg: 00000000: 04 f0 12 3a da 01 10 00 01 00 00 00 00 00 00 00 00 00 00 00 da 00 9b 00 16 00 3b 00 3c 00 45 00
[18552.579053] xpad-dbg: 00000020: 4d 00 6a 00 00 00 00 00 00 00 00 00 09 01 00 00 00 01 00 01 00 01 00 02 00 01 00 03 00 02 00 00
[18552.583044] xpad-dbg: 00000000: 04 a0 12 3b 3a 00 02 00 01 00 02 00 02 00 02 00 03 00 03 00 01 00 00 08 01 02 03 04 06 07 0c 1e
[18552.583046] xpad-dbg: 00000020: 07 01 04 05 06 0a 0c 1e 01 1a 00 57 69 6e 64 6f 77 73 2e 58 62 6f 78 2e 49 6e 70 75 74 2e 47 61
[18552.587042] xpad-dbg: 00000000: 04 a0 12 3b 75 6d 65 70 61 64 03 56 ff 76 97 fd 9b 81 45 ad 45 b6 45 bb a5 26 d6 2c 40 2e 08 df
[18552.587043] xpad-dbg: 00000020: 07 e1 45 a5 ab a3 12 7a f1 97 b5 e7 1f f3 b8 86 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.591030] xpad-dbg: 00000000: 04 a0 12 2a b0 01 00 01 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 09 3c 00 01 00
[18552.591031] xpad-dbg: 00000020: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e
[18552.595003] xpad-dbg: 00000000: 04 a0 12 00 da 01 00 01 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 00 09 3c 00 01 00
[18552.595005] xpad-dbg: 00000020: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 e9 40 a9 f8 2f 21 26 3a cf b7 02 17 00 20 0e

which appears to match the next message that is sent from the controller to host on windows.

zskamljic commented 3 years ago

I have discovered that my controller requires 2 different packages to be sent, first, as mentioned above:

0x04, 0x20, 0x01, 0x00

Then the following:

0x01, 0x20, 0x01, 0x09, 0x00, 0x1e, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00

Attaching a 2nd controller after that however does not work, only the first one remains active, the 2nd one appears to be stuck in the initializing state. It appears to work fine if I pick a different USB port (one on USB 3.0 and another on 2.0)

joaogfs commented 3 years ago

@zskamljic, I have the exact same controller and I'm having the exact same problem. How can I force these packets to be sent to the controller? From what I understand you found a way to make it work, is this correct? Sorry for my ignorance, I just want to get this to work. Thank you!

zskamljic commented 3 years ago

@JoaoGFS sorry for the late reply, I've attached the patch file I've used. You can follow the "installing" section on the Readme, just make sure to apply it before running dkms install.

xpad.zip

davidebeatrici commented 3 years ago

I have the exact same controller, bought at https://www.ebay.com/itm/254707179803.

@zskamljic Thank you very much for the fix!

Here's the trimmed patch:

diff --git a/xpad.c b/xpad.c
index cc22bf3..551dbe1 100644
--- a/xpad.c
+++ b/xpad.c
@@ -532,6 +532,15 @@ static const u8 xboxone_rumbleend_init[] = {
        0x00, 0x00, 0x00, 0x00, 0x00
 };

+static const u8 xboxone_zeroplus_init1[] = {
+       0x04, 0x20, 0x01, 0x00
+};
+
+static const u8 xboxone_zeroplus_init2[] = {
+       0x01, 0x20, 0x01, 0x09, 0x00, 0x1e, 0x20, 0x10,
+       0x00, 0x00, 0x00, 0x00, 0x00
+};
+
 /*
  * This specifies the selection of init packets that a gamepad
  * will be sent on init *and* the order in which they will be
@@ -543,6 +552,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = {
        XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init),
        XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init),
        XBOXONE_INIT_PKT(0x045e, 0x02ea, xboxone_s_init),
+       XBOXONE_INIT_PKT(0x045e, 0x02ea, xboxone_zeroplus_init1),
+       XBOXONE_INIT_PKT(0x045e, 0x02ea, xboxone_zeroplus_init2),
        XBOXONE_INIT_PKT(0x045e, 0x0b00, xboxone_s_init),
        XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init1),
        XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init2),
@@ -1835,7 +1846,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
                if (usb_endpoint_xfer_int(ep)) {
                        if (usb_endpoint_dir_in(ep))
                                ep_irq_in = ep;
-                       else
+                       else if (usb_endpoint_dir_out(ep))
                                ep_irq_out = ep;
                }
        }

Please note that I'm unable to make sure that the patch doesn't break support for the original controller as I don't own one.

sirkhancision commented 3 years ago

I forked the repo with the changes made by @zskamljic already pre-made.

joshuamundinger commented 3 years ago

I tried installing the fork today, and got an error. Here is the make.log:

DKMS make.log for xpad-0.4 for kernel 5.8.0-55-generic (x86_64)
Sat 12 Jun 2021 09:50:30 PM CDT
make -C /lib/modules/5.8.0-55-generic/build V=1 M=/var/lib/dkms/xpad/0.4/build modules
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: Entering directory '/usr/src/linux-headers-5.8.0-55-generic'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (        \
echo >&2;                           \
echo >&2 "  ERROR: Kernel configuration is invalid.";       \
echo >&2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
echo >&2 ;                          \
/bin/false)

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

make[1]: *** [Makefile:746: include/config/auto.conf] Error 1
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-55-generic'
make: *** [Makefile:5: all] Error 2

Can someone help me out?

sirkhancision commented 3 years ago

@joshuamundinger Found this which seems to be related to your issue. Try giving it a go and see if it helps.

lmh commented 3 years ago

Same controller, same issue. Patch works great. Thanks!

sudo git clone https://github.com/sirkhancision/xpad.git /usr/src/xpad-0.4
sudo dkms install -m xpad -v 0.4
sudo rmmod xpad
sudo modprobe xpad
paroj commented 3 years ago

applied a slightly modified version in this branch: https://github.com/paroj/xpad/tree/zeroplus

please report, whether it also works for you.

jurask commented 3 years ago

Hi, I had the same issues with zeroplus controller and I can confirm, that patch in zeroplus branch works

whalefood commented 2 years ago

Really glad I found this thread. @sirkhancision version worked for my zeroplus controller, but it caused issues with some other controllers I had. And I didn't have any luck with @paroj's version. So I made my own fork with some slight alterations that seems to work for all my various knock-off controllers here: https://github.com/whalefood/xpad

davidebeatrici commented 2 years ago

What about my patch? https://github.com/paroj/xpad/issues/161#issuecomment-825369646

whalefood commented 2 years ago

@davidebeatrici I think your patch is good! The changes I made to sirkhancision's version basically turn it into exactly what your patch is. I didn't realize the two were different at first

whalefood commented 2 years ago

Ah. Only difference is I left this line removed: XBOXONE_INIT_PKT(0x045e, 0x02ea, xboxone_s_init),

I'll test again with that line back at some point to see if the removal is necessary

jpbrisa commented 2 years ago

how do i install it on arch linux? sory! first time on linux i use the iso of steamOS code name holo.

Tennyleaz commented 1 year ago

applied a slightly modified version in this branch: https://github.com/paroj/xpad/tree/zeroplus

please report, whether it also works for you.

Yes, this patch is working for me!