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 2288 - OUYA/Android joystick hotplug support
Summary: OUYA/Android joystick hotplug support
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.0
Hardware: ARM Android (All)
: P1 major
Assignee: Gabriel Jacobo
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-08 11:36 UTC by Martin Gerhardy
Modified: 2013-12-12 05:14 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Gerhardy 2013-12-08 11:36:49 UTC
Without hotplug support it's almost impossible to release a game on the OUYA. The problem is that you don't get the events for removing or adding joystick devices on android (hotplug support is not implemented as far as i know) - thus you could result in a stage where the game is no longer controllable due to the wrong joystick initialized. It would be really cool to get hotplug support on android.

E.g. by throwing the event if someone pressed a button on an unknown joystick device id (getJoyId(deviceId) == -1).
Comment 1 Sam Lantinga 2013-12-08 19:03:07 UTC
Gabriel, this is an important thing to fix for the next release. Can you take a look?

Thanks!
Comment 2 Gabriel Jacobo 2013-12-10 19:25:28 UTC
A first pass: https://hg.libsdl.org/SDL/rev/801d84e26f91

Feel free to open other bugs if you find problems with this. I tested with the controllermap app and it seemed to perform well.
Comment 3 Gabriel Jacobo 2013-12-10 19:27:30 UTC
One fix we can probably do is to not poll for new joysticks on every iteration, maybe have a timeout and poll every second, or five seconds or whatever. Specially given that pressing a button on an unknown joystick will trigger a polling event as well. 

What do you think Sam?
Comment 4 Martin Gerhardy 2013-12-11 09:58:02 UTC
thanks a lot Gabriel - I will test on my ouya and some other devices.
Comment 5 Sam Lantinga 2013-12-12 05:14:21 UTC
Yes, polling every 3 seconds sounds good.