PS/2 Trackpoint Scrolling in Wayland

A coworker graciously gave me an IBM RT3200! It’s a tenkeyless IBM keyboard with integrated trackpoint. However, I did have some issues getting scrolling working properly with a modern USB-based system running Wayland.

Pros, cons, and quirks

It’s actually a pretty nice keyboard which has the following features:

  • Trackpoint!
  • Three mouse buttons (vs Two on the Unicomp EnduraPro, for example)
  • Meta/Windows key (vs older Model M boards without it)
  • Full format keyboard (vs compact or laptop-format with “thinkpad” keyboards)
  • Tenkeyless (so no numpad)

It does have some downsides:

  • Rubber dome (No clacky buckling springs)
  • PS/2 !
  • No volume control (vs laptop-format thinkpad keyboards, which also have a Fn key)

It also has the quirk of a PS/2 mouse passthrough, labelled “2 BUTTON MOUSE ONLY”. Never seen that before.

USB Adapter

To use this on a modern machine necessitates two PS/2 to USB adapters, as the trackpoint and keyboard use separate plugs. I bought this dual adapter on Amazon, which seems to work fine. I’ll be honest, it’s best feature is it’s price. Curiously, it identifies as a Barcode reader, although it properly exposes multiple appropriate input devices:

$ lsusb | grep 13ba
Bus 001 Device 015: ID 13ba:0018 PCPlay Barcode PCP-BCG4209

Connecting this to any USB port gets the keyboard and pointer working mostly fine.

Scrolling

On Linux, the trackpoint is supposed to scroll when the middle button is held down. It’s a very useful feature, and it did not work out of the box like it does with normal USB keyboards. This is because traditional USB devices have both a vendor and product ID, which can be used to identify it specifically.

For example, 17ef:6047 identifies my Lenovo (17ef) Thinkpad Compact USB Keyboard with Trackpoint (6047). This can then apply certain rules to the keyboard (keymappings, Fn key handling) and trackpoint (it knows it’s a trackpoint instead of a plain-old mouse or trackpad). On that device, middle-button scrolling works out of the box.

This keyboard has no unique identifiers (PS/2 predates that need). Furthermore, the PS/2 to USB adapter identifies itself as a barcode reader. I suspect this is simply due to cheap electronics re-using device IDs (whether surplus parts, re-used code, or just lack of care).

Finding Device IDs

There’s very little documentation on fixing this, and I only found the solution via a question on Ask Ubuntu, of all places. Luckily, it’s a trivial change consisting of a one-line udev rule to apply an environment variable to the device.

You’ll need the following information about your particular PS/2 adapter:

  • USB Vendor ID
  • EVDev name

USB Vendor ID can be found with lsusb. If you’re not sure which device is correct (i.e., it says “Barcode” instead of “PS/2 Keyboard”), you can check lsusb before and after plugging your device in, and find the new one. You can also check dmesg, which should list your new device.

You can use libinput to check for devices. There were 33 devices on my laptop due to the plethora of input devices I have connected (plus each device shows up multiple times). But I was able to pick out the new one becuse it said “Barcode”:

$ sudo libinput list-devices | grep Device
[...]
Device:           Barcode Reader 
Device:           Barcode Reader  Mouse
Device:           Barcode Reader  System Control
Device:           Barcode Reader  Consumer Control
[...]

Create udev rule:

Armed with the above information, I can craft my udev rule. I’m matching based on the Vendor ID and the word “Mouse”:

$ sudo tee /etc/udev/rules.d/70-ps2-pointingstick.rules <<EOF
# Detect PS/2 Mouse as a pointingstick (Trackpoint)
ACTION=="add|change", ENV{ID_VENDOR_ID}=="13ba", ATTRS{name}=="*Mouse*", ENV{ID_INPUT_POINTINGSTICK}="1"
EOF

After this, you can trigger udev to reload the rules, then unplug/replug your device.

$ sudo udevadm control --reload-rules

You should now have middle-mouse scrolling on your PS/2-to-USB-connected trackpoint.