We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5488

Summary: HIDAPI on Linux relies on udev_monitor, which won't work in containers
Product: SDL Reporter: Simon McVittie <smcv>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: WAITING --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.1   
Hardware: x86_64   
OS: Linux   

Description Simon McVittie 2021-01-20 12:14:13 UTC
src/joystick/hidapi/SDL_hidapijoystick.c uses a udev_monitor to watch for changes to the set of devices available. Similar to Bug #5337, this isn't reliable in a container.

Similar to the evdev code path in src/joystick/linux/SDL_sysjoystick.c, if it detects a Flatpak or pressure-vessel container, it should fall back to using inotify instead of udev_monitor. The inotify should be on "/dev" to pick up devices matching "/dev/hidapi*", unlike the evdev code path which watches "/dev/input" for devices matching "/dev/input/event*". It would also be useful for debugging if there was an environment variable or hint that could be set to force the inotify code path.
Comment 1 Sam Lantinga 2021-01-20 18:18:43 UTC
Can you provide a tested patch?
Comment 2 Simon McVittie 2021-01-20 20:05:49 UTC
Not immediately, but I can add it to the queue.
Comment 3 Sam Lantinga 2021-01-20 21:13:36 UTC
Great, thanks