Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jan 2024 16:40:26 +0000
From:      Frank Hilgendorf <frank.hilgendorf@posteo.de>
To:        freebsd-usb@freebsd.org
Subject:   ukbd - Different approach for key swap on Apple keyboards 
Message-ID:  <9D6F7423-185F-4446-9DB2-8FAE8065E67B@posteo.de>

next in thread | raw e-mail | index | archive | help
Hi,

I am struggling  bit with the keyboard setup on an old Apple notebook =
and would like to propose a change in ukbd.c

The ukbd keyboard driver contains a swap function for the [<>] and [=C2=B0=
^] keys on Apple keyboards.=20
The decision to activate the key swap is based on the presence of the =
[Eject] key in the keyboard HID table.

On my old MacbookPro 3,1 with german keyboard, swapping is not activated =
although it would be necessary.
This is because the [Eject] key is located in a separate HID table.

Looking into the git log and into the archives of this mailing list, I =
found that this theme has been addressed early 2010.
A patch had been added that enabled the swap key logic also on the =
presence of the [FN] key. After a short time this patch has been =
reverted.=20
The back and forth in the patches indicates that the implemented logic =
to activate key swap does not work precisely enough.

Approach 1)
The driver should not only check whether it is an Apple keyboard or not, =
but should as well check whether it is an ANSI / ISO / JIS keyboard.
The ISO keyboard has the left [SHIFT] key split into [SHIFT] and [<>] =
keys. My assumption is, that key swap is necessary for ISO keyboards (as =
mine is), but not for ANSI keyboards. (I don't know nothing about the =
japanese JIS keyboards).
This can be accomplished using the USB vendor-ID and product-ID. Apple =
ANSI, ISO and JIS keyboards have different product IDs.
This could simply be a static table with [product ID / swap flag] in the =
driver (similar to the one in the atp trackpad driver).=20
As a disadvantage, this table would have to updated each time Apple =
releases a new keyboard type.

Approach 2)
Simpler: don't let the driver try to figure out whether to swap or not. =
Just add a sysctl variable and let the user decide.

What do you think would be the best solution?

Regards, Frank=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9D6F7423-185F-4446-9DB2-8FAE8065E67B>