[AD] Fwd: Re: Allegro Linux joystick patch

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Just rememberd I still had to forward the response I got from teh author 
about the Linux joystick patch.

I have rethought the issue and I can see how it can be expected that the 
result of poll_joy() is that the state reflects the current joystick 
state. 
If the change were to be made, it would be nescessary to poll the joystick 
regularly or else events would be missed. Isn't this the same behavior 
when the keyboard and mouse are polled, or is the current state returned 
there?
If the current state is returned in those cases, then for consistency so 
too should it be for the joystick. I also haven't checked how poll_joy() 
behaves on other platforms. I'll see about checking those but it will 
probably be later in the week.

My suggestion would be to add a config flag for the Linux joystick driver 
that can select between the two behaviors. The default value can be 
discussed, although I now lean towards dropping events in order to stay 
current for the default behavior.

Evert

----------  Begin Forwarded Message  ----------

Subject: Re: Allegro Linux joystick patch
Date: Saturday 03 July 2004 13:45
From: Greg Lee <greg@xxxxxxxxxx>
To: Evert Glebbeek <eglebbk@xxxxxxxxxx>

Evert Glebbeek wrote:
> Hello,
> 
> I have a question about the Linux joystick patch you posted on April 24 
> (sorry for being so late about it).
> First, I cannot reproduce the problem that it is supposed to fix - I get 
> the same behavior with and without your patch. Secondly, there is a 
> possible problem because the patch makes it possible to lose events.

Yes, it does.  If you don't poll often enough.  But you keep up with the
current position of the stick.

> It 
> may be argued that losing events that are no longer reflect the current 
> state of the joystick isn't a bad thing, but that should be for the 
> programmer to decide and not for the driver to enforce in my opinion.

I suppose.  If it's not the current position of the stick you're
interested in, but rather the details of its movements in the last
30th of a second.  I can't think of any circumstances when that
be so, but it's conceivable.

> I would be ok for reading multiple events from the queue and buffer them 
> internally, but I don't suppose that fixes your problem.

No, I don't think there would be any point in that.  The hardware driver
already maintains a queue.

> 
> Have you tried polling the joystick more often than once per video frame, 
> for instance, once per logic frame?

No.  That wouldn't be easy.  But what I could have done is poll
repeatedly every frame to drain all the events queued up by
the hardware driver.  I'd have to somehow figure out how many
times to poll, and I would just discard the old information.
Then I would be doing the work the Allegro driver could (and
should) have done for me.

Well, suit yourself.  I don't have any personal interest any
longer, since in the application I was working on, I switched
to using SDL, and the SDL joystick driver doesn't have the
problem that the Allegro driver has.

Greg



-------------------------------------------------------





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/