如果通过 KVM 切换器连接输入设备,我需要配置什么?

如果通过 KVM 切换器连接输入设备,我需要配置什么?

我从雇主那里得到了一台 KVM 切换器(Aten CS782DP),据我所知,它工作正常。然而,在 Ubuntu 16.04 和 16.10 上,它似乎给我的输入设备(带 TrackPoint 的 Thinkpad USB 紧凑型键盘)带来了问题。我无法再进行鼠标中键单击,也无法垂直滚动(水平滚动则正常)。

具体来说,xinput当键盘直接连接时,输出如下所示:

⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=14   [slave  pointer  (2)]
⎜   ↳ Lenovo ThinkPad Compact USB Keyboard with TrackPoint  id=10   [slave  pointer  (2)]
⎜   ↳ ATEN KVM V1.1.104                         id=17   [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=13   [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)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Integrated Camera                         id=11   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=12   [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                    id=15   [slave  keyboard (3)]
    ↳ Lenovo ThinkPad Compact USB Keyboard with TrackPoint  id=9    [slave  keyboard (3)]
    ↳ ATEN KVM V1.1.104                         id=16   [slave  keyboard (3)]

xinput通过 KVM 连接时的输出如下:

⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=14   [slave  pointer  (2)]
⎜   ↳ Lenovo ThinkPad Compact USB Keyboard with TrackPoint  id=9    [slave  pointer  (2)]
⎜   ↳ Lenovo ThinkPad Compact USB Keyboard with TrackPoint  id=16   [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=13   [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)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Integrated Camera                         id=11   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=12   [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                    id=15   [slave  keyboard (3)]
    ↳ Lenovo ThinkPad Compact USB Keyboard with TrackPoint  id=10   [slave  keyboard (3)]

据我所知,除了指针设备(ID 9 和 16)的奇怪重复外,这看起来也很好。我假设这与 KVM 有点像 USB 集线器有关,暂时忽略此重复。

我尝试xinput test在两种设备上运行,发现第一个设备接受移动和左键和右键单击(鼠标按钮 1 和 3),而第二个设备只接受水平滚动(按钮 6 和 7)。两者都不接受中间按钮(按钮 2)或垂直滚动​​(按钮 4 和 5)。

xinput list-props两个设备的输出看起来相同:

Device 'Lenovo ThinkPad Compact USB Keyboard with TrackPoint':
    Device Enabled (152):   1
    Coordinate Transformation Matrix (154): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    Device Accel Profile (284): 0
    Device Accel Constant Deceleration (285):   1.000000
    Device Accel Adaptive Deceleration (286):   1.000000
    Device Accel Velocity Scaling (287):    10.000000
    Device Product ID (272):    6127, 24647
    Device Node (273):  "/dev/input/event17"
    Evdev Axis Inversion (288): 0, 0
    Evdev Axes Swap (290):  0
    Axis Labels (291):  "Rel X" (162), "Rel Y" (163), "Rel Horiz Wheel" (282), "Rel Vert Wheel" (283)
    Button Labels (292):    "Button Left" (155), "Button Middle" (156), "Button Right" (157), "Button Wheel Up" (158), "Button Wheel Down" (159), "Button Horiz Wheel Left" (160), "Button Horiz Wheel Right" (161), "Button Side" (280), "Button Extra" (281), "Button Unknown" (275), "Button Unknown" (275), "Button Unknown" (275), "Button Unknown" (275)
    Evdev Scrolling Distance (293): 1, 1, 1
    Evdev Middle Button Emulation (294):    1
    Evdev Middle Button Timeout (295):  50
    Evdev Third Button Emulation (296): 0
    Evdev Third Button Emulation Timeout (297): 1000
    Evdev Third Button Emulation Button (298):  3
    Evdev Third Button Emulation Threshold (299):   20
    Evdev Wheel Emulation (300):    1
    Evdev Wheel Emulation Axes (301):   6, 7, 4, 5
    Evdev Wheel Emulation Inertia (302):    10
    Evdev Wheel Emulation Timeout (303):    200
    Evdev Wheel Emulation Button (304): 2
    Evdev Drag Lock Buttons (305):  0

Ubuntu () 中的默认 TrackPoint 配置/usr/share/X11/xorg.conf.d/11-evdev-trackpoint.conf如下所示:

Section "InputClass"
        Identifier      "trackpoint catchall"
        MatchIsPointer  "true"
        MatchProduct    "TrackPoint|DualPoint Stick"
        MatchDevicePath "/dev/input/event*"
        Option  "Emulate3Buttons"       "true"
        Option  "EmulateWheel"  "true"
        Option  "EmulateWheelButton"    "2"
        Option  "XAxisMapping"  "6 7"
        Option  "YAxisMapping"  "4 5"
EndSection

因此根据这条规则,两台设备应具有相同的配置,即接受移动、所有三个按钮以及两种滚动类型。然而事实并非如此,如上图所示。直接连接的键盘可以完美运行。

那么我缺少什么,我需要做什么才能让我的外接键盘通过这个 KVM 切换器正常工作?

答案1

不管你信不信,我已经解决了这个问题。该解决方案不针对 Aten KVM 或 Thinkpad Compact 键盘,可能有助于解决一般的“我的键盘无法与 KVM 切换器正常配合使用”问题。

因此,想法是这样的:内核驱动程序正在尝试初始化特定设备(例如键盘)。但是,KVM 切换器通常会提供方便的快捷方式来切换和其他功能。对于 Aten,有一个双击滚轮的快捷方式。切换器本身需要过滤 USB 命令才能使其工作,这显然会影响内核在设备上设置某些配置位的能力。就我而言,它无法配置滚动功能。

解决方案很简单:禁用冲突模式。对于 Aten,它被称为“鼠标模拟模式”。禁用该模式后,一切都开始正常工作。

相关内容