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 2033

Summary: SDL_JOYDEVICEADDED does not work on Ubuntu 12.04
Product: SDL Reporter: bonsairobo
Component: videoAssignee: Gabriel Jacobo <gabomdq>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: amaranth72, gabomdq, norfanin, zashir
Version: 2.0.0   
Hardware: x86   
OS: Linux   

Description bonsairobo 2013-08-13 15:25:13 UTC
Testing like so:

if (event.type == SDL_JOYDEVICEADDED)
    std::cout << "joystick plugged in" << std::endl;

Possibly not implemented yet?
Comment 1 Alex Szpakowski 2013-08-13 19:39:56 UTC
Are you initializing the Joystick subsystem (SDL_InitSubsystem(SDL_INIT_JOYSTICK))?
Comment 2 bonsairobo 2013-08-14 13:33:39 UTC
(In reply to comment #1)
> Are you initializing the Joystick subsystem
> (SDL_InitSubsystem(SDL_INIT_JOYSTICK))?

Yes definitely, and polling the event.
Comment 3 zashir 2013-08-28 19:39:37 UTC
Similar problem with Arch Linux. Turns out that SDL 2.0 has a hardcoded reference to 'libudev.so.0' (in src/joystick/linux/SDL_sysjoystick.c), and that particular major isn't a file or symlink by default in some distributions.

Creating a symlink to it yourself fixes the problem, but is obviously non-ideal. Can the hardcoded link be replaced with a more generic 'libudev.so'? Or alternatively can a list of acceptable major versions be cycled over?
Comment 4 Gabriel Jacobo 2013-08-29 18:47:07 UTC
I'm reworking the UDEV code in bug #2005, I assume checking for:

libudev.so.0
libudev.so.1
libudev.so

Should solve the problem? I've seen people solving the lack of libudev.so.0 by symlinking to libudev.so.1, so I guess loading any of those should work fine for our purpouses.

I'm assuming either of these get installed to a default library path.
Comment 5 zashir 2013-08-29 21:36:42 UTC
dlopen() is fairly smart in where it searches, and any sanely configured distribution will have shared objects where dlopen() can find them. So assuming libudev is installed at all, going through those names ought to find it. Which should close this bug.
Comment 6 Sam Lantinga 2013-09-05 14:05:09 UTC
You shouldn't look for libudev.so, as that's the development library.  Gabriel, in your new udev code, can you look for libudev in the following order?
libudev.so.1
libudev.so.0
Comment 7 Gabriel Jacobo 2013-09-18 13:12:51 UTC
*** Bug 2102 has been marked as a duplicate of this bug. ***
Comment 8 Gabriel Jacobo 2013-09-28 18:56:04 UTC
Patch to solve this attached in #2118

*** This bug has been marked as a duplicate of bug 2118 ***