On Wed, May 03, 2000 at 09:19:21AM +0200, Vojtech Pavlik wrote:
> On Tue, May 02, 2000 at 10:01:19PM -0700, Stephen J. Gowdy wrote:
> > Hi All,
> > Finally got round to trying out my joystick with the lastest
> > backport. This is a Microsoft(S) SideWinder Precision Pro. Everything
> > looks fine except for the hat, which comes out as axis 5 and 6. I get the
> > following (I've made 32767 == 1 here), the first digit is axis 5 value
> > and the second is axis6 value;
> >
> > Left Centre Right
> > Up -1 0 0 0 0-1
> > Centre -1 1 -1-1 1-1
> > Down 0 1 1 1 1 0
> >
> > This looks the same (bar axes numbers) as the post;
> >
> > http://electricrain.com/lists/archive/linux-usb/2000/04/msg00795.html
> >
> > David Wegmuller thought this might be his fault for the Wingman but if I
> > see it for this joystick also, is it not a general USB joystick problem?
> > Or is it not infact a problem?
>
> Yes, it's a bug, and I'm going to send out a fix soon (today).
And here goes the fix.
--
Vojtech Pavlik
SuSE Labs
--- hid.c.old Wed May 3 09:29:26 2000
+++ hid.c Wed May 3 09:37:45 2000
@@ -78,7 +78,7 @@
static struct {
__s32 x;
__s32 y;
-} hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1,
1}, {-1, 0}, {-1,-1}};
+} hid_hat_to_axis[] = {{ 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1,
+0}, {-1,-1}, { 0, 0}};
/*
* Register a new report for a device.
@@ -948,7 +948,8 @@
hid_dump_input(usage, value);
if (usage->hat) {
- if (usage->hat == 2) value = value * 2 - 1;
+ if (usage->hat == 2) value = value * 2;
+ if (value > 8) value = 8;
input_event(input, usage->type, usage->code ,
hid_hat_to_axis[value].x);
input_event(input, usage->type, usage->code + 1,
hid_hat_to_axis[value].y);
return;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]