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 - Enabling joystick subsystem cause an infinite loop
Summary: Enabling joystick subsystem cause an infinite loop
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.0
Hardware: All Android (All)
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-13 00:32 UTC by morgan.devel
Modified: 2012-01-13 18:00 UTC (History)
0 users

See Also:


Attachments
joystick subsystem patch. (3.97 KB, patch)
2012-01-13 01:14 UTC, morgan.devel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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