2002-07-09 16:03:00

by Piotr Sawuk

[permalink] [raw]
Subject: joystick.c

Sorry if I'm off-topic here, since I don't read this list.
also when replying please send me a copy...

in function js_correct(value,corr) I've found the instructions:

if (value < -32767) return -32767;
if (value > 32767) return 32767;

what's the use of these? I'm asking because my new usb-joystick
is returning those values somewhere in the middle of it's threshold
and I was wondering if disabling the above would do any good?


however, the actual reason why I've looked into that file was
because wine reported strange joystick-events 6,7,8,9 and I
just can't figure out what those are supposed to do. I've found
JS_EVENT 1 and 2 in the linux/joystick.h include, but no mention
of anything related to the number '6'. does anyone know anything
about those joystick events?

P


2002-07-09 16:15:23

by Thunder from the hill

[permalink] [raw]
Subject: Re: joystick.c

Hi,

On Tue, 9 Jul 2002, Piotr Sawuk wrote:
> if (value < -32767) return -32767;
> if (value > 32767) return 32767;
>
> what's the use of these? I'm asking because my new usb-joystick
> is returning those values somewhere in the middle of it's threshold
> and I was wondering if disabling the above would do any good?

That's just:
We don't return values below -32,767
We don't return values above 32,767

So your values are OK as long as they don't exceed [-32,767:32,767]

Regards,
Thunder
--
(Use http://www.ebb.org/ungeek if you can't decode)
------BEGIN GEEK CODE BLOCK------
Version: 3.12
GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$
N--- o? K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G
e++++ h* r--- y-
------END GEEK CODE BLOCK------

2002-07-09 16:36:13

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: joystick.c

On Tue, Jul 09, 2002 at 10:21:44AM +0000, Piotr Sawuk wrote:

> Sorry if I'm off-topic here, since I don't read this list.
> also when replying please send me a copy...
>
> in function js_correct(value,corr) I've found the instructions:
>
> if (value < -32767) return -32767;
> if (value > 32767) return 32767;
>
> what's the use of these? I'm asking because my new usb-joystick
> is returning those values somewhere in the middle of it's threshold
> and I was wondering if disabling the above would do any good?

The data coming from the joystick is defined to be bound by this range.
It's signed 16 bit anyway.

> however, the actual reason why I've looked into that file was
> because wine reported strange joystick-events 6,7,8,9 and I
> just can't figure out what those are supposed to do. I've found
> JS_EVENT 1 and 2 in the linux/joystick.h include, but no mention
> of anything related to the number '6'. does anyone know anything
> about those joystick events?

What joystick is it? This looks like a problem with the HID driver.

--
Vojtech Pavlik
SuSE Labs

2002-07-12 16:11:57

by Piotr Sawuk

[permalink] [raw]
Subject: Re: joystick.c

Vojtech Pavlik wrote:
>
> On Tue, Jul 09, 2002 at 10:21:44AM +0000, Piotr Sawuk wrote:
>
> > Sorry if I'm off-topic here, since I don't read this list.
> > also when replying please send me a copy...
> >
> > in function js_correct(value,corr) I've found the instructions:
> >
> > if (value < -32767) return -32767;
> > if (value > 32767) return 32767;
> >
> > what's the use of these? I'm asking because my new usb-joystick
> > is returning those values somewhere in the middle of it's threshold
> > and I was wondering if disabling the above would do any good?
>
> The data coming from the joystick is defined to be bound by this range.
> It's signed 16 bit anyway.

I see, I was just wondering why only 16 and not 32 bit or something.
also after noticing that the little throttle-thing at the top was
not reporting any difference between the most left value and some
1/5 to the right of it, I turned off these lines (in joydev.c),
and now on every axis jstest reports (after an overflow) that the
lowest value is 27700 and the highest value is -27363 (except of
course for the non-analogue axes). could it be possible to fix the
driver in a way to make this throttle-thing work correctly in those
extreme postitions? on the other axes it is indeed a physical limitation
which lets them get their extreme values somewhere in the middle
between center and bumping into the edge, but considering the
thin and fragile construction I would hesitate to let it bump into
the threshold anyway...
>
> > however, the actual reason why I've looked into that file was
> > because wine reported strange joystick-events 6,7,8,9 and I
> > just can't figure out what those are supposed to do. I've found
> > JS_EVENT 1 and 2 in the linux/joystick.h include, but no mention
> > of anything related to the number '6'. does anyone know anything
> > about those joystick events?
>
> What joystick is it? This looks like a problem with the HID driver.

It's a [Logitech Inc. WingMan RumblePad]. it has 5 "analogue"
axes (0,1 and 3,4 and 2 being the throttle) and 2 typical for a
gamepad (5,6 -- unless button 12 is switched on, in which case
the axes 5,6 are switched with the axes 0,1 and both become
non-analogue axes with my modified joydev reporting 28038 as the
minimum and -27701 as the maximum-value for the 2 gamepad-axes).
However, jstest reports 10 axes (7,8,9 always at the lowest value),
and also the buttons 9,10 and 13-19 are unused (vibration-feedback?),
it would be nice if those "unused" stuff could stop being displayed...

unfortunately I only have win95, so I can't check how it is handled
there (since even with usb-supplement there is no full hid-support).
I just would *guess* that the above-mentioned throttle-problem isn't
meant to be handled this way...

Oh, and I probably should also mention that I'm using an old usb-chip
and the usb-uhci driver from my 2.2.21 kernel...

for the mailing-list: when replying please send me a copy.

P