Gamepad Pass-through

Workspaces supports passing through up to 4 gamepads into the Kasm sessions. Participants in shared sessions may also pass through gamepads.


Configuration

To enable this feature:

  1. Set the allow_kasm_gamepad Group Setting to true prior to launching the session.

  2. Launch a Kasm session.

    Tip

    The kasmweb/ubuntu-focal-desktop and kasmweb/ubuntu-jammy-desktop images have several gamepad testing utilities included that may help with troubleshooting. The :develop tag or versioned tags >= to :1.12.0 may be used.

    • Use jstest-gtk to test the udev interface.

    • Use gamepadtool to test the sdl2 interface. Available on amd64 images only.

  3. Open the control panel on the left side of the session, and select Gamepads.

  4. Press any button on the connected Bluetooth or USB gamepad(s). If the browser detects the gamepad(s), an entry will be listed for each device. A dropdown will be visible next to each device representing the virtual device port/index ( 0 - 3 ) mapped within the session. These can be changed as desired.

    ../_images/new_connection.webp

    Gamepad Connection

    Tip

    Gamepads may not be visible if they are in use by another program, browser, or tab. It may be necessary to close those programs then re-open the current browser. It may be helpful to verify the gamepads can be seen using other browser-based gamepad testing utilities

More Details

This feature works by connecting to the local USB or Bluetooth gamepads via the browser’s GamepadAPI, then passing the gamepad events (button presses) into virtual devices mapped inside the container. The virtual gamepads should be accessible by programs within the session container supporting udev or sdl2 interfaces.

A default sld2 mapping environment variable is defined within the Workspaces Images and may be overridden if desired either by creating a Custom Image, or by updating the variable via Docker Run Config.

SDL_GAMECONTROLLERCONFIG="030000005e040000be02000014010000,XInput Controller,platform:Linux,a:b0,b:b1,x:b2,y:b3,back:b8,guide:b16,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7"

The virtual gamepad devices are exposed inside the sessions using Xbox controller attributes and use a standard mapping in line with the GamepadAPI Standard Mapping Spec.

Known Issues

  • Chromium based browsers running inside the Kasm sessions will only pick up a single gamepad running on port/index 3.

  • L2 and R2 triggers are mapped as buttons that support being pressed/not pressed instead of an analog axis.

  • Rumble/Haptic feedback is not supported.

  • The feature is not supported on Docker in Docker (DinD) installs including TrueNAS and Unraid integrations.

  • The feature is not supported on older linux distros/kernels such as those provided by CentOS 7.