4

Is there a way to emulate a joystick in Ubuntu, i.e. create a device that looks like a joystick but is actually driven from some userspace program? And ideally the device would be recognized by Wine?

I'd like to play some Tie Fighter 95, which won't start without a joystick, even though I'd never actually need the actual joystick (keyboard and mouse provide sufficient input). I used to use NTPAD in an old Windows setup to provide a fake joystick; now I'd like to do the same in Linux.

Kerrek SB
  • 153
  • 2
  • 6

1 Answers1

1

Antimicro (mentioned in other answer) looks promising, but personally I have achieved decent results with xboxdrv (haven't found a way to get analog sticks to work, but everything else works great). The following example configuration will map various keyboard buttons to Xbox controller button set (assuming /dev/input/event0 corresponds to keyboard on your machine):

# xboxdrv --evdev-no-grab --dpad-only --device-name="Virtual XPAD" --no-extra-devices --no-extra-events --trigger-as-button --dpad-as-button --evdev-keymap "KEY_RIGHT=b,KEY_LEFT=x,KEY_DOWN=a,KEY_UP=y,KEY_LEFTBRACE=lb,KEY_RIGHTBRACE=rb,KEY_SEMICOLON=start,KEY_APOSTROPHE=back" --evdev="/dev/input/event0"

Both xboxdrv and antimicro use low-level uinput framework (later needs a configuration switch to enable it), so they are compatible Wine and most other Linux applications, even Wayland ones.