Ubuntu Joystick configuration

For discussion of ports to POSIX based systems, especially using GNUStep.

Moderators: winston, another_commander, Getafix

Post Reply
Exeter
Average
Average
Posts: 10
Joined: Mon Dec 10, 2007 6:22 pm
Location: Exeter, UK
Contact:

Ubuntu Joystick configuration

Post by Exeter »

I'm not having any luck getting the joystick to work with Oolite under Ubuntu 7.10

The Joystick Configurator - jsconfigurator - software appears to work correctly. Everything responds and the on screen results are consistent with how I would expect the joystick to configure, although I cannot tell what it actually does with the saved configuration file.

Oolite correctly identifies the joystick - Wingman Force 3D - but will only acknowledge the buttons and not any of the directional axis.

Oolite 1.65 did at one point accept input from the 3rd Axis (rudder control) but even that was only a one session occurrence. No further luck with directional controls under either 1.65 (or now 1.69).

No luck with joy2key either. Apparently because it expects the joystick to be /dev/js0 whilst it actually appears to be /dev/input/js0.

It's fun being fourteen again for a few hours of an evening but I'm finding the combination of a forward Pulse Laser and keyboard directional controls an absolute nightmare.

HELP!
User avatar
winston
Pirate
Pirate
Posts: 731
Joined: Mon Sep 27, 2004 10:21 pm
Location: Port St. Mary, Isle of Man
Contact:

Post by winston »

The joystick control is abstracted via SDL - do you have any other joystick-using programs that use SDL that you can check it out with?

My memory is a bit hazy on how I made it recognise the analogue axes, I'll have to look at the code - IIRC, it looks for a near full deflection to recognise which axis is being moved - it may be that it's looking for too much of a deflection for some sticks.
Exeter
Average
Average
Posts: 10
Joined: Mon Dec 10, 2007 6:22 pm
Location: Exeter, UK
Contact:

Post by Exeter »

Using jscalibrator in Logical mode gives the following deflections:
  • Axis 0: 79 - 173 (Left - Right)
  • Axis 1: 73 - 174 (Forward/Dive - Back/Climb)
  • Axis 2: 5 - 209 (Rudder: Anti-clockwise - Clockwise)
  • Axis 3: 34 - 180 (Throttle Max - Minimum)
  • Axis 4: n/a
  • Axis 5: n/a
I think this is the relevant info but the full calibration file is below just in case.

As an alternative, do I need to calibrate via the Oolite menu or can I just write the information into the game file - /home/GNUstep/.GNUstepDefaults - as I notice this contains the calibration info that Oolite will accept?



.joystick in my home folder:

Code: Select all

# Joystick calibration file.
# Generated by Joystick Calibrator version 1.5.6.
#
BeginJoystick = /dev/input/js0
    Name = Logitech Inc. WingMan Force 3D
    LastCalibrated = 1197172138
    BeginAxis = 0
        Minimum = 74
        Center = 125
        Maximum = 172
        NullZone = 12
        Tolorance = 0
        CorrectionLevel = 0
        DeadZoneMinimum = 131
        DeadZoneMaximum = 131
        CorrectionalCoefficientMinimum1 = 0.000000
        CorrectionalCoefficientMaximum1 = 0.000000
        CorrectionalCoefficientMinimum2 = 0.000000
        CorrectionalCoefficientMaximum2 = 0.000000
    EndAxis
    BeginAxis = 1
        Minimum = 72
        Center = 114
        Maximum = 182
        NullZone = 17
        Tolorance = 0
        Flip
        CorrectionLevel = 0
        DeadZoneMinimum = 115
        DeadZoneMaximum = 115
        CorrectionalCoefficientMinimum1 = 0.000000
        CorrectionalCoefficientMaximum1 = 0.000000
        CorrectionalCoefficientMinimum2 = 0.000000
        CorrectionalCoefficientMaximum2 = 0.000000
    EndAxis
    BeginAxis = 2
        Minimum = 5
        Center = 138
        Maximum = 209
        NullZone = 33
        Tolorance = 0
        CorrectionLevel = 0
        DeadZoneMinimum = 140
        DeadZoneMaximum = 140
        CorrectionalCoefficientMinimum1 = 0.000000
        CorrectionalCoefficientMaximum1 = 0.000000
        CorrectionalCoefficientMinimum2 = 0.000000
        CorrectionalCoefficientMaximum2 = 0.000000
    EndAxis
    BeginAxis = 3
        Minimum = 32
        Center = 112
        Maximum = 180
        NullZone = 0
        Tolorance = 0
        Flip
        CorrectionLevel = 0
        DeadZoneMinimum = 106
        DeadZoneMaximum = 106
        CorrectionalCoefficientMinimum1 = 0.000000
        CorrectionalCoefficientMaximum1 = 0.000000
        CorrectionalCoefficientMinimum2 = 0.000000
        CorrectionalCoefficientMaximum2 = 0.000000
    EndAxis
    BeginAxis = 4
        Minimum = -1
        Center = 0
        Maximum = 1
        NullZone = 0
        Tolorance = 0
        IsHat
        CorrectionLevel = 0
        DeadZoneMinimum = 0
        DeadZoneMaximum = 0
        CorrectionalCoefficientMinimum1 = 0.000000
        CorrectionalCoefficientMaximum1 = 0.000000
        CorrectionalCoefficientMinimum2 = 0.000000
        CorrectionalCoefficientMaximum2 = 0.000000
    EndAxis
    BeginAxis = 5
        Minimum = -1
        Center = 0
        Maximum = 1
        NullZone = 0
        Tolorance = 0
        Flip
        IsHat
        CorrectionLevel = 0
        DeadZoneMinimum = 0
        DeadZoneMaximum = 0
        CorrectionalCoefficientMinimum1 = 0.000000
        CorrectionalCoefficientMaximum1 = 0.000000
        CorrectionalCoefficientMinimum2 = 0.000000
        CorrectionalCoefficientMaximum2 = 0.000000
    EndAxis
EndJoystick
User avatar
winston
Pirate
Pirate
Posts: 731
Joined: Mon Sep 27, 2004 10:21 pm
Location: Port St. Mary, Isle of Man
Contact:

Post by winston »

Hmm. That's interesting. SDL returns a signed 16 bit number for joystick axes. With my Freedom 2.4 wireless stick, I get -32768 to 32767 as the stop-to-stop values for all axes. If yours is only returning an unsigned 8 bit number I can see why that might be a problem, it's like wiggling my joystick about 1/10th of a degree :-)

Does jscalibrator use SDL?

Note, in the meantime, you can use the mouse for ship control in full screen mode, it's a lot better than the keyboard. Imagine the mouse to be the top of the joystick and you'll be able to get on with it.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Also, knowing that you can right-click to re-centre the mouse is rather helpful. And that you need to press shift-M to activate mouse control.
Exeter
Average
Average
Posts: 10
Joined: Mon Dec 10, 2007 6:22 pm
Location: Exeter, UK
Contact:

Post by Exeter »

Don't have a mouse, only a trackball and it's a complete non-starter for flight controls.

I have no idea about SDL. The homepage for jscalibrator seems to be quite well documented if you understand this type of thing (which I do not) and can be found at: http://wolfpack.twu.net/libjsw/
Exeter
Average
Average
Posts: 10
Joined: Mon Dec 10, 2007 6:22 pm
Location: Exeter, UK
Contact:

Post by Exeter »

winston wrote:
Does jscalibrator use SDL?
Okay, with nobody leaping forward with the magic solution, I've done some additional digging following your SDL question and come up with this...
https://bugs.launchpad.net/ubuntu/+bug/17245

Currently there is no default way to configure a joystick in Ubuntu or Gnome.

...

Part of the difficulty is that there are several methods used to connect joysticks. jscalibrator provides the necessary configuration for those programs that link against libjsw2, but does not provide for other joystick access systems. I believe the most common method currently used in Ubuntu is the sdl input libraries, although the xserver-xorg-input-joystick package may lead to more access mitigated by X.
... and, perhaps much more promisingly, this ...
http://ubuntuforums.org/showthread.php? ... t=joystick

jscalbrator is your problem ... Unless you're using Kubuntu (the in built Kubuntu version seems Ok), it has this nice little habit of disabling the directional controls of game input devices, although it reads them itself as being Ok. You need to remove it completely, including its configuration.
I'll try removing jscalibrator and see if that produces results.
Exeter
Average
Average
Posts: 10
Joined: Mon Dec 10, 2007 6:22 pm
Location: Exeter, UK
Contact:

Post by Exeter »

I have, as far as I can tell, removed jscalibrator and everything associated with it. The only joystick related package remaining on the system appears to be xserver-xorg-input-joystick.

Very limited success.

Oolite joystick calibration now consistently responds to Axis 3 (rudder) and Axis 4 (throttle) but neither produce a full deflection in game. The throttle control (0-100) returns in-game thrust settings roughly between 30% and 90%. Setting axis 3, rudder, for roll allows me to get the in-game roll indicator to about 85% in either direction.

Still no sign of any Axis 1 (X) or Axis 2 (Y) movement.

Also no sign of any response to the Hat switch.

Stuck again.

Any ideas or suggestions for a particular game that might provide a useful comparison?
Xubuntu 7.10 - Oolite 1.70
User avatar
winston
Pirate
Pirate
Posts: 731
Joined: Mon Sep 27, 2004 10:21 pm
Location: Port St. Mary, Isle of Man
Contact:

Post by winston »

Hrm. The bad news is that my assumption that USB joysticks would always give some reasonable values, and the bad old days of joystick calibration were gone - were obviously wrong. That means don't expect your joystick to work tomorrow because it now needs code to be written (and I've been suffering from too-many-projectsitus for about a year now).

As for hat switches it depends how they work. Some might be analogue axes, and some might be implemented as switches. I don't remember how the code was written with regard to enumerating the buttons/axes on a joystick.

Also note there's a joystick attenuator setting in Oolite (assignable to a joystick button) for fine control, although it doesn't seem like you're accidentally using that (all it does is limit the amplitude of stop-to-stop input on the X/Y axis, allowing you more pixel-perfect control, so you have half a fighting chance at hitting a far-off pirate).
Exeter
Average
Average
Posts: 10
Joined: Mon Dec 10, 2007 6:22 pm
Location: Exeter, UK
Contact:

Post by Exeter »

Not directly related to the Oolite problem but this solves one of the earliest issues I encountered when trying to calibrate the joystick.
http://ubuntuforums.org/showthread.php?t=404149

...some applications look for "/dev/js0" but ubuntu puts the game controller at "/dev/input/js0". To solve many problems you can link these by typing this in a terminal:

Code: Select all

sudo ln -s /dev/input/js0 /dev/js0
"sudo" means do as root, "ln" makes a link, -s makes it symbolic
Short term, can someone suggest a (preferably cheap) joystick that is known to work with the existing software (1.65 or 1.70)? Doesn't have to be anything fancy, just so long as it will point the ship at a target and fire the laser.
Xubuntu 7.10 - Oolite 1.70
magamo
Competent
Competent
Posts: 45
Joined: Sat Feb 25, 2006 7:07 pm

Post by magamo »

I use a Logitec Wingman Extreme Digital 3D through USB (It is a gameport model, with a USB adaptor) just fine with Oolite. It doesn't quite allow me to get my ship all the way out to the edge of its limits (Meaning that to miss-jump, I have to use the keyboard) but it is VERY playable for me. I would make certain that there are absolutely no references to this 'jsconfigurator' or 'jscalibrator' in your start up scripts, running processes (be certain to kill any daemons it had loaded), or configurations in your home, or global directories.

Once all that is done, I suggest simply unplugging the joystick, rmmoding the appropriate module. (Check your /etc/modules.conf, or whatever mechanism ubuntu uses to control modules these days to make certain that it is not passing any strange arguments to the module at insertion) then reconnect the joystick (You may have to re-modprobe the appropriate module at this point, however, hotplug SHOULD do that on its own.) The joystick driver should be reinitialized with sane defaults, and all should be well. You also may want to try and find a copy of the older package 'jsprogs' which should be able to calibrate the joystick directly, in the proper driver model.

If all this has failed, make certain that the joystick works on another system, I have had so many issues with Logitech joysticks breaking in VERY strange ways over the years, that after this, my third one wigging out (It's 3rd Axis, the 'torso twist'/rudder is constantly reporting a fluxuating value, and has since three days after I bought it) I am never going to buy another logitech gaming device again, if I can avoid it.
Exeter
Average
Average
Posts: 10
Joined: Mon Dec 10, 2007 6:22 pm
Location: Exeter, UK
Contact:

Post by Exeter »

Still fumbling my way through the Linux maze...

locate jscal returned the following:
/usr/share/app-install/desktop/jscalibrator.desktop
/var/cache/apt/archives/jscalibrator_1%3a1.5.6-0ubuntu1_i386.deb
Now deleted.

I can't see anything in the startup scripts that refers to the joystick (but I really don't know where I'm supposed to be looking or what precisely for).

Xubuntu appears to respond to the joystick being plugged in by activating the joydev module.

Further digging...
"How to Set-up a gameport,gamepad or joystick in Ubuntu"
http://swik.net/Ubuntu/Only+Ubuntu/How+ ... buntu/3iqr
...
List of gameports, gamepads/joysticks and their corresponding commands
...
Analog joysticks and gamepads (Most gamepads and joysticks, especially generic ones, work well with this one)
sudo modprobe analog
...
Logitech ADI digital joysticks and gamepads
sudo modprobe adi
locate joy returns amongst a huge long list of files that appear to relate to other joysticks (and icons)...
/usr/lib/directfb-0.9.25/inputdrivers/libdirectfb_joystick.so
/usr/src/linux-headers-2.6.22-14/include/linux/joystick.h
...
/usr/src/linux-headers-2.6.22-14-generic/include/config/joystick/adi.h
/usr/src/linux-headers-2.6.22-14-generic/include/config/joystick/analog.h
...
/usr/src/linux-headers-2.6.22-14-generic/include/config/input/joydev.h
/usr/src/linux-headers-2.6.22-14-generic/include/config/input/joystick.h
/usr/src/linux-headers-2.6.22-14-generic/include/linux/joystick.h
...
/lib/modules/2.6.22-14-generic/kernel/drivers/input/joydev.ko
...
/lib/modules/2.6.22-14-generic/kernel/drivers/input/joystick/adi.ko
/lib/modules/2.6.22-14-generic/kernel/drivers/input/joystick/analog.ko
Logitech's ADI and the Analogue alternative both appear to be present.

So, is there anything in the above that helps determine more precisely what I should be rmmoding (research indicates this means: remove module), checking for strange arguments, etc...?

Thank you all for your help so far (but I am a bit overwhelmed by all the new technobabble).
Xubuntu 7.10 - Oolite 1.70
Post Reply