git: bb8230f838c8 - main - hkbd(4): add some extra handy fn key bindings
Date: Sun, 29 Mar 2026 13:17:44 UTC
The branch main has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=bb8230f838c8d5f8d362a0dad4809908b44ae379
commit bb8230f838c8d5f8d362a0dad4809908b44ae379
Author: Toby Slight <tslight@pm.me>
AuthorDate: 2026-03-29 13:16:57 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2026-03-29 13:16:57 +0000
hkbd(4): add some extra handy fn key bindings
- Fn+S for ScrollLock as it's very useful to have ScrollLock on
FreeBSD's TTY.
- Fn+P for PrtSc/SysRq, as it's another very handy but sadly missing
key on Macbooks.
- Some other Fn+<key> combinations duplicating existing keys.
Apply the change to ukbd(4) as well.
Signed-off-by: Toby Slight <tslight@pm.me>
Reviewed by: wulf
MFC after: 1 month
Pull Request: https://github.com/freebsd/freebsd-src/pull/1998
---
sys/dev/hid/hkbd.c | 10 ++++++++++
sys/dev/usb/input/ukbd.c | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c
index 9ab02e940089..c98f4be69169 100644
--- a/sys/dev/hid/hkbd.c
+++ b/sys/dev/hid/hkbd.c
@@ -623,6 +623,16 @@ static uint32_t
hkbd_apple_fn(uint32_t keycode)
{
switch (keycode) {
+ case 0x0b: return 0x50; /* H -> LEFT ARROW */
+ case 0x0d: return 0x51; /* J -> DOWN ARROW */
+ case 0x0e: return 0x52; /* K -> UP ARROW */
+ case 0x0f: return 0x4f; /* L -> RIGHT ARROW */
+ case 0x36: return 0x4a; /* COMMA -> HOME */
+ case 0x37: return 0x4d; /* DOT -> END */
+ case 0x18: return 0x4b; /* U -> PGUP */
+ case 0x07: return 0x4e; /* D -> PGDN */
+ case 0x16: return 0x47; /* S -> SCROLLLOCK */
+ case 0x13: return 0x46; /* P -> SYSRQ/PRTSC */
case 0x28: return 0x49; /* RETURN -> INSERT */
case 0x2a: return 0x4c; /* BACKSPACE -> DEL */
case 0x50: return 0x4a; /* LEFT ARROW -> HOME */
diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c
index 3ebdf1e9747d..37deb5c56fbd 100644
--- a/sys/dev/usb/input/ukbd.c
+++ b/sys/dev/usb/input/ukbd.c
@@ -677,6 +677,16 @@ static uint32_t
ukbd_apple_fn(uint32_t keycode)
{
switch (keycode) {
+ case 0x0b: return 0x50; /* H -> LEFT ARROW */
+ case 0x0d: return 0x51; /* J -> DOWN ARROW */
+ case 0x0e: return 0x52; /* K -> UP ARROW */
+ case 0x0f: return 0x4f; /* L -> RIGHT ARROW */
+ case 0x36: return 0x4a; /* COMMA -> HOME */
+ case 0x37: return 0x4d; /* DOT -> END */
+ case 0x18: return 0x4b; /* U -> PGUP */
+ case 0x07: return 0x4e; /* D -> PGDN */
+ case 0x16: return 0x47; /* S -> SCROLLLOCK */
+ case 0x13: return 0x46; /* P -> SYSRQ/PRTSC */
case 0x28: return 0x49; /* RETURN -> INSERT */
case 0x2a: return 0x4c; /* BACKSPACE -> DEL */
case 0x50: return 0x4a; /* LEFT ARROW -> HOME */