Re: [AD] Linux joysytick and force feedback

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


On Wed, 26 Jun 2013 16:41:18 +0200, beoran@xxxxxxxxxx wrote:
> OK, thanks for the dump of evtest! I could see the device has absolute
> axes (ABS_VOLUME) and buttons, so it would be recognised as a
> joystick. I tried several other devices, such as my own wireless
> keyboard and the mouse pad on my laptop, and it turns out that they
> were being detected as joysticks as well.
> 
> I looked at SDL, but their joystick checking might be defeated by say,
> a mouse pad that has ABS_X and ABS_Y axes. So, I implemented a more
> severe algorithm. I only accept as a joystick any device that has BOTH
> joystick-like axes AND  joystick-like buttons. I detect this by
> limiting the acceptable axes and buttons to ranges of known values
> from the Linux input.h header file. I hope this will be enough but if
> there are more false positives, then I can make it even more severe by
> rejecting even more button ranges or requiring at least 2 axes.
> 
> I also enhanced ex_joystick_events a bit to show some textual
> information about the joystick.
> This will make it easier to see if we have a false positive in the
> future as the joystick name will tell us.
> 
> In attachment two patches formatted though git format-patch --stdout.
> I hope they can be applied correctly this time.

Thanks.  I've pushed the first patch after some reworking.
I did have to map the Linux button codes to Allegro button numbers.
Subtracting BTN_JOYSTICK does not work in general.

Can you rebase the second patch, and fix the formatting?
Be careful about your indentation and where the whitespace goes.
I'll end up adjusting it anyway but save me some effort :)

Peter




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