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

From DCS World Wiki - Hoggitworld.com
m (Update permissions section)
m (Continue working on permission example)
Line 8: Line 8:
 
==== Permissions ====
 
==== Permissions ====
 
If your joystick isn't appearing in DCS, check if you have permission to access it. Most modern joysticks are available through the [https://docs.kernel.org/input/input.html#evdev evdev] interface and will appear as a device in <code>/dev/input/event*</code>. To see what device is mapped to your joystick, list the files inside <code>/dev/input/by-id/</code> to see the names of each device mapped to a <code>/dev/input/event*</code> entry.
 
If your joystick isn't appearing in DCS, check if you have permission to access it. Most modern joysticks are available through the [https://docs.kernel.org/input/input.html#evdev evdev] interface and will appear as a device in <code>/dev/input/event*</code>. To see what device is mapped to your joystick, list the files inside <code>/dev/input/by-id/</code> to see the names of each device mapped to a <code>/dev/input/event*</code> 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 <code>/dev/input/event0</code> and that the pedals are linked to <code>/dev/input/event1</code>.
 +
<nowiki>
 +
$ 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</nowiki>
 +
 +
When we look at the permissions of the events, we can see '''event0''' is marked with a plus symbol, but '''event1''' isn't.
 +
 +
<nowiki>
 +
$ 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</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'''
 +
 +
'''/dev/input/event0:'''
 +
<nowiki>
 +
$ getfacl event0
 +
 +
# file: event0
 +
# owner: root
 +
# group: input
 +
user::rw-
 +
user:john:rw-
 +
group::rw-
 +
mask::rw-
 +
other::---</nowiki>
 +
 +
'''/dev/input/event1:'''
 +
<nowiki>
 +
$ getfacl event1
 +
 +
# file: event1
 +
# owner: root
 +
# group: input
 +
user::rw-
 +
group::rw-
 +
other::---</nowiki>
  
 
=== Virtual Inputs ===
 
=== Virtual Inputs ===

Revision as of 09:43, 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 Arch Linux Wiki 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::---

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.