On 07.09.2024 13:18, Harald Welte wrote:
Dear ValdikSS,
Dear Linux Input maintainers,
Hello Harald,
Nice to meet you, I know you from Osmocom project!
You found a REGRESSION (and not in hid_lenovo)! Look below.
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.
You need to use Windows mode only. Android mode does not have all the
capabilities.
The keyboard shows up as /sys/kernel/debug/hid/0005:17EF:60E1.000F
Same for me.
== 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
ATT: Handle Value Notification (0x1b) len 6
Handle: 0x001c
Data[4]: 04000000
ACL Data RX: Handle 10 flags 0x02 dlen 11
ATT: Handle Value Notification (0x1b) len 6
Handle: 0x001c
Data[4]: 00000000
Hrm, these events are generated when the keyboard is not in "native"
mode (when the kernel module is not loaded for example).
Here's what the middle button should generate in "native" mode (over
Bluetooth):
ACL Data RX: Handle 2048 flags 0x02 dlen 15
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0024
Data[8]: 0004020000000000
ACL Data RX: Handle 2048 flags 0x02 dlen 15
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0024
Data[8]: 0000020000000000
But you're right, something does not work correctly.
The keyboard correctly enters native mode only after pairing or full
Bluetooth reloading. Middle button does not work for me if the keyboard
is just disconnected or powered off/on.
This seems to be because Bluetooth layer does not disconnect the input
device upon disconnecting Bluetooth, and reconnecting the keyboard just
"resumes" the input device, but does not re-initialize it properly. You
can see that by not-lid left LED indicator (ESC button). It should be
lid by default if initialized properly.
I haven't thoroughly used the keyboard for about a year, and last time I
used it, I don't remember such issue.
Just booted up Fedora 39 from ISO (not updated, release from November
2023) on 2 of my computers, and yes, it works correctly: the keyboard is
detected as new input device (in dmesg) on every power off/power on
cycle, and initialized correctly every time, middle button works.
Fedora 40 ISO (from 15 Apr 2024) — does not work, power off/power on
results in broken middle button, keyboard is NOT detected as new input
device in dmesg upon off/on (it "resumes" old input device).
Known good configuration from Fedora 39:
kernel 6.5.6
bluez 5.69
Known bad configuration from Fedora 40:
kernel 6.8.5
bluez 5.73
Old Fedora 39 doesn't ever detect the keyboard as "bluez-hog-device",
maybe that could be the clue.
All I can say is that lenovo_hid is not the culprit — I tried to use my
old module and it doesn't work on a new system either.
I don't have much time to run bisect right now, sorry.