linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harald Welte <laforge@gnumonks.org>
To: ValdikSS <iam@valdikss.org.ru>
Cc: linux-input@vger.kernel.org
Subject: hid-lenovo breaks middle mouse button on tpIIkbd
Date: Sat, 7 Sep 2024 12:18:18 +0200	[thread overview]
Message-ID: <Ztwoai8_1L0rJkYp@nataraja> (raw)

Dear ValdikSS,
Dear Linux Input maintainers,

I've recently acquired a brand new tpIIkbd (ThinkPad TrackPoint Keyboard II)
which I use via bloetooth.  Sadly, the center mouse button never worked and
I finally got to try to debug what's going on here.

The keyboard has a small slider swithc to select between Android and
Windows mode.  I've set it to "windows" mode, but couldn't observe any
difference in the bug in both modes.

The keyboard shows up as /sys/kernel/debug/hid/0005:17EF:60E1.000F

== btmon

* the events are visible on bluetooth with "BTMON". Middle mouse button
  press+release looks like this:

> ACL Data RX: Handle 10 flags 0x02 dlen 11                                          #32 [hci0] 14.353057
      ATT: Handle Value Notification (0x1b) len 6
        Handle: 0x001c
          Data[4]: 04000000
> ACL Data RX: Handle 10 flags 0x02 dlen 11                                          #33 [hci0] 15.357078
      ATT: Handle Value Notification (0x1b) len 6
        Handle: 0x001c
          Data[4]: 00000000

== bluetoothd

* bluetoothd is feeding those into uhid (I checked this via strace,
  looks like this:

read(30, "\x1b\x1c\x00\x04\x00\x00\x00", 23) = 7
writev(33, [{iov_base="\x0c\x00\x00\x00\x05\x00\x02\x04\x00 ...

where '30' is the L2CAP socket and '33' is the /dev/uhid device


== /sys/kernel/debug/hid/*/event

/sys/kernel/debug/hid/*/event:

report (size 5) (numbered) =  02 04 00 00 00
Button.0001 = 0
Button.0002 = 0
Button.0003 = 1
GenericDesktop.X = 0
GenericDesktop.Y = 0
GenericDesktop.Wheel = 0

== evtest

However, evtest shows exactly nothing when the centre button is pressed
or depressed.  It works just fine for left and right button.

so somehow the events that look perfectly valid on btmon and as HID event
are lost between /dev/uhid and /dev/event*

When I rmmod the hid-lenovo module, it suddenly starts working and the
evnets are showing up in evtest (and I can start to paste the buffer
with the center button like on any other mouse/trackpad).

There are some BTN_MIDDLE quirks/workarounds in hid-lenovo.c that I don't
understand (I'm not a HID or linux input expert at all).  But my best
guess at this point is that either that code is broken, or Lenovo has
released a new version of that keyboard [or its firmware] which doesn't
need the workaround designed for earlier versions?

Having the module loaded but doing
echo 0 > /sys/devices/virtual/misc/uhid/0005:17EF:60E1.000F/middleclick_workaround
will *not* fix the bug.  The middle button is not working for both 1 or
0 in that middleclick_workaround file.

Regards,
	Harald

-- 
- Harald Welte <laforge@gnumonks.org>          https://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)

             reply	other threads:[~2024-09-07 10:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-07 10:18 Harald Welte [this message]
2024-09-10 22:07 ` hid-lenovo breaks middle mouse button on tpIIkbd ValdikSS
2024-09-10 23:51   ` ValdikSS
2024-09-11  6:22     ` Harald Welte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ztwoai8_1L0rJkYp@nataraja \
    --to=laforge@gnumonks.org \
    --cc=iam@valdikss.org.ru \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).