xbmc / peripheral.joystick

Kodi joystick support (drivers and button maps)
GNU General Public License v2.0
24 stars 46 forks source link

Joystick intermittently stops working #134

Open Blackclaws opened 6 years ago

Blackclaws commented 6 years ago

So I'm quite happy in general how easy it is to set up a joystick right now. The main problem I'm facing is that it will sometimes without warning stop working in kodi leaving this in the log:

00:20:32.214 T:139691099584256 ERROR: AddOnLog: Joystick Support: ScanEvents: failed to read joystick "Wireless Controller" on /dev/input/js0 - 19 (No such device) 00:20:33.031 T:139691110160128 ERROR: Previous line repeats 49 times.

With varying amounts of repeats. This persists until I reconnect the joystick.

jstest or other utilities keep seeing the joystick just fine and work as expected. The device /dev/input/js0 in that case was also there and responding as it should.

Any clue how I can help to triage this?

Joystick was a Dualshock 4 paired over Bluetooth

garbear commented 6 years ago

Can you try the udev driver? This can be found in the add-on's settings or the Driver Settings button in System -> Input settings.

Also let me know if you run into this issue.

Blackclaws commented 6 years ago

Thanks for the quick response, I tried the udev driver now and it is practically unusable for me.

I do run into the issue you referenced. The controller is a) not auto detected when using the udev driver and b) I can when manually binding the controls not bind all the analog axis.

I further tried debugging this problem now. It appears that its both a controller and a kodi issue in the end. The controller itself goes into a suspend mode after a while, meaning that it won't send its inputs to linux anymore. I might have to play around with bluetooth suspend settings to mitigate that. If you hard reset the controller then, by disconnecting and reconnecting immediately, it appears the kodi addon does not do well with that happening as it then produces those errors. If you leave it disconnected for a while ( a couple of seconds ) the errors don't seem to happen.

garbear commented 6 years ago

I have a sixaxis I can test with. My plan is to finish the player manager, then address the remaining joystick drivers I plan to finish (udev, steamcontroller, xarcade, etc).

evilbulgarian commented 2 months ago

still running into this issue with my steam controller:


2024-08-24 16:03:50.791 T:967      info <general>: RetroPlayer[PLAYER]: Opening: /storage/.kodi/userdata/addon_data/plugin.program.iagl/game_cache/Super Mario World (USA).sfc
2024-08-24 16:03:50.792 T:967      info <general>: AddOnLog: game.libretro.beetle-bsnes: Loading /storage/.kodi/userdata/addon_data/plugin.program.iagl/game_cache/Super Mario World (USA).sfc...

2024-08-24 16:03:50.792 T:967      info <general>: AddOnLog: game.libretro.beetle-bsnes:  Using module: snes(Super Nintendo Entertainment System/Super Famicom)

2024-08-24 16:03:50.801 T:967      info <general>: AddOnLog: game.libretro.beetle-bsnes: MDFN_MakeFName: /storage/.kodi/userdata/addon_data/game.libretro.beetle-bsnes/save/Super Mario World (USA).srm

2024-08-24 16:03:50.802 T:967      info <general>: AddOnLog: game.libretro.beetle-bsnes: MDFN_MakeFName: /storage/.kodi/userdata/addon_data/game.libretro.beetle-bsnes/save/Super Mario World (USA).rtc

2024-08-24 16:03:50.802 T:967      info <general>: AddOnLog: game.libretro.beetle-bsnes: (null)

2024-08-24 16:03:50.803 T:967      info <general>: GAME: ---------------------------------------
2024-08-24 16:03:50.803 T:967      info <general>: GAME: Game loop:      true
2024-08-24 16:03:50.803 T:967      info <general>: GAME: FPS:            60.100000
2024-08-24 16:03:50.803 T:967      info <general>: GAME: Sample Rate:    44100.000000
2024-08-24 16:03:50.803 T:967      info <general>: GAME: Region:         NTSC
2024-08-24 16:03:50.803 T:967      info <general>: GAME: Savestate size: 301317
2024-08-24 16:03:50.803 T:967      info <general>: GAME: ---------------------------------------
2024-08-24 16:03:50.817 T:967     error <general>: Cheevos: Couldn't load patch file
2024-08-24 16:03:50.819 T:967      info <general>: Loading skin file: VideoFullScreen.xml, load type: KEEP_IN_MEMORY
2024-08-24 16:03:50.827 T:1139     info <general>: RetroPlayer[RENDER]: Configuring format 0RGB32, nominal 256x224, max 512x512
2024-08-24 16:03:50.827 T:1139     info <general>: RetroPlayer[AUDIO]: Creating audio stream, format = AE_FMT_S16NE, sample rate = 44100, channels = 2
2024-08-24 16:03:50.833 T:967     error <general>: CGUIMediaWindow::GetDirectory(plugin://plugin.program.iagl/game/SNES_Bestof_ZachMorris/Super+Mario+World+%28USA%29) failed
2024-08-24 16:03:50.891 T:1142     info <general>: IAGL:  Lets Play!
2024-08-24 16:03:50.935 T:967      info <general>: RetroPlayer[RENDER]: Renderer configured on first frame
2024-08-24 16:04:00.820 T:1144    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:04:10.820 T:1145    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:04:20.820 T:1146    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:04:30.820 T:1147    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:04:40.821 T:1148    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:04:50.821 T:1149    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:05:00.821 T:1150    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:05:10.821 T:1152    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:05:20.821 T:1154    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:05:30.821 T:1155    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:05:40.821 T:1156    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:05:50.821 T:1157    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:06:00.822 T:1158    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:06:10.822 T:1159    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:06:20.822 T:1160    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:06:30.822 T:1161    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:06:40.822 T:1162    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:06:50.822 T:1163    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:07:00.822 T:1165    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:07:09.992 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:10.823 T:1206     info <general>: Skipped 49 duplicate messages..
2024-08-24 16:07:10.823 T:1206    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:07:10.824 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:11.057 T:975      info <general>: Skipped 13 duplicate messages..
2024-08-24 16:07:11.057 T:975     error <general>: open_restricted - failed to open /dev/input/event4 (No such file or directory)
2024-08-24 16:07:11.057 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:14.200 T:967      info <general>: Skipped 188 duplicate messages..
2024-08-24 16:07:14.200 T:967      info <general>: Loading skin file: GameOSD.xml, load type: KEEP_IN_MEMORY
2024-08-24 16:07:14.201 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:16.116 T:967      info <general>: Skipped 118 duplicate messages..
2024-08-24 16:07:16.116 T:967   warning <general>: CGUIWindowManager - HandleAction - ignoring action 3, because topmost modal dialog closing animation is running
2024-08-24 16:07:16.122 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:16.183 T:967      info <general>: Skipped 3 duplicate messages..
2024-08-24 16:07:16.183 T:967   warning <general>: CGUIWindowManager - HandleAction - ignoring action 3, because topmost modal dialog closing animation is running
2024-08-24 16:07:16.184 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:16.233 T:967      info <general>: Skipped 3 duplicate messages..
2024-08-24 16:07:16.233 T:967   warning <general>: CGUIWindowManager - HandleAction - ignoring action 3, because topmost modal dialog closing animation is running
2024-08-24 16:07:16.247 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:16.300 T:967      info <general>: Skipped 3 duplicate messages..
2024-08-24 16:07:16.299 T:967   warning <general>: CGUIWindowManager - HandleAction - ignoring action 3, because topmost modal dialog closing animation is running
2024-08-24 16:07:16.309 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:20.823 T:1343     info <general>: Skipped 271 duplicate messages..
2024-08-24 16:07:20.823 T:1343    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:07:20.832 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:30.823 T:1344     info <general>: Skipped 600 duplicate messages..
2024-08-24 16:07:30.823 T:1344    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:07:30.832 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:34.566 T:967      info <general>: Skipped 222 duplicate messages..
2024-08-24 16:07:34.566 T:967   warning <general>: CGUIWindowManager - HandleAction - ignoring action 3, because topmost modal dialog closing animation is running
2024-08-24 16:07:34.582 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:34.616 T:967      info <general>: Skipped 2 duplicate messages..
2024-08-24 16:07:34.616 T:967   warning <general>: CGUIWindowManager - HandleAction - ignoring action 3, because topmost modal dialog closing animation is running
2024-08-24 16:07:34.628 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:34.683 T:967      info <general>: Skipped 3 duplicate messages..
2024-08-24 16:07:34.683 T:967   warning <general>: CGUIWindowManager - HandleAction - ignoring action 3, because topmost modal dialog closing animation is running
2024-08-24 16:07:34.690 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:34.750 T:967      info <general>: Skipped 3 duplicate messages..
2024-08-24 16:07:34.750 T:967   warning <general>: CGUIWindowManager - HandleAction - ignoring action 3, because topmost modal dialog closing animation is running
2024-08-24 16:07:34.753 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:40.823 T:1350     info <general>: Skipped 365 duplicate messages..
2024-08-24 16:07:40.823 T:1350    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:07:40.830 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:07:50.823 T:1351     info <general>: Skipped 600 duplicate messages..
2024-08-24 16:07:50.823 T:1351    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:07:50.830 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)
2024-08-24 16:08:00.823 T:1352     info <general>: Skipped 600 duplicate messages..
2024-08-24 16:08:00.823 T:1352    error <general>: Cheevos: Rich Presence script was not found
2024-08-24 16:08:00.830 T:989     error <general>: AddOnLog: peripheral.joystick: ScanEvents: failed to read joystick "Wireless Steam Controller" on /dev/input/js0 - 19 (No such device)```
garbear commented 2 months ago

This looks like an OS problem. Error 19 is ENODEV, "No such device", returned by the OS when a requested device is no longer available. In this case, it indicates that the system failed to communicate with the joystick or couldn't find it at the specified device node (e.g., /dev/input/js0).

Given that it's a wireless controller, the wireless connection is most likely the problem. Can you try connecting the controller via wire?

It could also be a Linux problem. Can you try switching from the Linux Joystick API driver to the udev driver?

Finally, if the issue persists, perhaps we can work around it with some reconnect logic.

evilbulgarian commented 2 months ago

This looks like an OS problem. Error 19 is ENODEV, "No such device", returned by the OS when a requested device is no longer available. In this case, it indicates that the system failed to communicate with the joystick or couldn't find it at the specified device node (e.g., /dev/input/js0).

Given that it's a wireless controller, the wireless connection is most likely the problem. Can you try connecting the controller via wire?

It could also be a Linux problem. Can you try switching from the Linux Joystick API driver to the udev driver?

Finally, if the issue persists, perhaps we can work around it with some reconnect logic.

Thanks for the fast response will try that!

evilbulgarian commented 2 months ago

Yeah udev works better it seems, the controller still dissapears but is found again:

2024-08-25 09:24:10.036 T:908      info <general>: UnregisterRemovedDevices - device removed from joystick/peripheral.joystick/0: Wireless Steam Controller (28DE:1142)
2024-08-25 09:24:15.162 T:908      info <general>: AddOnLog: peripheral.joystick: Initialized joystick 0: "Wireless Steam Controller", axes: 8, hats: 0, buttons: 21
2024-08-25 09:24:15.226 T:908      info <general>: Register - new joystick device registered on addon->peripheral.joystick/0: Wireless Steam Controller
[ 1148.137254] hid-steam 0003:28DE:1142.0008: hidraw3: USB HID v1.11 Device [Valve Software Steam Controller] on usb-xhci-hcd.0-2/input3
[ 1148.194854] hid-steam 0003:28DE:1142.0004: Steam wireless receiver connected
[ 1148.201059] hid-steam 0003:28DE:1142.0005: hiddev99: USB HID v1.11 Device [Valve Software Steam Controller] on usb-xhci-hcd.0-2/input4
[ 1148.201200] hid-steam 0003:28DE:1142.0009: hidraw4: USB HID v1.11 Device [Valve Software Steam Controller] on usb-xhci-hcd.0-2/input4
[ 1148.254854] hid-steam 0003:28DE:1142.0005: Steam wireless receiver connected
[ 1162.389736] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' connected
[ 1162.401739] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.1/0003:28DE:1142.0002/input/input6
[ 1189.504423] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' disconnected
[ 1190.468825] hid-steam 0003:28DE:1142.0002: Steam Controller 'XXXXXXXXXX' connected
[ 1190.480866] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.1/0003:28DE:1142.0002/input/input7
[ 1190.587750] hid-steam 0003:28DE:1142.0002: Steam Controller 'XXXXXXXXXX' disconnected
[ 1190.745829] hid-steam 0003:28DE:1142.0003: Steam Controller 'XXXXXXXXXX' connected
[ 1190.757884] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.2/0003:28DE:1142.0003/input/input8
[ 1190.884566] hid-steam 0003:28DE:1142.0003: Steam Controller 'XXXXXXXXXX' disconnected
[ 1193.551950] hid-steam 0003:28DE:1142.0002: Steam Controller 'XXXXXXXXXX' connected
[ 1193.565395] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.1/0003:28DE:1142.0002/input/input9
[ 1193.684796] hid-steam 0003:28DE:1142.0002: Steam Controller 'XXXXXXXXXX' disconnected
[ 1194.811997] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' connected
[ 1194.824074] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.1/0003:28DE:1142.0002/input/input10
[ 1400.395953] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' disconnected
[ 1401.523546] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' connected
[ 1401.536798] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.1/0003:28DE:1142.0002/input/input11
[ 2129.623678] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' disconnected
[ 2130.503596] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' connected
[ 2130.516906] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.1/0003:28DE:1142.0002/input/input12
[ 2973.359365] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' disconnected
[ 2984.011172] hid-steam 0003:28DE:1142.0002: Steam Controller 'XXXXXXXXXX' connected
[ 2984.022867] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.1/0003:28DE:1142.0002/input/input13
[ 2984.149291] hid-steam 0003:28DE:1142.0002: Steam Controller 'XXXXXXXXXX' disconnected
[ 2985.160898] hid-steam 0003:28DE:1142.0002: Steam Controller 'XXXXXXXXXX' connected
[ 2985.175865] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.1/0003:28DE:1142.0002/input/input14
[ 2985.292879] hid-steam 0003:28DE:1142.0002: Steam Controller 'XXXXXXXXXX' disconnected
[ 2985.626889] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' connected
[ 2985.638925] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.1/0003:28DE:1142.0002/input/input15
[ 3002.182504] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' disconnected
[ 3002.744506] hid-steam 0003:28DE:1142.0003: Steam Controller 'FC636224E9' connected
[ 3002.984677] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.2/0003:28DE:1142.0003/input/input16
[ 3003.023607] hid-steam 0003:28DE:1142.0002: Steam Controller 'XXXXXXXXXX' connected
[ 3003.035671] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.1/0003:28DE:1142.0002/input/input17
[ 3003.139223] hid-steam 0003:28DE:1142.0002: Steam Controller 'XXXXXXXXXX' disconnected
[ 3010.352499] hid-steam 0003:28DE:1142.0003: Steam Controller 'FC636224E9' disconnected
[ 3011.086938] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' connected
[ 3011.099007] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.1/0003:28DE:1142.0002/input/input18
[ 3011.675945] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' disconnected
[ 3012.350991] hid-steam 0003:28DE:1142.0002: Steam Controller 'FC636224E9' connected
[ 3012.363076] input: Wireless Steam Controller as /devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci-hcd.0/usb1/1-2/1-2:1.1/0003:28DE:1142.0002/input/input19
garbear commented 2 months ago

Check ls /dev/input/js*. I bet that the OS is dropping the connection to the controller and re-assigning it /dev/input/js1.

It's good that udev reconnects. The Linux joystick driver should also reconnect, but I'd eed to get ahold of a faulty controller for testing.

evilbulgarian commented 2 months ago

Yeah maybe its my raspberry pi5 it sucks with bluetooth controllers too and sucks with my steam deck controller :)

garbear commented 2 months ago

I've been mired in RPi 5 problems for two weeks now. There's lots of development in side branches, and RPi 5 fixes are frequently being merged. I suggest updating all firmware and OS versions. If weak controller connectivity is still an issue, we can take this thread to the LibreELEC forum.