Skip to main content

Control IBM Trackpoint 2 Keyboard features (Trackpoint sensitivity, ...)

Project description

tp2ctl

Simple python tool to allow configuration of the Lenovo Trackpoint Keyboard II / Lenovo Trackpoint Keyboard 2 on Linux. This tool specifically allows to set the pointer-speed (i.e. Trackpoint sensitivity) and to disable/enable Thinkpad preferred scrolling-mode. Loosely based on tpkbdctl, this tool also uses the hidraw interface to connect to the keyboard.

Tested on Ubuntu 20.04 and Arch

Installation

Install via pip:

pip install tp2ctl

Alternatively, if you don't want to use pip, you can just clone the repo and run the script tp2ctl.py in src/tp2crl/ directly (no external dependencies need to be installed....)

Note: Python >= 3 is required to run this tool

Usage

Note that access to /dev/hidraw* is required, you might have to run this tool as root...

Set the trackpoint-sensitivity to maximum:

sudo tp2ctl -s 8

By default, tp2ctl will auto-detect and use the first Lenovo Trackpoint II Keyboard on the usb-bus. If you want to manually specify a hid-raw device, you can do so by using the -d switch... Please also note, that the settings are not permanent and have to be re-applied after the keyboard was disconnected.

usage: tp2ctl.py [-h] [-s [0-8]] [-d DEVICE] [--no-preferred-scrolling | --preferred-scrolling]

Control IBM Trackpoint 2 Keyboard features

optional arguments:
  -h, --help            show this help message and exit
  -s [0-8], --pointer-speed [0-8]
                        set trackpoint sensitivity ('Pointer Speed')
  -d DEVICE, --device DEVICE
                        set hidraw device manually
  --no-preferred-scrolling
                        enable 'Thinkpad Preferred Scrolling'
  --preferred-scrolling
                        disable 'Thinkpad Preferred Scrolling'

Automatically configure when plugging in

To automatically apply settings whenever you plug in, you can use an udev rule.

Create a file at /etc/udev/rules.d/99-tp2ctl.rules:

# The Lenovo TrackPoint Keyboard II needs to be configured via raw hid commands
# Read in bInterfaceNumber into a ID_USB_INTERFACE_NUM
SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACE_NUM}="$attr{bInterfaceNumber}"

# … so we can use it down here
SUBSYSTEM=="hidraw", ACTION=="add", ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="60ee", ENV{ID_USB_INTERFACE_NUM}=="01", RUN+="/usr/bin/tp2ctl -s 8 --preferred-scrolling -d /dev/%k"

Tweak the path to the tp2ctl script, and the arguments accordingly, and make sure the script is owned and only writable by root.

Known Lmitiations

  • Only tested / working with 2.4GHz Transceiver
  • The internal Trackpoint of my Thinkpad seems to be much more sensitive as the one of the Trackpoint Keyboard II. However, this behaviour can also be observed using Windows, so I blame Lenovo for this ...
  • When disabling Thinkpad preferred scrolling the mouse middle-button is not working any more
  • Horizontal scrolling does not work
  • Middle-Button pastes clipboard on scolling (very annoying)

Windows Companion App

The Windows Companion App has two main features:

  • Set the Pointer Speed
  • Enable/Disable Thinkpad Preferred Scrolling (Thinkpad Preferred Scrolling enables vertical scrolling in Windows)

Windows Tool Screenshot

Protocol

The Windows Companion App sends USB SET_REPORTrequests to configure the keyboard. Specifically a SET_REPORT (Feature)with Feature-ID 0x13and a payload of 8 + 1 bytes (first byte beeing the Feature-ID) is transmitted. The Windows App seems to send every setting-related package twice. The screenshot shows the tramssion of the Disable Preferred Scrolling packet. You can find the .pcap files with the USB-Traces in the folder pcaps

Note: Further information onSET_REPORT (Output)and SET_REPORT (Feature) requests can be found at the USB HID Definition (Pages 29 & 52)

Wirechark Screenshot

Payloads

Pointer Speed

Speed Data Fragment
1 0x13 0x02 0x01 0x00 0x00 0x00 0x00 0x00 0x00
2 0x13 0x02 0x02 0x00 0x00 0x00 0x00 0x00 0x00
3 0x13 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x00
4 0x13 0x02 0x04 0x00 0x00 0x00 0x00 0x00 0x00
5 0x13 0x02 0x05 0x00 0x00 0x00 0x00 0x00 0x00
6 0x13 0x02 0x06 0x00 0x00 0x00 0x00 0x00 0x00
7 0x13 0x02 0x07 0x00 0x00 0x00 0x00 0x00 0x00
8 0x13 0x02 0x08 0x00 0x00 0x00 0x00 0x00 0x00
9 0x13 0x02 0x09 0x00 0x00 0x00 0x00 0x00 0x00

Preferred Scrolling

Data Fragment
Enable 0x13 0x09 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Disable 0x13 0x09 0x01 0x00 0x00 0x00 0x00 0x00 0x00

Unknown

Data Fragment
Reset to defaults (?) 0x13 0x05 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Initialize (?) 0x13 0x01 0x0a 0x00 0x00 0x00 0x00 0x00 0x00

ToDo

  • Implement/Test bluetooth-support
  • Fix pasting on middle-button click

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tp2ctl-1.0.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tp2ctl-1.0.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file tp2ctl-1.0.1.tar.gz.

File metadata

  • Download URL: tp2ctl-1.0.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.6.4 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.9

File hashes

Hashes for tp2ctl-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3f149b02ac207d5e4f9aa1ae22cc207b5b19f444189e1954ba5423db4259222e
MD5 c1922913d6b4367734ff8678e9556440
BLAKE2b-256 e1ffb10b59ba92776b5114b9b27e02b4a17111224ffce5004adb7baf344dd303

See more details on using hashes here.

File details

Details for the file tp2ctl-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: tp2ctl-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.6.4 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.9

File hashes

Hashes for tp2ctl-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c590e532a55abcd9144bf4fa3af69936bcd4687a69daf7fe25008e944f6a5b03
MD5 7b066aa9d3fd7826f197006e442a14bf
BLAKE2b-256 8dab7d1e34cdece104936a7a6550e18bfab39e2c185b395d949961f1fec4e4c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page