Solved Flightgear can't see Thrustmaster Joystick

I can't tell if it's a FreeBSD or Wayland related issue:

FlightGear 3.19 from ports
sway 1.9 from ports
FreeBSD 14.0-RELEASE, fresh install.

Flightgear/js_demo can't find the Joystick:
sudo dmesg | grep Joystick
hgame0: <Thrustmaster T.Flight Hotas X Joystick> on hidbus1

This is probably a pretty simple solution, but I'm missing something here and I can't see it.

Plug, unplug, reboot done.

Google didn't provide anything useful so far, including FreeBSD forums, which mostly cover issues like detection or calibration.

Any help would be much appreciated.
 
For an arcade stick I had to add a /usr/local/etc/devd/dashine.conf that sets the right permissions on the USB device. Or else it won't get detected and isn't usable. You might need something similar.

Code:
cat /usr/local/etc/devd/dashine.conf
notify 100 {
  match "system"        "USB";
  match "subsystem"     "INTERFACE";
  match "type"          "ATTACH";
  match "vendor"        "0x045e";
  match "product"       "0x028e";
  action "chgrp operator /dev/$cdev; chmod 660 /dev/$cdev";
};

This specifically looks for a matching vendor and product, then sets the group and permissions (my user is a member of the operator group).
 
FlightGear likely wants Linux-style evdev joysticks, so to complement SirDice's advice:
JSON:
$ cat /etc/devfs.rules
[localrules=10]
add path 'input/event*' group video

$ cat /etc/devd/hgame.conf
attach 200 {
    device-name "hgame[0-9]+";
    action "chmod g+rw `sysctl kern.evdev.input | awk -F: /$device-name/' { print $1 }' | sed 's,kern\.evdev\.input\.\([[:digit:]]*\)\.phys,/dev/input/event\1,'`";
};

$ sysrc devfs_system_ruleset=localrules
$ service devfs restart
$ service devd restart
$ usbconfig reset # or just detach/attach to trigger devd
 
For an arcade stick I had to add a /usr/local/etc/devd/dashine.conf that sets the right permissions on the USB device. Or else it won't get detected and isn't usable. You might need something similar.

Code:
cat /usr/local/etc/devd/dashine.conf
notify 100 {
  match "system"        "USB";
  match "subsystem"     "INTERFACE";
  match "type"          "ATTACH";
  match "vendor"        "0x045e";
  match "product"       "0x028e";
  action "chgrp operator /dev/$cdev; chmod 660 /dev/$cdev";
};

This specifically looks for a matching vendor and product, then sets the group and permissions (my user is a member of the operator group).
Thanks for the suggestion.
This is what I have but still no success:
cat /usr/local/etc/devd/hotas.conf
Code:
notify 100 {
  match "system"        "USB";
  match "subsystem"     "INTERFACE";
  match "type"          "ATTACH";
  match "vendor"        "0x044f";
  match "product"       "0xb108";
  action "chgrp operator /dev/$cdev; chmod 0660 /dev/$cdev";
};
 
FlightGear likely wants Linux-style evdev joysticks, so to complement SirDice's advice:
JSON:
$ cat /etc/devfs.rules
[localrules=10]
add path 'input/event*' group video

$ cat /etc/devd/hgame.conf
attach 200 {
    device-name "hgame[0-9]+";
    action "chmod g+rw `sysctl kern.evdev.input | awk -F: /$device-name/' { print $1 }' | sed 's,kern\.evdev\.input\.\([[:digit:]]*\)\.phys,/dev/input/event\1,'`";
};

$ sysrc devfs_system_ruleset=localrules
$ service devfs restart
$ service devd restart
$ usbconfig reset # or just detach/attach to trigger devd
Unfortunately both solutions didn't work.
❱ js_demo
Joystick test program.
~~~~~~~~~~~~~~~~~~~~~~
Joystick 0 not detected
Joystick 1 not detected
Joystick 2 not detected
Joystick 3 not detected
Joystick 4 not detected
Joystick 5 not detected
Joystick 6 not detected
Joystick 7 not detected

For testing purposes only, and to rule out a defective piece of hardware, I installed VirtualBox, attached the controller to the VM and I was able to detect it and configure it.
 
Thanks to Ganael Laplanche (FGFS maintainer):



Therefore the solution is to install uhidd and follow the wiki: https://wiki.freebsd.org/uhidd

Could you go into more details please?

I tried following the wiki for uhidd, but FG still didn't see my joystick (if I chown the /dev/input event without uhidd I got the joystick showing on a browser gamepad test website though). I'm on FreeBSD 14.1 and have more details on this thread: https://forums.freebsd.org/threads/usb-joystick-with-flightgear.94855/

I'm using fgjs to check for joysticks but not even the game itself listed my joystick, nor any devices (on Linux my mouse and even keyboard would show under the joysticks config panel drop-down :p). I want to use a Sidewinder Precision Pro USB joystick.
 
You might want to follow the HOWTO on the wiki.

Quick and dirty:
  1. pkg install uhidd (or compile from ports)
  2. sudo ln -s /dev/uvhid0 /dev/uhid0
  3. sudo ln -s /dev/uvhid1 /dev/uhid1
  4. sudo uhidd -d -kmohu /dev/ugenX.Y &&> /dev/null
Replace X.Y by your device as in usbconfig list

The cleanest and more elegant solution however, is the one you've found already:
uhidd -h -H 'uhid' -u '/dev/ugenX.Y'
 
I have set up flightgear with uhid devices as suggested above. They work mostly as expected. My mappings are correct for individual axes and buttons. However, every ~10s or so when I move the elevator and ailerons simultaneously, all mapped axes and buttons activate at once to full deflection. After a couple of seconds, the axes return to where I'd expect them to be. Using individual axes works as expected, and it doesn't seem to be a null zone thing.

I have used this same controller with flightgear on my linux box and it works just fine, so I figured this is more of an issue with how FreeBSD implements control inputs via uhid. js_demo works just fine without the blips. Anyone else have a similar experience?
 
Back
Top