protonscr

Proton SDL adds mainboard LED controllers as gaming input devices

protonopen
ValveSoftware/Proton#5420 · opened 2021-12-18 by kakra · updated 2021-12-18 · 0 comments · github
Kkakra 2021-12-18 github

Multiple games are affected, usually Ubisoft titles, also Horizon Zero Dawn.

009c:trace:plugplay:try_add_device Found sdl device 0x0 (vid 26ce, pid 01a2, version 272, serial L"03000000ce260000a201000010010000")
009c:trace:plugplay:__controller_hack_sdl_vid_pid_override (*vid = 26ce, *pid = *01a2
009c:trace:plugplay:__controller_hack_sdl_name_override vid = 26ce, pid = 01a2, *name = "ASRock LED Controller"
009c:trace:plugplay:bus_create_hid_device (L"SDLJOY", 26ce, 01a2, ffff, 272, 0, L"03000000ce260000a201000010010000", 0, 0x7f7bb90fdac0, 344)

I think SDL trying to use Linux hidraw devices as wildcard gaming devices is just bad - it should not do that. I don't even know how it thinks this as input reports... Or maybe it's using evdev, I'm not sure but evtest actually does not see input events from it:

# evtest
No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event6:      ASRock LED Controller
/dev/input/event9:      Thrustmaster TWCS Throttle
/dev/input/event10:     Thrustmaster T.16000M
/dev/input/event11:     Microsoft X-Box One S pad
Select the device event number [0-11]: 6
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x26ce product 0x1a2 version 0x110
Input device name: "ASRock LED Controller"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 103 (KEY_UP)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 108 (KEY_DOWN)
    Event code 116 (KEY_POWER)
    Event code 138 (KEY_HELP)
    Event code 139 (KEY_MENU)
    Event code 142 (KEY_SLEEP)
    Event code 143 (KEY_WAKEUP)
    Event code 148 (KEY_PROG1)
    Event code 174 (KEY_EXIT)
    Event code 227 (KEY_SWITCHVIDEOMODE)
    Event code 314 (BTN_SELECT)
    Event code 315 (BTN_START)
    Event code 353 (KEY_SELECT)
    Event code 356 (KEY_POWER2)
    Event code 408 (KEY_RESTART)
    Event code 438 (KEY_CONTEXT_MENU)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value      0
      Min        0
      Max      255
    Event code 1 (ABS_Y)
      Value      0
      Min        0
      Max      255
    Event code 2 (ABS_Z)
      Value      0
      Min        0
      Max      255
    Event code 3 (ABS_RX)
      Value      0
      Min        0
      Max      255
    Event code 4 (ABS_RY)
      Value      0
      Min        0
      Max      255
    Event code 5 (ABS_RZ)
      Value      0
      Min        0
      Max      255
    Event code 6 (ABS_THROTTLE)
      Value      0
      Min        0
      Max      255
    Event code 7 (ABS_RUDDER)
      Value      0
      Min        0
      Max      255
    Event code 8 (ABS_WHEEL)
      Value      0
      Min        0
      Max      255
    Event code 16 (ABS_HAT0X)
      Value      0
      Min        0
      Max      255
    Event code 40 (ABS_MISC)
      Value      0
      Min        0
      Max      255
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)

As you can see, this list has all the axes in the upper left corner and games actually see that as input from the SDL layer. I think this needs some fixing at the kernel level, and also udev to not tag it as input device. But since SDL as provided by Proton supports hidraw mode, it would still see this device and use it as an input device because it totally ignores what the kernel or udev say about it.

Adding

SDL_GAMECONTROLLER_IGNORE_DEVICES=0x26CE/0x01A2

works around the problem.