I am developing a game as part of a research project using the
Act-Labs USB PC Light Gun. The gun emulates a USB mouse. I have
written the game using SDL on win32 and it works well with really good
accuracy. However when I move across to Linux (Red Hat,Gnome, X11) I
get inconsistent accuracy. Accuracy in the centre of the screen is
good but gets worse towards the periphery. Does the mouse system
under linux differ appreciably from win32?
About the only things they have in common are the requirement to deliver
events to applications and to work with common off the shelf hardware.
Or should I be looking for the problem at a driver level (currently a
generic USB mouse driver)?
Please define what you mean by accuracy? Is it positioning accuracy,
timing accuracy, or both?
[Sean Fitzgibbon] Positioning accuracy.
Are you using the mouse directly through the mouse driver or are you
using it through X?
[Sean Fitzgibbon] I am accessing the mouse events using SDL events, as
such I presume that it is coming from X.
The delay between the time the X server gets input
from the mouse driver and the time it delivers it to you, while usually
not noticeable, can really be a problem where fine motion detection is
[Sean Fitzgibbon] Timing of the response is not important to the
software. It is logged via hardware for analysis later.
Also, look at the mouse handler code in your X server. Some
servers compress mouse motion events. That is, as the mouse moves they
just update the location of the mouse and deliver the accumulated motion
in one event. So, you only get one event for a huge movement of the
mouse. Of course, they have to create a new event every time a button is
pushed to maintain consistent click semantics and when ever a non-mouse
event is added to the queue to maintain time order semantics.
[Sean Fitzgibbon] This sounds as though it may be related to the
Why it would get worse at the edge of the screen is hard for me to
understand. It could be the result of motion event compression. But,
it could also be the result of miss-calibration of the light pen with
the refresh rate of the screen. If the light gun doesn’t have the
correct timing information it can’t really tell where it is pointing and
the error will accumulate as you get toward the left edge of the screen.
How does your light pen sync with the horizontal and vertical retrace
markers in the video signal?
[Sean Fitzgibbon] The light gun splices into the vga signal to the
monitor to sync with the retrace. It works perfectly with win32 so I
don’t think that it will be due to a failure to sync.
Any advice would be greatly appreciated.
Hope I helped.
Bob PendletonOn Thu, 2003-06-26 at 08:21, Sean Fitzgibbon wrote:
- Bob Pendleton: independent writer +
- and programmer. +
- email: Bob at Pendleton.com +
SDL mailing list
SDL at libsdl.org