![在 X 模式下信任控制器,可以看见但没有输入](https://linux22.com/image/1171010/%E5%9C%A8%20X%20%E6%A8%A1%E5%BC%8F%E4%B8%8B%E4%BF%A1%E4%BB%BB%E6%8E%A7%E5%88%B6%E5%99%A8%EF%BC%8C%E5%8F%AF%E4%BB%A5%E7%9C%8B%E8%A7%81%E4%BD%86%E6%B2%A1%E6%9C%89%E8%BE%93%E5%85%A5.png)
我有一个 Trust GTX YULA 控制器,我也想在我的 Ubuntu 笔记本电脑上使用它。
控制器在直接模式和 X 模式之间有一个开关,在 X 模式中,它假装是 XBOX 控制器。X 模式在 Windows 上工作正常。我不想使用 D 模式,因为模拟摇杆在该模式下提供离散输入,假装是按钮,并且一个与 ABXY 按钮重叠。
输出lsusb
包含以下行:
Bus 001 Device 013: ID 045e:028e Microsoft Corp. Xbox360 Controller
由于我没有其他控制器,因此我认为这是我的控制器。它通过 USB 集线器连接。
我已经安装了jstest-gtk
,它也将控制器视为 XBOX 360 手柄,但点击特性按下控制器上的按钮并不能使相应的软件图标亮起。
我曾尝试使用xboxdrv
,但这是输出:
$ sudo xboxdrv
xboxdrv 0.8.8 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <[email protected]>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details.
Controller: Microsoft X-Box 360 pad
Vendor/Product: 045e:028e
USB Path: 001:013
Controller Type: Xbox360
Your Xbox/Xbox360 controller should now be available as:
/dev/input/js0
/dev/input/event18
Press Ctrl-C to quit, use '--silent' to suppress the event output
[ERROR] USBController::on_read_data(): USB read failure: 32: LIBUSB_TRANSFER_ERROR
[ERROR] USBController::on_write_data(): USB write failure: 3: LIBUSB_TRANSFER_ERROR
运行后,evtest
给出以下输出(按下控制器上的按钮没有任何反应)
$ evtest /dev/input/event18
Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "Xbox Gamepad (userspace driver)"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 304 (BTN_SOUTH)
Event code 305 (BTN_EAST)
Event code 307 (BTN_NORTH)
Event code 308 (BTN_WEST)
Event code 310 (BTN_TL)
Event code 311 (BTN_TR)
Event code 314 (BTN_SELECT)
Event code 315 (BTN_START)
Event code 316 (BTN_MODE)
Event code 317 (BTN_THUMBL)
Event code 318 (BTN_THUMBR)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 0
Min -32768
Max 32767
Event code 1 (ABS_Y)
Value 0
Min -32768
Max 32767
Event code 3 (ABS_RX)
Value 0
Min -32768
Max 32767
Event code 4 (ABS_RY)
Value 0
Min -32768
Max 32767
Event code 9 (ABS_GAS)
Value 0
Min 0
Max 255
Event code 10 (ABS_BRAKE)
Value 0
Min 0
Max 255
Event code 16 (ABS_HAT0X)
Value 0
Min -1
Max 1
Event code 17 (ABS_HAT0Y)
Value 0
Min -1
Max 1
Properties:
Testing ... (interrupt to exit)
有一位用户建议删除xserver-xorg-input-joystick.*
,但我没有安装。
我怎样才能让我的控制器工作?
是本网站是否有效检查?
谢谢。
答案1
关于 xpad 驱动程序也报告了同样的问题: https://github.com/paroj/xpad/issues/119 描述中提到的python srcipt(fixcontroller.py)解决了该问题。以下是该脚本的副本:
#!/usr/bin/env python3
import os
import sys
try:
import usb.core
import usb.util
except ImportError:
print("First, install the pyusb module with PIP or your package manager.")
else:
if os.geteuid() != 0:
print("You need to run this script with sudo")
sys.exit()
dev = usb.core.find(find_all=True)
for d in dev:
if d.idVendor == 0x045e and d.idProduct == 0x028e:
d.ctrl_transfer(0xc1, 0x01, 0x0100, 0x00, 0x14)
finally:
sys.exit()