python - Steam 无法正确识别 Python 虚拟设备
问题描述
我正在尝试在 Linux(特别是 Manjaro)上创建一个用于 Steam 游戏的虚拟操纵杆设备。我在这个项目中使用 Python,并尝试使用 evdev 和 uinput 库,结果相同:系统似乎识别设备(/dev/input/ 文件正确创建,evdev 和 jscal 都正常工作,等等) ,但 steam 不接受它作为有效的控制器。这是我用来测试它的代码:
#!/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()
在控制台中运行蒸汽,连接物理控制器时得到以下输出:
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
但是,当我创建虚拟设备时,我得到以下输出:
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
所以 Steam 似乎正确地检测到了设备,但没有将其识别为有效的游戏控制器。我尝试更改设备的所有详细信息(名称、类型、产品等)以匹配现有的物理设备,但没有成功。它确实为虚拟设备输出了两次“找到的本地设备”,而物理设备只输出了一次,我不确定这是否相关或是什么原因造成的。
提前致谢
解决方案
推荐阅读
- javascript - 无法为函数添加价值并停止执行请求(邮递员)
- sql - Group by 在查询中获取文本列中的最后一项,同时聚合 int 列
- java - 邮递员在成功发布请求后返回空值
- javascript - 窗口上的两个事件监听器,对不同的元素执行,只有一个执行
- javascript - 如何在 ReactJS 中动态添加行?
- python - 带有 Oracle DB 的 Django - ORA-19011:字符串缓冲区太小
- centos7 - CentOS 7 找不到模块“解析服务器”
- python - 我想了解函数中哪一行代码输出**none**
- javascript - onClick 事件自动提交表单
- python - 使用设置条件附加列表的值