I'm trying to create a virtual joystick device for use in steam games, on Linux (specifically Manjaro). I'm using Python for this project and have tried with both the evdev and uinput libraries, with the same result: The system seems to recognize the device (/dev/input/ files correctly created, evdev and jscal all work correctly, etc), but steam doesn't accept it as a valid controller. This is the code I'm using to test it:
#!/bin/python
import uinput
import time
def main():
events = (
uinput.BTN_JOYSTICK,
uinput.ABS_X + (0, 255, 0, 0),
uinput.ABS_Y + (0, 255, 0, 0),
)
with uinput.Device(events) as device:
for i in range(20):
device.emit(uinput.ABS_X, 5, syn=False)
device.emit(uinput.ABS_Y, 5)
time.sleep(2)
device.emit_click(uinput.BTN_JOYSTICK)
if __name__ == "__main__":
main()
Running steam in console, I get the following output when a physical controller is connected:
Local Device Found
type: 046d ca04
path: sdl://0
serial_number: - 0
Manufacturer:
Product: dev:xb1:Logitech Logitech Racing Wheel
Release: 110
Interface: -1
!! Steam controller device opened for index 0.
Steam Controller reserving XInput slot 0
Controller 0 connected, configuring it now...
Installing breakpad exception handler for appid(steam)/version(1576908998)
Controller has an Invalid or missing unit serial number, setting to '46d-ca04-655a04e'
!! Controller 0 attributes:
Type: 32
ProductID: 51716
Serial: 46d-ca04-655a04e
Capabilities: 0018414f
Firmware Version: 0
Firmware Build Time: 2147483647 (Tue, 19 Jan 2038 03:14:07 GMT)
Bootloader Build Time: 2147483647 (Tue, 19 Jan 2038 03:14:07 GMT)
Opted-in Controller Mask for AppId 413080: f
Loaded Config for Local Selection Path for App ID 413080, Controller 0
[413080]Non-Steam Controller Configs Enabled: 1
!! Controller 0 attributes:
Type: 32
ProductID: 51716
Serial: 46d-ca04-655a04e
Capabilities: 0018414f
Firmware Version: 0
Firmware Build Time: 2147483647 (Tue, 19 Jan 2038 03:14:07 GMT)
Bootloader Build Time: 2147483647 (Tue, 19 Jan 2038 03:14:07 GMT)
Fetching Config Sets 0
However when I create the virtual device, I get the following output:
Local Device Found
type: 0001 0001
path: sdl://2
serial_number: - 0
Manufacturer:
Product: python-uinput
Release: 0
Interface: -1
Local Device Found
type: 0001 0001
path: sdl://2
serial_number: - 0
Manufacturer:
Product: python-uinput
Release: 0
Interface: -1
So steam seems to be correctly detecting the device, but not recognizing it as a valid game controller. I've tried changing all the details of the device (name, type, product, etc) to match an existing physical device with no luck. It does output the "Local Device Found" twice for the virtual device and only once for the physical one, I'm not sure if that's relevant or what's causing it.
Thanks in Advance