力反馈操纵杆支持 (MS Sidewinder FF2)

力反馈操纵杆支持 (MS Sidewinder FF2)

我想弄清楚我的力反馈操纵杆在 Ubuntu 中实际上有多大的支持。目前我安装了 Ubuntu 20.04.05 LTS。

到目前为止我可以跑

$ lsusb 
...
Bus 001 Device 006: ID 045e:001b Microsoft Corp. SideWinder Force Feedback 2 Joystick
...
$

$ jstest /dev/input/js0
Driver version is 2.1.0.
Joystick (Microsoft SideWinder Force Feedback 2 Joystick) has 6 axes (X, Y, Rz, Throttle, Hat0X, Hat0Y)
and 9 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn, BaseBtn, BaseBtn2, BtnDead).
Testing ... (interrupt to exit)
Axes:  0:  1852  1:     0  2:     0  3:     0  4:     0  5:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:on

两者似乎都运行良好,因此基本操纵杆功能良好。接下来,我想检查力反馈功能。我读到https://docs.kernel.org/input/ff.html 并尝试

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

Device /dev/input/js0 opened
Features:
Ioctl absolute axes features query: Invalid argument

但文档中提到了一些 eventXX 设备文件。不幸的是,它没有提到要使用哪一个。所以我将我的用户添加到input组中并尝试

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

Device /dev/input/event0 opened
Features:
  * Absolute axes: 
    [00 00 00 00 00 00 00 00 ]
  * Relative axes: 
    [00 00 ]
  * Force feedback effects types: 
    Force feedback periodic effects: 
    [00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ]
  * Number of simultaneous effects: 0

Uploading effect #0 (Periodic sinusoidal) ... Error:: Function not implemented
Uploading effect #1 (Constant) ... Error: Function not implemented
Uploading effect #2 (Spring) ... Error: Function not implemented
Uploading effect #3 (Damper) ... Error: Function not implemented
Uploading effect #4 (Strong rumble, with heavy motor) ... Error: Function not implemented
Uploading effect #5 (Weak rumble, with light motor) ... Error: Function not implemented
Enter effect number, -1 to exit

无论我输入什么数字,我的操纵杆的行为都是一样的:它使用力量将操纵杆置于中央。可能只是因为功能未实现。但无论我指定哪个文件,都会发生同样的情况:

/dev/input/event0
/dev/input/event1
/dev/input/event...

是不是我的操纵杆不受支持?根据https://docs.kernel.org/input/joydev/joystick.html#microsoft-sidewinder-joysticks超速驱动协议似乎就在那里。

还有什么可能缺失?

答案1

我可能遇到了真正的问题。内核文档https://docs.kernel.org/input/joydev/joystick.html#microsoft-sidewinder-joysticks列出了这些支持的设备:

  • 微软 SideWinder 3D Pro
  • Microsoft SideWinder 力反馈专业版
  • Microsoft SideWinder 力反馈方向盘
  • 微软 SideWinder FreeStyle Pro
  • Microsoft SideWinder GamePad(最多四个,串联)
  • 微软 SideWinder Precision Pro
  • 微软 SideWinder Precision Pro USB

注意到了什么吗? Force Feedback 2 操纵杆未列出。因此,我从https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.1.6.tar.xz并检查了文件linux-6.1.6/drivers/input/joystick/sidewinder.c。它包含

static char *sw_name[] = {  "3D Pro", "GamePad", "Precision Pro", "Force Feedback Pro", "FreeStyle Pro",
                "Force Feedback Wheel" };

与上面的列表相符,但再次省略了 Force Feedback 2 操纵杆。似乎是一件被遗忘的文物。

答案2

我偶然发现了力反馈/操纵杆套件中的另一个命令:evtest

以 root 身份运行此程序会显示一个包含 23 个设备的庞大列表,并且还会显示它们的名称:

# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
...
/dev/input/event23: Microsoft SideWinder Force Feedback 2 Joystick
Select the device event number [0-23]: 

根据这个提示,我再次运行 fftest 并得到了以下输出:

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

Device /dev/input/event23 opened
Features:
  * Absolute axes: X, Y, RZ, Throttle, Hat 0 X, Hat 0 Y, 
    [63 00 03 00 00 00 00 00 ]
  * Relative axes: 
    [00 00 ]
  * Force feedback effects types: Constant, Periodic, Ramp, Spring, Friction, Damper, Rumble, Inertia, Gain, Autocenter, 
    Force feedback periodic effects: Square, Triangle, Sine, Saw up, Saw down, 
    [00 00 00 00 00 00 00 00 00 00 FF 1F 03 00 00 00 ]
  * Number of simultaneous effects: 40

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

因此,内核似乎可以检测到 Force Feedback 2 操纵杆,并且已知它支持五种不同的效果。输入一些效果数字,例如4真的会让操纵杆摇晃几秒钟。

还有另外一个不错的命令可以使用:

ffcfstress -d /dev/input/event23

查看https://github.com/flosse/linuxconsole

Joystick utilities
------------------

The following utilities are provided to calibrate and test joysticks:
* ffcfstress, ffmvforce, fftest - test force-feedback devices
* ffset - set force-feedback device parameters
* jscal - calibrate joystick devices, reconfigure the axes and buttons
* jscal-store, jscal-restore - store and retrieve joystick device
  settings as configured using jscal
* jstest - test joystick devices

相关内容