Hello,
I’m using the controller of the Xbox (USB) on Linux 2.4.21 (latest SDL from
CVS), but I’m having trouble to make the digital pad be recognized as a
hat and not axes.
And you want that because…
So I’ve had a look in the src/joystick/linux/SDL_sysjoystick.c file and it
seems that before kernel 2.4 and its “new unified input interface”, a
digital pad mapped to 2 axes.
Then stop using the event interface - don’t load the evdev module.
I disabled it because my joystick, a Saitek Cyborg 3D, needs better
calibration than the autocalibration provided by the jsdev module. The
evdev doesn’t provide calibration at all, its up to SDL to correct using
the same method as jsdev.
My axis go from -29000 to 20000 instead of -32767 to 32767. Using
jscal fixes the range but screws the rest point to -5000. So I made a
spreadsheet and combined the calibrated min and max with uncalibrated
centre and deadzone… Hmm, I need a better joystick - enough moaning.
…and I like my hat too.
As I’m using 2.4.21, the hat should be detected correctly ?
For the jsdev the analog joystick driver, names matching the
special_joystick table, or forcing with enviroment variable
SDL_LINUX_JOYSTICK. Eg;
export SDL_LINUX_JOYSTICK="‘JOYSTICK DEVICE NAME’ AXES HATS BALLS"
export SDL_LINUX_JOYSTICK="‘WingMan Extreme Digital 3D’ 4 1 0"
For evdev only USB devices that report their components correctly
have their hats mapped (I believe).
Still in SDL_sysjoystick.c, I’ve understood that a joystick is configured
with either JS_ConfigJoystick() or EV_ConfigJoystick() (old/new interface
?), depending on the result of this big instruction :
(ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) >= 0) &&
(ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit) >= 0) &&
(ioctl(fd, EVIOCGBIT(EV_REL, sizeof(relbit)), relbit) >= 0)
And I’ve checked, for my joystick, the above instructions returns FALSE.
So my question is : what does this instuction above check ? Does my joystick
driver has to be special to use the new interface (it has been coded based
on the other kernel’ drivers, so should be quite “standard” in its
structure/function calls) ?
It checks that the device (/dev/input/event*) is an evdev by testing the
ioctls which return -1 for invalid (?) and 0-X for the number of
buttons, absolute axis, and relative axis.
Has anyone managed to get joystick hat support on Linux whatsoever ?
Yes.
I know it’s not a very big deal and I could get along with the 2 axes and a
few hacks but, still, I’d like to understand
Try disabling the evdev as above and setting the enviroment or adding
to the special_joystick table.
Thanks a lot.
Depends on knowing how the XBox controller is reported (normal USB
device?) with the digital pad being reported as a normal axis and not
a USB device hat or something like that.On Thu, 2003-07-17 at 10:42, Damiano wrote:
–
Alan.
“One must never be purposelessnessnesslessness.”
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030717/d0da3bc6/attachment.pgp