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 1368

Summary: Enabling joystick subsystem cause an infinite loop
Product: SDL Reporter: morgan.devel
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Android (All)   
Attachments: joystick subsystem patch.

Description morgan.devel 2012-01-13 00:32:23 UTC
The android version of SDL_SYS_JoystickUpdate doesn't check if there is actually new data and always generate the SDL_JOYAXISMOTION event. Consequently, doing a while(SDL_PollEvent()) will result in an endless loop.

The attached patch fix this issue.

It also scale the incoming values properly in the Sint16 range. The scale from [-gravity;+gravity] is done directly in the java part because one may want to map the sensor values with a non-linear method for example.

Hope it'll help.
Comment 1 Sam Lantinga 2012-01-13 00:50:42 UTC
Thanks! ... I don't see the patch attached?
Comment 2 morgan.devel 2012-01-13 01:14:05 UTC
Created attachment 765 [details]
joystick subsystem patch.
Comment 3 Sam Lantinga 2012-01-13 18:00:12 UTC
Looks good, thanks!
http://hg.libsdl.org/SDL/rev/78d854de3a66