archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <>
To: Bastian Venthur <>,
	linux-input <>
Subject: Re: fn-key issue with hid_apple and keychron keyboards
Date: Mon, 17 May 2021 11:50:05 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Hi Bastian,

On 5/17/21 9:46 AM, Bastian Venthur wrote:
> Hello Hans,
> I'm writing you because apparently you provided the patch [1] for Linux "Disable Fn-key key-re-mapping on clone keyboards" -- which seems related to a bug I've found with Keychron C1 keyboard.
> I'm really sorry if you're not the right contact for those kind of issues, and would be very happy if you could point me to the correct ones.

It is usually a good idea to at least Cc the relevant linux mailinglist on
questions like this. I've added the linux-input list to the Cc now.

> I recently got a Keychron C1 keyboard (but I gather, other Keyboards from this company are affected as well). The keyboard has a physical switch for "Windows" and "Mac" modes, however in both cases the kernel recognizes it as an Apple keyboard and loads the "hid-apple" module. However it does *not* recognize the 'Fn' key and disables it. But the keyboard has one and I have to enable it manually either via:
> # as root:
> echo 2 > /sys/module/hid_apple/parameters/fnmode
> or permanently:
> options hid_apple fnmode=2
> in /etc/modprobe.d/hid_apple.conf
> Without this, I cannot use the Function-keys, they will always be used as Multimedia-keys, regardless if you press Fn + F1 or not.
> Here's the relevant dmesg output when i plug the keyboard in.
> [    6.234069] apple 0003:05AC:024F.0004: input,hidraw3: USB HID v1.11 Keyboard [Keychron Keychron C1] on usb-0000:06:00.4-
> [    6.234261] apple 0003:05AC:024F.0005: Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling
> [    6.294181] apple 0003:05AC:024F.0005: input,hidraw4: USB HID v1.11 Keyboard [Keychron Keychron C1] on usb-0000:06:00.4-

Ok, so the keyboard presents itself as 2 interfaces. and the "Fn key not found" message
is only being printed for the second interface. So I guess that the trouble F1-F12 keys
are actually coming out of the first interface (the 0003:05AC:024F.0004 device above).

What my patch does it completely disables the fnmode handling, similar to setting the
fnmode parameter to 0, but unlike my (Maxxter KB-BT-001 Bluetooth keyboard) "clone" your
keyboard does actually advertise a Mac style Fn key in its descriptors, at least for the
first interface so it is treated as a standard Mac keyboard where the non Fn behavior of
the F-keys is to send the multimedia events. Normally pressing Fn + F1 - F-12 should then
result in the kernel actually sending F1-F12 and setting fnmode=2 should just invert when
you need to press Fn.

Basically the way the actual mac keyboards work is the simply always send F1 - F12 events
and a separate Fn event and leave it up to the OS to translate this to either plain
F1 - F12 or to the multimedia codes. Where as normal keyboards handle the Fn press
internally and actually send different "scancodes" over the wire to the computer when
Fn + F1 - F12 is pressed.

But if I understand you correctly then the Fn translation hid-apple is doing to make
things work as expected with Mac keyboards is not working for you, IOW with fnmode=1
pressing Fn + F1 does not result in F1 being send, correct ?  This means that your
keyboard behaves more like a normal keyboard instead of as an apple keyboard.

I also wonder if the Fn key sends any events at all (or if it is fully handled internally)...

> I have no idea how to fix this, but I can provide additional information if needed.

Please become root ("sudo su -") and then do:

/sys/kernel/debug/hid/0003:05AC:024F.*/rdesc > Keychron-C1-rdesc

And attach the generated Keychron-C1-rdesc file to your next email.

Also please as root run:

sudo evemu-record

And then select the device belonging to your keyboard and press F1, Fn and Fn + F1,
please repeat this for all input devices belonging to your keyboard and then
copy and paste the output of each run into your next email.



       reply	other threads:[~2021-05-17  9:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2021-05-17  9:50 ` Hans de Goede [this message]
2021-05-17 11:08   ` fn-key issue with hid_apple and keychron keyboards Bastian Venthur
2021-05-17 14:26     ` Hans de Goede
2021-05-17 14:47       ` Bastian Venthur
2021-06-23 14:16         ` Hans de Goede
2021-06-24  7:35           ` Bastian Venthur
2021-08-27  7:39             ` Bastian Venthur
2021-08-30  9:24               ` Hans de Goede
2021-08-30  9:25                 ` Hans de Goede
2022-07-31 19:12                   ` Bastian Venthur
2022-07-31 19:46                     ` Hans de Goede

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:

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

  git send-email \ \ \ \ \

* 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).