如何在 Xubuntu 18.10 中启用 PC 游戏手柄的振动

如何在 Xubuntu 18.10 中启用 PC 游戏手柄的振动

我有一个售价 3-4 美元的不知名的游戏手柄,我将它连接到 PC 来测试振动,但我不知道如何操作。

答案1

游戏手柄可能不支持振动。如果您可以编辑帖子以包含设备的供应商和产品 ID,其他人将更容易知道您拥有哪种型号以及它是否应该工作。您可以使用以下方式获取此信息lsusb(假设它通过 USB 连接):

$ lsusb
Bus 002 Device 056: ID 045e:02ea Microsoft Corp. 

在这种情况下,我有一个已连接的游戏手柄,其供应商 ID045e和产品 ID 02ea。这些是 Xbox One 控制器的 ID。

如果游戏手柄支持该FF_RUMBLE事件,则它支持振动,您可以使用该evtest工具进行检查。这是我的 Xbox One 控制器的输出,它确实支持振动。

$ 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/event16: Microsoft X-Box One S pad
Select the device event number [0-16]: 16
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x45e product 0x2ea version 0x301
Input device name: "Microsoft X-Box One S pad"
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    738
      Min   -32768
      Max    32767
      Flat     128
    Event code 1 (ABS_Y)
      Value    705
      Min   -32768
      Max    32767
      Flat     128
    Event code 2 (ABS_Z)
      Value      0
      Min        0
      Max     1023
    Event code 3 (ABS_RX)
      Value    482
      Min   -32768
      Max    32767
      Fuzz      16
      Flat     128
    Event code 4 (ABS_RY)
      Value   -339
      Min   -32768
      Max    32767
      Fuzz      16
      Flat     128
    Event code 5 (ABS_RZ)
      Value      0
      Min        0
      Max     1023
    Event code 16 (ABS_HAT0X)
      Value      0
      Min       -1
      Max        1
    Event code 17 (ABS_HAT0Y)
      Value      0
      Min       -1
      Max        1
  Event type 21 (EV_FF)
    Event code 80 (FF_RUMBLE)
    Event code 81 (FF_PERIODIC)
    Event code 88 (FF_SQUARE)
    Event code 89 (FF_TRIANGLE)
    Event code 90 (FF_SINE)
    Event code 96 (FF_GAIN)
Properties:
Testing ... (interrupt to exit)

Event code 80 (FF_RUMBLE)意味着它应该支持振动效果。

要测试震动,请使用fftest。您需要提供游戏手柄的 evdev 节点的路径,该路径包含在 的输出中evtest。对于我的 Xbox 控制器,这是/dev/input/event16

$ fftest /dev/input/event16
Force feedback test program.
HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES

Device /dev/input/event16 opened
Features:
  * Absolute axes: X, Y, Z, RX, RY, RZ, Hat 0 X, Hat 0 Y, 
    [3F 00 03 00 00 00 00 00 ]
  * Relative axes: 
    [00 00 ]
  * Force feedback effects types: Periodic, Rumble, Gain, 
    Force feedback periodic effects: Square, Triangle, Sine, 
    [00 00 00 00 00 00 00 00 00 00 03 07 01 00 00 00 ]
  * Number of simultaneous effects: 16

Setting master gain to 75% ... OK
Uploading effect #0 (Periodic sinusoidal) ... OK (id 0)
Uploading effect #1 (Constant) ... Error: Invalid argument
Uploading effect #2 (Spring) ... Error: Invalid argument
Uploading effect #3 (Damper) ... Error: Invalid argument
Uploading effect #4 (Strong rumble, with heavy motor) ... OK (id 1)
Uploading effect #5 (Weak rumble, with light motor) ... OK (id 2)
Enter effect number, -1 to exit

使用效果 4 和 5 测试隆隆声效果:

Enter effect number, -1 to exit
4
Now Playing: Strong Rumble
Enter effect number, -1 to exit
5
Now Playing: Weak Rumble
Enter effect number, -1 to exit

相关内容