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

Summary: Some joystick inputs are delayed on FreeBSD
Product: SDL Reporter: kikuchan
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 1.2   
Hardware: All   
OS: FreeBSD   
Attachments: A patch to read() multiple times

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