ukbd, hkbd, evdev: fix apple "magic" keys#1998
Conversation
Signed-off-by: tslight <tslight@pm.com>
|
Thank you for taking the time to contribute to FreeBSD! All issues resolved. |
Signed-off-by: tslight <tslight@pm.com>
a501b01 to
02c6a82
Compare
Signed-off-by: tslight <tslight@pm.com>
Signed-off-by: tslight <tslight@pm.com>
23dd387 to
61fdaf1
Compare
Signed-off-by: tslight <tslight@pm.com>
Signed-off-by: Toby Slight <tslight@pm.me>
63b4ac2 to
0f4f447
Compare
|
Hi there @wulf7 I saw some of your posts on the forums and looking at the history it seems you're the go to guy for this area of the tree - many thanks for all your hard work and contributions BTW! I was wondering if you wouldn't mind sharing your thoughts on this PR when you have a mo' :-) I'm very much a noob when it comes to FreeBSD & C so apologies if the approach is naive or totally wonky in some way... :-/ |
sys/dev/hid/hkbd.c
Outdated
| if (flags & HIO_VARIABLE) | ||
| sc->sc_flags |= HKBD_FLAG_APPLE_FN; | ||
| DPRINTFN(1, "Found Apple FN-key\n"); | ||
| if (hw->idVendor == 0x05ac) { /* belt & braces! */ |
There was a problem hiding this comment.
who is vendor 0x5ac? A comment would be good, better than belt and braces
There was a problem hiding this comment.
Yeah, I did consider using the USB_VENDOR_APPLE macro we have in ukbd, but it felt wrong importing usb code into hid. I'll just update the comment like you suggested.
|
This generally looks good, but a comment about what 5ac is would be good. It's unfortunate that a lot of this is duplicated between ukbd and hkbd, but maybe that can't be helped. |
I agree - it wasn't until I updated the Macbook 8,3 to current, discovered a bug in hid on that hardware, and had to revert to using ukbd, that I realised I needed to backport the changes to a legacy driver. Happy to investigate ways in which we could DRY this up, if that's something the project deems important... I'm currently playing around with a module for remapping keys that provides a hook to each driver through hid, so I'm already very much drinking from the fire-hose in this domain! ;-) Anyway, many, many thanks for the feedback and I'll push that updated comment ASAP. |
- Fn+K for ScrollLock as it's very useful to have ScrollLock on FreeBSD's TTY and other vendors use Fn+K for this purpose. - Fn+P for PrtSc/SysRq, as it's another very handy but sadly missing key on Macbooks. - Also, fix/make ukbd debug guard consistent with hkbd - currently won't compile if using GENERIC-NODEBUG... Signed-off-by: Toby Slight <tslight@pm.me>
I recently acquired 3 old Macbooks (MBP 8,3, MBA 6,1, MBA 7,2) and the Fn, Eject & Multimedia keys did not show up in the output of
kbdscan,evtestorxevor do anything but provideF1..F12whetherFnwas held or not.This PR fixes that and adds sysctls for toggling whether or not holding Fn is required to access the Multimedia keys.
I'm curious why we're looking for the Apple vendor usage page at
0xFFFFrather than the locations Linux looks for it? I found it at0x00FFon all 3 machines. I've left0xFFFFin there as I'm assuming it was set to that for a good reason and works on Apple hardware that Linux no longer supports.I've also added a
sysctlforukbd&hkbdto toggle the mode of the function keys similar to what's available on Linux, but would like to make a more convenient toggle via Fn+Esc at some point...Finally, one of the main motivations for this work was to get extra keys to bind to my desires in userland which is why I've "unhidden" the Fn and Eject keys. I chose
KEY_WAKEUPfor Fn, asKEY_FNdoesn't make it to X, andXF86WakeUpcommonly shows up on the Fn key back in penguin land...