#1006251 USB Lenovo ThinkPad Compact Keyboard has fn_lock inverted

Package:
src:linux
Source:
linux
Submitter:
Josh Triplett
Date:
2022-11-12 15:57:02 UTC
Severity:
normal
Tags:
#1006251#3
Date:
2022-02-22 00:31:39 UTC
From:
To:
I have an external ThinkPad USB keyboard:

$ lsusb | grep -i keyboard
Bus 003 Device 022: ID 17ef:6047 Lenovo ThinkPad Compact Keyboard with TrackPoint

The Linux kernel exposes a fn_lock attribute in sysfs for this keyboard:

$ cat /sys/devices/pci0000:00/0000:00:14.0/usb3/3-5/3-5.4/3-5.4.3/3-5.4.3:1.1/0003:17EF:6047.000F/fn_lock
1

However, this attribute appears inverted for this particular keyboard:
it seems to be 1 when FnLock is *disabled* and 0 when FnLock is
*enabled*.

#1006251#8
Date:
2022-02-25 13:43:59 UTC
From:
To:
Hi Josh,

If you can reproduce this with either 5.16.10-1 (or later today
5.16.11-1) or the current version in experimental (5.17~rc4-1~exp1)
would it be possible you report it upstream and keep us updated on the
progress?

Regards,
Salvatore

#1006251#15
Date:
2022-11-11 15:46:52 UTC
From:
To:
Hi

This bug was filed for a very old kernel or the bug is old itself
without resolution.

If you can reproduce it with

- the current version in unstable/testing
- the latest kernel from backports

please reopen the bug, see https://www.debian.org/Bugs/server-control
for details.

Regards,
Salvatore

#1006251#18
Date:
2022-11-11 15:46:52 UTC
From:
To:
Hi

This bug was filed for a very old kernel or the bug is old itself
without resolution.

If you can reproduce it with

- the current version in unstable/testing
- the latest kernel from backports

please reopen the bug, see https://www.debian.org/Bugs/server-control
for details.

Regards,
Salvatore

#1006251#23
Date:
2022-11-11 17:02:56 UTC
From:
To:
reopen 1006251 6.0.6-2
thanks

I can confirm that this still exists in current kernels.

- Josh Triplett

#1006251#28
Date:
2022-11-11 17:06:57 UTC
From:
To:
I have an external ThinkPad USB keyboard:

$ lsusb | grep -i keyboard
Bus 003 Device 022: ID 17ef:6047 Lenovo ThinkPad Compact Keyboard with TrackPoint

The Linux kernel exposes a fn_lock attribute in sysfs for this keyboard:

$ cat
sys/devices/pci0000:00/0000:00:14.0/usb3/3-5/3-5.4/3-5.4.3/3-5.4.3:1.1/0003:17EF:6047.000F/fn_lock
1

However, this attribute appears inverted for this particular keyboard:
it seems to be 1 when FnLock is *disabled* and 0 when FnLock is
*enabled*. In order to enable FnLock, I have to write 0 to this file.

(Also, separately from that, it would be nice if the kernel could handle
fn_lock toggling *internally*, rather than expecting userspace to do it.
As far as I can tell, it does handle similar things for some keyboards,
but not this one.)

#1006251#33
Date:
2022-11-11 17:07:41 UTC
From:
To:
Reproduced with 6.0.6-2, and reported upstream (CCed to this bug).
#1006251#38
Date:
2022-11-11 19:41:50 UTC
From:
To:
Hi Josh.

Thank you for re-testing and reporting it upstream.

Regards,
Salvatore

#1006251#53
Date:
2022-11-12 15:23:11 UTC
From:
To:
Under Windows the default actions of the Function keys are the media
keys, i.e. pressing F1 is Mute. Fn-"Mute" is F1, or enabling Fn-Lock &
"Mute". That's why when /fn_lock is 1, the Mute key is F1.

With keyboards built into Thinkpads there's a BIOS setting to invert the
behaviour of Fn-Lock (and thus have Fn keys by default), as well as
swapping Fn<->Ctrl, but there's no equivalent option for the external
keyboards.

What's the wrong way around here is hid-lenovo assumes that you want
Fn-Lock on when connecting to the keyboard, not off. My assumption at
the time was that whilst it's different to how the keyboard behaves
under Windows, it'd be a more useful default.

Agreed. This was something I looked into when I was adding support for
the keyboards. For yours it's a pretty trivial addition, but for the USB
variant you can't send the command in the middle of the USB interrupt
receiving the keypress, solving this seemed to require quite a lot of
boilerplate for what would have been pretty trivial in userland.

Of course, It's very easily possible that I missed something, or there's
a helper to do this sort of thing that now exists.

Cheers,