Difference between revisions of "User:Sodaplayer/linux-sandbox"

From DCS World Wiki - Hoggitworld.com
m (Peripherals: Correct name)
(Example)
Line 27: Line 27:
 
crw-rw----  1 root input ... Dec 13 13:37 event1</nowiki>
 
crw-rw----  1 root input ... Dec 13 13:37 event1</nowiki>
  
The plus symbol means that there's additional permissions being managed by an access control list (ACL). We can compare the ACLs for both devices and confirm a difference. The user, '''john''' has access to '''event0''', but not '''event1'''
+
The plus symbol means that there's additional permissions being managed by an access control list (ACL). We can compare the ACLs for both devices and confirm a difference. The user, '''john''' has access to '''event0''', but not '''event1'''.
  
 
'''/dev/input/event0:'''
 
'''/dev/input/event0:'''
Line 52: Line 52:
 
group::rw-
 
group::rw-
 
other::---</nowiki>
 
other::---</nowiki>
 +
 +
We can fix this with a '''udev''' rule.
 +
 +
'''/etc/udev/rules.d/70-saitek-rudder.rule'''
 +
<nowiki>
 +
SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"</nowiki>
 +
 +
Use <code>lsusb</code> to get the values for ''idProduct'' and ''idVendor''.
 +
 +
$ lsusb
 +
Bus 001 Device 014: ID '''06a3:0763''' Saitek PLC Pro Flight Rudder Pedals
  
 
=== Virtual Inputs ===
 
=== Virtual Inputs ===

Revision as of 10:09, 27 December 2022

Peripherals

There are other good resources for configuring and troubleshooting joysticks on Linux. This section will be focused on being a streamlined reference for getting peripherals working through Wine/Proton and cover common issues.

See also: The ArchWiki Gamepad Article for how joysticks work in Linux

Troubleshooting

Permissions

If your joystick isn't appearing in DCS, check if you have permission to access it. Most modern joysticks are available through the evdev interface and will appear as a device in /dev/input/event*. To see what device is mapped to your joystick, list the files inside /dev/input/by-id/ to see the names of each device mapped to a /dev/input/event* entry.

Example

In this example, the user has a Logitech Extreme 3D Pro (X3D) and a pair of Saitek Pro Flight Rudder Pedals. They're able to use the X3D, but are unable to see the pedals in game.

Here, you can see that the X3D is linked to /dev/input/event0 and that the pedals are linked to /dev/input/event1.

$ ls -l /dev/input/by-id | grep event

... Dec 13 13:37 usb-Logitech_Logitech_Extreme_3D-event-joystick -> ../event0
... Dec 13 13:37 sb-Saitek_Saitek_Pro_Flight_Rudder_Pedals-event-if00 -> ../event1

When we look at the permissions of the events, we can see event0 is marked with a plus symbol, but event1 isn't.

$ ls -l /dev/input | grep event

crw-rw----+ 1 root input ... Dec 13 13:37 event0
crw-rw----  1 root input ... Dec 13 13:37 event1

The plus symbol means that there's additional permissions being managed by an access control list (ACL). We can compare the ACLs for both devices and confirm a difference. The user, john has access to event0, but not event1.

/dev/input/event0:

$ getfacl event0

# file: event0
# owner: root
# group: input
user::rw-
user:john:rw-
group::rw-
mask::rw-
other::---

/dev/input/event1:

$ getfacl event1

# file: event1
# owner: root
# group: input
user::rw-
group::rw-
other::---

We can fix this with a udev rule.

/etc/udev/rules.d/70-saitek-rudder.rule

SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"

Use lsusb to get the values for idProduct and idVendor.

$ lsusb
Bus 001 Device 014: ID 06a3:0763 Saitek PLC Pro Flight Rudder Pedals

Virtual Inputs

You may want to bind joystick controls to mouse buttons and key-presses. In Linux, the uinput module can be used to create virtual keyboards, mouses, and joysticks inputs.

Useful Applications

Some applications can read joystick inputs and configure virtual devices:

  • AntiMicroX - Maps controllers to mouse and keyboard buttons.
  • MoltenGamepad - Allows you to combine or split controllers into virtual gamepads.