如何阻止我的控制器移动我的鼠标?

Dav*_*idW 8 xorg usb gamepad xinput

这是我正在尝试使用的适配器:Amazon - Mayflash Wii U Pro Controller USB 适配器该适配器有两种模式,一种是 xbox 输入模式,另一种是通用 hid 模式。xbox 模式在 Ubuntu 上运行良好,但它只支持一个控制器。在通用控制器模式下,支持 4 个控制器。我在这种模式下在 Ubuntu 上使用它有困难,因为它正在四处移动鼠标,游戏无法识别控制器已插入。

首先,我希望它停止移动我的鼠标。我希望解决这个问题会帮助我解决第二个问题。以下是一些入门信息。

xinput list
? Virtual core pointer                          id=2    [master pointer  (3)]
?   ? Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
?   ? HJZ Mayflash WiiU Pro Game Controller Adapter     id=8    [slave  pointer  (2)]
?   ? Logitech M310                             id=9    [slave  pointer  (2)]
?   ? Logitech K520                             id=10   [slave  pointer  (2)]
? Virtual core keyboard                         id=3    [master keyboard (2)]
    ? Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ? Power Button                              id=6    [slave  keyboard (3)]
    ? Power Button                              id=7    [slave  keyboard (3)]
    ? Eee PC WMI hotkeys                        id=11   [slave  keyboard (3)]

xinput list-props 8
Device 'HJZ Mayflash WiiU Pro Game Controller Adapter':
        Device Enabled (143):   1
        Coordinate Transformation Matrix (145): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        Device Accel Profile (276):     0
        Device Accel Constant Deceleration (277):       1.000000
        Device Accel Adaptive Deceleration (278):       1.000000
        Device Accel Velocity Scaling (279):    10.000000
        Device Product ID (260):        121, 6144
        Device Node (261):      "/dev/input/event2"
        Evdev Axis Inversion (280):     0, 0
        Evdev Axis Calibration (281):   <no items>
        Evdev Axes Swap (282):  0
        Axis Labels (283):      "Abs X" (264), "Abs Y" (265), "Abs Z" (266), "Abs Rotary Z" (267), "Abs Hat 0 X" (268), "Abs Hat 0 Y" (269), "Abs Hat 1 X" (270), "Abs Hat 1 Y" (271), "Abs Hat 2 X" (272), "Abs Hat 2 Y" (273), "Abs Hat 3 X" (274), "Abs Hat 3 Y" (275)
        Button Labels (284):    "Button Unknown" (263), "Button Unknown" (263), "Button Unknown" (263), "Button Wheel Up" (149), "Button Wheel Down" (150), "Button Horiz Wheel Left" (151), "Button Horiz Wheel Right" (152)
        Evdev Scrolling Distance (285): 0, 0, 0
        Evdev Middle Button Emulation (286):    0
        Evdev Middle Button Timeout (287):      50
        Evdev Third Button Emulation (288):     0
        Evdev Third Button Emulation Timeout (289):     1000
        Evdev Third Button Emulation Button (290):      3
        Evdev Third Button Emulation Threshold (291):   20
        Evdev Wheel Emulation (292):    0
        Evdev Wheel Emulation Axes (293):       0, 0, 4, 5
        Evdev Wheel Emulation Inertia (294):    10
        Evdev Wheel Emulation Timeout (295):    200
        Evdev Wheel Emulation Button (296):     4
        Evdev Drag Lock Buttons (297):  0
Run Code Online (Sandbox Code Playgroud)

我无法禁用鼠标事件道具,因为它未列出。

我尝试删除 xserver-xorg-input-joystick 并尝试安装它并将自定义游戏杆配置添加为 /usr/share/X11/xorg.conf.d/50-joystick.conf

Section "InputClass"
        Identifier "joystick catchall"
        MatchIsJoystick "on"
        MatchDevicePath "/dev/input/event*"
        Driver "joystick"
        Option "StartKeysEnabled" "False"       #Disable mouse
        Option "StartMouseEnabled" "False"      #support
EndSection
Run Code Online (Sandbox Code Playgroud)

我相信这些是 dmesg 中的相关行:

[    1.259673] usb 1-4.2: new full-speed USB device number 4 using xhci_hcd
[    1.352076] usb 1-4.2: New USB device found, idVendor=0079, idProduct=1800
[    1.352078] usb 1-4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    1.352080] usb 1-4.2: Product: Mayflash WiiU Pro Game Controller Adapter
[    1.352081] usb 1-4.2: Manufacturer: HJZ
[    1.361980] input: HJZ Mayflash WiiU Pro Game Controller Adapter as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.2/1-4.2:1.0/0003:0079:1800.0006/input/input5
[    1.362154] hid-generic 0003:0079:1800.0006: input,hidraw1: USB HID v1.11 Joystick [HJZ Mayflash WiiU Pro Game Controller Adapter] on usb-0000:00:14.0-4.2/input0
Run Code Online (Sandbox Code Playgroud)

为什么是hidraw1?

我还能尝试什么?

Gru*_*bel 6

类似的东西:

xinput set-prop 'HJZ Mayflash WiiU Pro Game Controller Adapter' "Device Enabled" 0
Run Code Online (Sandbox Code Playgroud)

应该让它停止充当鼠标。您可能还想运行

sudo evtest /dev/input/event2 (or wherever your controller is)
Run Code Online (Sandbox Code Playgroud)

首先了解为什么会发生这种情况。


小智 6

停止操纵杆控制鼠标实际上很容易,经过多次搜索终于偶然发现,在当前版本的 ubuntu xorg.conf 中没有使用,而是你有文件。 /usr/share/X11/xorg.conf .d/ 您必须以 root 身份转到此文件夹并编辑“50-joystick.conf”,以便:

sudo su
cd /usr/share/X11/xorg.conf.d/
nano 50-joystick.conf
Run Code Online (Sandbox Code Playgroud)

该文件应如下所示:

Section "InputClass"
    Identifier "joystick catchall"
    MatchIsJoystick "on"
    MatchDevicePath "/dev/input/event*"
    Driver "joystick"
    Option "StartKeysEnabled" "False"   # These Two Lines Disable
    Option "StartMouseEnabled" "False"  # The mouse emulation
EndSection
Run Code Online (Sandbox Code Playgroud)

添加两个“选项”行后,保存文件 (Ctrl+O) 并退出 (Ctrl+X)。现在重新启动 linux,游戏杆在游戏中工作,但不再在屏幕上运行鼠标或将他困在左上角。