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 5360 - [PATCH] non-libudev joystick detection doesn't see controllers that were already connected
Summary: [PATCH] non-libudev joystick detection doesn't see controllers that were alre...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-19 17:27 UTC by Simon McVittie
Modified: 2020-11-24 05:15 UTC (History)
0 users

See Also:


Attachments
joystick: Fix initial detection when not using udev (1.39 KB, patch)
2020-11-19 17:29 UTC, Simon McVittie
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon McVittie 2020-11-19 17:27:07 UTC
This is a follow-up for Bug #5337.

Steps to reproduce:

* Have a USB game controller plugged in
* export SDL_JOYSTICK_DISABLE_UDEV=1
* Run a program that monitors joysticks (like testjoystick)
* Unplug and re-plug the game controller

Expected result:

* Controller is detected as present on startup
* Unplug is detected
* Re-plug is detected

Actual result:

* Controller does not appear to be present initially
* Unplug is not detected either
* Re-plug is detected successfully
Comment 1 Simon McVittie 2020-11-19 17:29:44 UTC
Created attachment 4529 [details]
joystick: Fix initial detection when not using udev


When watching for hotplug events we can poll the inotify fd, but we
still need to scan /dev/input once per process, otherwise we'll fail
to detect devices that were already connected.
Comment 2 Sam Lantinga 2020-11-24 05:15:08 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/9efc5e1acdcc