Page 1 of 1

HAT not working in Linux

Posted: Tue Oct 05, 2004 9:13 pm
by iten
I recently got a Linux version of D3 from a friend, and the HAT simply does not work.
What is R-Axis on Windows is also Z-Axis. (?)

I have a Logitech Extreme 3D Pro.

jstest gives the HAT at axes 4 and 5, with the values being -32767 , 0 , and 32767.

Also, when I cat /dev/js0, it does give data when I move the HAT.

I really would like not to reboot half the time, so any tips? :(

Posted: Tue Oct 05, 2004 9:25 pm
by Top Gun
I believe the Z axis is the throttle, and the R axis is the twist function. The hat switch should appear as "POV L/R/U/D" or something similar, not as an axis.

Posted: Tue Oct 05, 2004 9:32 pm
by iten
Yes, however, the two axes are reversed in D3.
Twist is Z-axis, throttle is R-axis.

I cannot enter the hat on the Slide up/down/left/right (yes, it's on the joystick page). When I copied over my pilot from windows, with slide U/D/L/R bound to the HAT, while piloting the hat similarly did not work.

The buttons and other axes work.

Anyone with a Linux joystick wanna run jstest and tell me what their HAT is bound to?

Posted: Wed Oct 06, 2004 6:01 am
by akula65
Although I use Mandrake Linux 9.0, I don't have a Logitech stick to test. However, it sounds like the level of joystick support you have may depend on what distribution/kernel version you have:

http://www.wingmanteam.com/linux.htm

Does the HAT work in other Linux games or is this a D3 only issue?

Posted: Fri Oct 08, 2004 9:50 pm
by iten
I don't know, it didn't really work in D2x, but I've heard people have tons of trouble with that anyways.

I'm using simple HID right now...

Please please please all linux users running this, run jstest and tell me what changes when you press the hat.

If I know that, maybe I can hack the kernel or something.

If you don't have jstest, you're probably a Gentoo user like me, I downloaded the source off Debian's site.

kernel 2.6.7

Posted: Fri Oct 08, 2004 11:22 pm
by iten
http://www.mail-archive.com/linux-usb-u ... 11609.html

Unfortunately, it didn't get answered... :(

So, it looks like it's up to me 8)

/me puts ultra-kernel-hacking gear on.

BTW, all I need to know now is which buttons the HAT corresponds to.

In jstest, I have 4 free buttons:
12 13 14 15
which in nonzero counting would be 13 14 15 16.

Alrighty.
I just need data, then maybe I can make a module or something.
It'd feel kinda weird having my code included in the kernel :o

Time to stop talking and start working, I guess.

*gulp*

Posted: Sat Oct 09, 2004 12:10 am
by fliptw
here's a thought: fix D2X, rather than trying to break the kernel?

The hat, for all functional purposes, is a digital joystick, so trying to hack the kernel into thinking their buttons won't work - it aint a collection of buttons.

Posted: Sat Oct 09, 2004 12:36 am
by iten
My problem isn't with D2X.

The problem is that the HAT really isn't 2 axes.

It's 4 buttons.

The kernel is recognizing it as a Button, which is understandable because ABS_HAT0x seems to be an axis.

This'll be fixed pretty soon, I have it pretty much nailed down.

It's a pretty dirty hack however, and it'll probably break most other joysticks.

Hey, not my problem! :P

EDIT: I honestly don't know what the HAT is, feel free to correct me, but it seemed to sound like it was supposed to be 4 buttons.

Posted: Sat Oct 09, 2004 12:45 am
by fliptw
its a d-pad, not axis.

Note: on most gamepads with more than one stick/pad(eg the Logitech rumblepad), the 8-way hat by default is on the digital pad, but can be swapped with one of the analog sticks, so, its a pair of axis.

They might have been a set of buttons on earlier gameport sticks, but I doubt it.

Posted: Sat Oct 09, 2004 1:34 am
by iten
Fixed it, didn't really take that long.

If anyone really wants the patch (ugly ugly ugly) you can pm me or something.

I don't think anyone else has my joystick anyways, but I'm going to try to make it cleaner in the morning when i'm sane.

Thanks for all your help, guys.