Close

1st joystick in 30 years

A project log for Silly software wishlist

Motivation to do some software projects by writing them down.

lion-mclionheadlion mclionhead 08/04/2018 at 19:410 Comments
 The last one was a Toys R Us clearance item which had only 1 button & 2 binary axes.   Just an analog joystick in 1985 was an impossible dream.  This one was somewhat better.

Stenciling the X took 3 hours. A custom decal would cost more than the joystick. The modern 2 pawed gamepad has all but replaced dedicated joysticks, but it's the 1 piece of retro tech the lion kingdom really wanted.

It's a precise, immersive control that could realistically feel like it was controlling 12 million lbs of thrust. It's not as buttery smooth as a high end RC controller. It has an annoying detent in the throttle center position, but it's more than a lion had, 30 years ago.

The answer is no.  Linux doesn't support the Thrustmaster T.Flight Hotas.   Based on the kernel source code, no-one has used a joystick on Linux since their linux stocks crashed in 2001.   The kernel detects it in drivers/hid/hid-core.c as a Gamepad.  The values are filtered somewhere else in the hid directory before going to the /dev/input/event16 file.  All the button & 2 stick values get through, but throttle & 2 rudder controls don't.

 Godot acquires data from the /dev/input/event16 file in platform/x11/joypad_linux.cpp.  It polls the /dev/input directory every second for anything that could be a joystick & extracts events in JoypadLinux::process_joypads.

The easiest solution was hacking joypad_linux.cpp to read /dev/hidraw directly.  This spits out 64 byte packets with all the analog values as 8 bits in various positions.

The edited joypad_linux.cpp file is here https://cdn.hackaday.io/files/1380505906331200/joypad_linux.cpp

The goal 1/2 year ago was just to control some engines with a joystick.  If the lion kingdom could get that far, it would be a revolution in spaceflight.  The remaneing pieces finally came together.  It was surprising how good the minimal flame looked.  The throttle detent was actually useful for knowing where engine cutoff is, but limits the useful range to 1/2.  

Discussions