What do I need to configure if an input device is attached through a KVM switch?

I've got a KVM switch from my employer (Aten CS782DP) which works fine as far as I can tell. However, it seems to be causing a problem with my input device (Thinkpad USB Compact Keyboard with TrackPoint) on both Ubuntu 16.04 and 16.10. I'm unable to middle-click anymore and neither can I scroll vertically (horizontally works fine).

In particular, this is how xinput output looks when the keyboard is attached directly:

⎡ 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)]

This is how the xinput output looks like when attached throught the 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)]

As far as I can see, this also looks fine except for the weird duplication of the pointer device (IDs 9 and 16). I'm going to assume this has to do with the KVM being a bit like USB hub and ignore this duplication for now.

I've tried running xinput test for both devices and found out that the first device accepts movement and left and right clicks (mouse button 1 and 3), while the second device only horizontal scrolling (button 6 and 7). Neither accepts the middle button (button 2) or vertical scrolling (buttons 4 and 5).

The output of xinput list-props looks identical for both devices:

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

The default TrackPoint configuration in Ubuntu (/usr/share/X11/xorg.conf.d/11-evdev-trackpoint.conf) looks like this:

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

So according to this rule, both devices should get the identical configuration, which is to accept movement, all three buttons and also both types of scrolling. However this is not the case, as illustrated above. A directly attached keyboard works flawlessly.

So what am I missing, what do I need to do to make my external keyboard work properly through this KVM switch?

1

1 Answer

Believe it or not, I've solved this one. The solution is not specific to either the Aten KVM or the Thinkpad Compact keyboard and might help in the generic "my keyboard does not work with a KVM switch properly".

So the idea is this: kernel driver is trying to initialize the specific device (e.g. a keyboard). However, a KVM switch usually provides convenience shortcuts for switching and other features. In case of Aten there is a shortcut for double-click on the scroll wheel. The switch itself needs to filter USB commandos to get this working which obviously intefers with kernel's ability to set certain configuration bits on the device. In my case, it failed to configure the scrolling functionality.

The soluton is simple: disable the conflicting mode. For the Aten, it's called "mouse emulation mode". Having disabled that, everything started working properly.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like