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 2090 - Some joystick inputs are delayed on FreeBSD
Summary: Some joystick inputs are delayed on FreeBSD
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 1.2
Hardware: All FreeBSD
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-06 20:36 UTC by kikuchan
Modified: 2013-09-07 03:54 UTC (History)
0 users

See Also:


Attachments
A patch to read() multiple times (3.37 KB, patch)
2013-09-06 20:36 UTC, kikuchan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kikuchan 2013-09-06 20:36:41 UTC
Created attachment 1322 [details]
A patch to read() multiple times

Some joysticks with high sampling rate need to be read() more fast,
otherwise it delay user inputs due to internal queue.
Especially, an app that issues SDL_PollEvent() not so frequent, such as:

while ( ! done ) {
  usleep(10*1000); // <-- some delay
  while ( SDL_PollEvent(&event) ) {
    :
  }
}

It is solved by read()-ing multiple times at once.
(I think this is safe because of O_NONBLOCK mode)
Comment 1 Sam Lantinga 2013-09-07 03:54:44 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL/rev/957d7137867c