From: George Koehler Subject: Re: Numpad on macppc laptops To: jon@elytron.openbsd.amsterdam Cc: tech@openbsd.org Date: Thu, 11 Apr 2024 02:13:58 -0400 On Mon, 8 Apr 2024 17:24:42 +0000 (UTC) jon@elytron.openbsd.amsterdam wrote: > Hello everyone. This diff is about enabling the numlock and numpad > (see some of the keys on the right side of the keyboard in [1]) on > these old powerbooks and ibooks. > > [1] https://www.techstar.co.nz/wp-content/uploads/2017/04/lpkbapple01.jpg My macppc PowerBook is running your diff, but it has no effect; I have an ADB keyboard akbd(4); your diff is for a USB keyboard ukbd(4). Apple might have switched from ADB to USB in later models. My akbd(4)'s numpad already works in OpenBSD, and the behavior is near what you describe for OSX. The 'c' on my '6' key is my Mac Clear key, which is the same as a Windows Num Lock key, but different from my Mac Num Lock key, so I have 2 different Num Locks in OpenBSD, - My 'M 0' key sends lowercase 'm'. - Fn + 'M 0' sends KP_Insert in xev(1). - Fn + Shift + 'M 0' sends KP_0 if it works, else KP_Insert. (Shift doesn't work if I push Fn before Shift.) - Fn + '6 c' sends Num_Lock, which toggles Windows Num Lock in X11. If Windows Num Lock is on, - Fn + 'M 0' sends the digit KP_0. - Fn + Shift + 'M 0' sends KP_Insert if it works, else KP_0. - Fn + F6 sends F6. - F6 without Fn toggles Apple Num Lock, which disables most keys. If Apple Num Lock is on, - 'M 0' sends KP_Insert. - Shift + 'M 0' sends KP_0. - '6 c' sends Num_Lock, which toggles Windows Num Lock. If both Windows Num Lock and Apple Num Lock are on, - 'M 0' sends KP_0. - Shift + 'M 0' sends KP_Insert. This behavior confuses me, because I have 2 different Num Locks, and the key that sends KP_Insert is only labelled 'M' and '0'. Apple Num Lock also toggles the light under the words "num lock" on my F6 key. Windows Num Lock doesn't have a light on the laptop, but does toggle the Num Lock light on my external USB keyboard. > In contrast, in the (proof of concept) implementation I present > here [2], we always need to press fn, and the behavior pretty much > the default openbsd one: > > * If numlock is not activated, we get the usual numpad keys such > as KS_KP_UP or KS_KP_Decimal by pressing the numpad keys plus fn. > > * If numlock is activated, we get the numbers or +=-/* symbols with > the appropiate key, plus fn. > > * If shift is held, the behavior is reversed. This makes more sense, if there is only one Num Lock. The internal USB keyboards don't need to mimic the confusing ADB behavior. > Another nitpick I can think of is mapping KS_KP_Enter to the comma > key. Although not marked, it might be a good idea for completeness > (ukbd code 88 I think). "enter" is marked on the "return" key. On my ADB keyboard, "return" sends Return and Fn + "return" sends KP_Enter. The other "enter" key, left of the arrows, also sends KP_Enter. Your diff has 16 mappings, but I count 18 keys; you mapped neither Clear nor Enter. --gkoehler