I dug out my Radio Shack USB to Gameport adapter and a CH Mach III Joystick but was having problems getting it calibrated.

There's two joystick systems, evdev and regular joydev. SDL works with evdev and NOT the regular /dev/js0 joysticks.

There's two packages you need, joystick and jstest-gtk.

Here's a tip that I've found really useful: TAB completion with apt install, type "sudo apt install" and "joy" and hit TAB and you get all the packages that start with joy.

Package: joystick (1:1.7.1-1)

set of testing and calibration tools for joysticks

Some useful tools for using joysticks:

evdev-joystick(1) - joystick calibration tool
ffcfstress(1) - force-feedback stress test
ffmvforce(1) - force-feedback orientation test
ffset(1) - force-feedback configuration tool
fftest(1) - general force-feedback test
jstest(1) - joystick test
jscal(1) - joystick calibration tool

Package: jstest-gtk (0.1.1~git20160825-4) [universe]
joystick testing and configuration tool

So the problem is that jstest and jstest-gtk only work with the regular joystick calibrations. However, it's very useful to find out the ranges that you're getting.

The calibration for evdev is done with evdev-joystick.

My Radio Shack adapter only gives values for 0 to approximately 128 which is only in the upper quadrant of the full range of 0 to 255.

So I can make it work with

evdev-joystick --e /dev/input/by-id/usb-079d_USB_ADAPTOR-event-joystick --axis 0 --maximum 128  --minimum 0
evdev-joystick --e /dev/input/by-id/usb-079d_USB_ADAPTOR-event-joystick --axis 1 --maximum 120  --minimum 0

but what's kind of annoying is that I have to do this every time I plug the joystick in.

There's some rules in /lib/udev/rules.d that handle when joysticks get plugged in.

So if we edit this:

sudo nano /lib/udev/rules.d/60-joystick.rules

ACTION!="add", GOTO="joystick_rules_end"
KERNEL!="js*", GOTO="joystick_rules_end"

# Restore any stored calibration for the device
RUN+="/usr/bin/jscal-restore %E{DEVNAME}"
RUN+="/home/myhomedir/myjoystick"            #  added this line, replace myhomedir with your homedir

Make a file in you homedir called myjoystickcal and do a "chmod a+x myjoystickcal"

evdev-joystick --e /dev/input/by-id/usb-079d_USB_ADAPTOR-event-joystick --axis 1 --maximum 120  --minimum 0
evdev-joystick --e /dev/input/by-id/usb-079d_USB_ADAPTOR-event-joystick --axis 0 --maximum 128  --minimum 0
date > /home/myhomedir/myjoystickcalruntime

I stuck the date command in order to make sure that the script was getting executed. It's not really necessary.

If you want to see a notification in ubuntu you can add:

sudo -u myusername env  DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" notify-send "USB ADAPTOR calibration run"

or even use osd_cat (package xosd-bin) to make visible onscreen bars upon plugin:

sudo -u myusername env DISPLAY=":0" osd_cat -b percentage -P 50 &
sudo -u myusername env DISPLAY=":0" osd_cat -b percentage -P 50 -p bottom &

or make it play a sound upon plugin:

play -q /usr/share/sounds/sound-icons/guitar-13.wav

Lots of good info at: