Score:3

Middle mouse button pastes even after scrolling with TrackPoint (on Lenovo Wireless TrackPoint Keyboard II)

uy flag

I have a Thinkpad X250 running Linux Mint 20.1 Cinnamon (5.4.0-74-generic).
I recently bought a Lenovo Thinkpad Trackpoint Wireless II keyboard, and I'm positively surprised by how well everything works when using the Bluetooth connection. (there's also an alternative proprietary USB-Dongle that came with it).

I was used to use the middle mouse button ("button 2") as copy/paste (X "primary") and to scroll when holding it down and then moving the TrackPoint.

But with the new keyboard, the primary buffer gets pasted even if I have just performed scrolling.
So I have spent some days figuring out what's the difference between the inbuilt mouse/TrackPoint and the new wireless one, but I'm kind of stuck now.

Behaviour of the "good" inbuilt X250 TrackPoint

The inbuilt device is called "TPPS/2 IBM TrackPoint" according to xinput.
When I run xinput test, I can see that clicking the middle button does not show up immediately.
When I now release the button I get a "button press 2" and "button release 2" directly following each other.
If I move the TrackPoint while holding the button, releasing it does not cause any "button 2" actions.
(There are a few "motion" and "button bress/release [4-7]" actions happening due to the TrackPoint movement)

The problem with the wireless keyboard

The mouse/trackpoint-related part of the bluetooth keyboard shows up as "TrackPoint Keyboard II Mouse".
Comparing the "xinput list-props" with the two devices, the only difference is the scroll method:

Wireless:

libinput Scroll Method Enabled (316):   0, 0, 0
libinput Scroll Method Enabled Default (317):   0, 0, 0

Inbuilt:

libinput Scroll Method Enabled (316):   0, 0, 1
libinput Scroll Method Enabled Default (317):   0, 0, 1

While for some reason (see below) I wasn't able to change the "libinput Scroll Method Enabled Default (317)" property, I tried both settings for "libinput Scroll Method Enabled (316)".
If I understood the documentation correctly, those three values select the scroll method and correspond to "two-finger", "edge", and "on-button" scrolling.
https://wayland.freedesktop.org/libinput/doc/latest/scrolling.html#scrolling

The results of xinput test are as follows:
With property libinput Scroll Method Enabled (316): 0, 0, 0 (default):
Pressing the middle mouse button down immediately issues a "button press 2" and pastes the primary buffer.
I can now move the TrackPoint (causing some "motion" and "button bress/release [4-7]" actions) and as soon as I release the button, I see a "button release 2".

With property libinput Scroll Method Enabled (316): 0, 0, 1:
Pressing the middle mouse button down does not show up immediately.
But regardless of whether I move the TrackPoint or not, as soon as I release the button, it causes both a "button press 2" and "button release 2" immediately after one another, the latter one apparently triggering the paste action.

In any case, libinput debug-events shows the button/TrackPoint data immediately.

There is also an ominous "Windows/Android" switch at the back of the keyboard.
This does not change anything. (I think it only changes the behaviour of the special function keys)

As mentioned above, the keyboard offers to connect using a USB dongle instead. The behaviour is slightly different here, but it's still pasting even when scrolling:

libinput Scroll Method Enabled (316): 0, 0, 0
"button press 2" (and buffer is pasted) appears immediately upon button press.
"button release 2" appears as soon as TrackPoint is moved or button is released.

libinput Scroll Method Enabled (316): 0, 0, 1
Nothing happens as the button is pressed down.
"button press 2", "button release 2" and buffer paste happen immediately after one another as soon as TrackPoint is being moved or the button is released.

I hope, I was able to clearly explain the problem. I'm not sure what to do next. My /usr/share/X11/xorg.conf.d/40-libinput.conf has been untouched and seems to just connect the "libinput" driver to any devices (see below).

Since libinput debug-events shows all the hardware data in real time, I don't think, the keyboard or BlueZ are the culprit.
But then again I don't know where and how the data from the wireless keyboard and from the inbuilt device are being treated so differently.
Are there any other debug possibilities apart from libinput and xinput?\

Thanks a lot for your help!

$ xinput list-props "TrackPoint Keyboard II Mouse"
Device 'TrackPoint Keyboard II Mouse':
    Device Enabled (165):   1
    Coordinate Transformation Matrix (167): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Natural Scrolling Enabled (311):   0
    libinput Natural Scrolling Enabled Default (312):   0
    libinput Scroll Methods Available (315):    0, 0, 1
    libinput Scroll Method Enabled (316):   0, 0, 0
    libinput Scroll Method Enabled Default (317):   0, 0, 0
    libinput Button Scrolling Button (329): 2
    libinput Button Scrolling Button Default (330): 2
    libinput Middle Emulation Enabled (321):    0
    libinput Middle Emulation Enabled Default (322):    0
    libinput Accel Speed (323): 0.000000
    libinput Accel Speed Default (324): 0.000000
    libinput Accel Profiles Available (331):    1, 1
    libinput Accel Profile Enabled (332):   1, 0
    libinput Accel Profile Enabled Default (333):   1, 0
    libinput Left Handed Enabled (325): 0
    libinput Left Handed Enabled Default (326): 0
    libinput Send Events Modes Available (288): 1, 0
    libinput Send Events Mode Enabled (289):    0, 0
    libinput Send Events Mode Enabled Default (290):    0, 0
    Device Node (291):  "/dev/input/event23"
    Device Product ID (292):    6127, 24801
    libinput Drag Lock Buttons (327):   <no items>
    libinput Horizontal Scroll Enabled (328):   1

$ xinput list-props "TPPS/2 IBM TrackPoint"
Device 'TPPS/2 IBM TrackPoint':
    Device Enabled (165):   1
    Coordinate Transformation Matrix (167): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Natural Scrolling Enabled (311):   0
    libinput Natural Scrolling Enabled Default (312):   0
    libinput Scroll Methods Available (315):    0, 0, 1
    libinput Scroll Method Enabled (316):   0, 0, 1
    libinput Scroll Method Enabled Default (317):   0, 0, 1
    libinput Button Scrolling Button (329): 2
    libinput Button Scrolling Button Default (330): 2
    libinput Middle Emulation Enabled (321):    0
    libinput Middle Emulation Enabled Default (322):    0
    libinput Accel Speed (323): 0.000000
    libinput Accel Speed Default (324): 0.000000
    libinput Accel Profiles Available (331):    1, 1
    libinput Accel Profile Enabled (332):   1, 0
    libinput Accel Profile Enabled Default (333):   1, 0
    libinput Left Handed Enabled (325): 0
    libinput Left Handed Enabled Default (326): 0
    libinput Send Events Modes Available (288): 1, 0
    libinput Send Events Mode Enabled (289):    0, 0
    libinput Send Events Mode Enabled Default (290):    0, 0
    Device Node (291):  "/dev/input/event17"
    Device Product ID (292):    2, 10
    libinput Drag Lock Buttons (327):   <no items>
    libinput Horizontal Scroll Enabled (328):   1

$ xinput
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Synaptics TM3075-002                      id=12   [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=13   [slave  pointer  (2)]
⎜   ↳ TrackPoint Keyboard II Mouse              id=19   [slave  pointer  (2)]
⎜   ↳ TrackPoint Keyboard II Consumer Control   id=22   [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)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                    id=11   [slave  keyboard (3)]
    ↳ Integrated Camera: Integrated C           id=9    [slave  keyboard (3)]
    ↳ HD Webcam C525                            id=14   [slave  keyboard (3)]
    ↳ TrackPoint Keyboard II Keyboard           id=20   [slave  keyboard (3)]
    ↳ TrackPoint Keyboard II System Control     id=21   [slave  keyboard (3)]
    ↳ TrackPoint Keyboard II Consumer Control   id=23   [slave  keyboard (3)]

$ cat  /usr/share/X11/xorg.conf.d/40-libinput.conf 
# Match on all types of devices but joysticks
#
# If you want to configure your devices, do not copy this file.
# Instead, use a config snippet that contains something like this:
#
# Section "InputClass"
#   Identifier "something or other"
#   MatchDriver "libinput"
#
#   MatchIsTouchpad "on"
#   ... other Match directives ...
#   Option "someoption" "value"
# EndSection
#
# This applies the option any libinput device also matched by the other
# directives. See the xorg.conf(5) man page for more info on
# matching devices.

Section "InputClass"
        Identifier "libinput pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Section "InputClass"
        Identifier "libinput tablet catchall"
        MatchIsTablet "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

$ sudo libinput list-devices | grep -A 17 "TPPS"
Device:           TPPS/2 IBM TrackPoint
Kernel:           /dev/input/event17
Group:            14
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   *button
Click methods:    none
Disable-w-typing: n/a
Accel profiles:   flat *adaptive
Rotation:         n/a

$ sudo libinput list-devices | grep -A 17 "TrackPoint Keyboard II Mouse"
Device:           TrackPoint Keyboard II Mouse
Kernel:           /dev/input/event23
Group:            15
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   button
Click methods:    none
Disable-w-typing: n/a
Accel profiles:   flat *adaptive
Rotation:         n/a

$ xinput set-prop "TrackPoint Keyboard II Mouse" 317 0, 0, 1
X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  131 (XInputExtension)
  Minor opcode of failed request:  57 ()
  Serial number of failed request:  20
  Current serial number in output stream:  21
user3188445 avatar
nl flag
I have two of the bluetooth keyboards. The older keyboard works fine, while the one I just purchased exhibits the annoying behavior you are describing. Note that these are two of the exact same keyboard. I also have the older model bluetooth keyboard (the one without a dongle or android switch), and the scrolling works fine on that, too. I wish I knew how to work around the problem.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.