HAT not working in Linux

For system help, all hardware / software topics NOTE: use Coders Corner for all coders topics.

Moderators: Krom, Grendel

Post Reply
User avatar
iten
DBB Ace
DBB Ace
Posts: 100
Joined: Tue Sep 28, 2004 3:38 pm

HAT not working in Linux

Post 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? :(
User avatar
Top Gun
DBB Master
DBB Master
Posts: 8099
Joined: Wed Nov 13, 2002 3:01 am

Post 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.
User avatar
iten
DBB Ace
DBB Ace
Posts: 100
Joined: Tue Sep 28, 2004 3:38 pm

Post 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?
User avatar
akula65
DBB Ace
DBB Ace
Posts: 372
Joined: Mon Sep 20, 2004 6:34 pm
Location: Virginia

Post 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?
User avatar
iten
DBB Ace
DBB Ace
Posts: 100
Joined: Tue Sep 28, 2004 3:38 pm

Post 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
User avatar
iten
DBB Ace
DBB Ace
Posts: 100
Joined: Tue Sep 28, 2004 3:38 pm

Post 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*
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post 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.
User avatar
iten
DBB Ace
DBB Ace
Posts: 100
Joined: Tue Sep 28, 2004 3:38 pm

Post 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.
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post 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.
User avatar
iten
DBB Ace
DBB Ace
Posts: 100
Joined: Tue Sep 28, 2004 3:38 pm

Post 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.
Post Reply