tmk / tmk_keyboard

Keyboard firmwares for Atmel AVR and Cortex-M
4k stars 1.71k forks source link

Eject key on Mac #774

Closed tmk closed 8 months ago

tmk commented 8 months ago

Apple Magic Keyboard Eject key is 'Eject 0xB8 of Consumer Page 0x08'. https://verityj.github.io/2023/06/17/eject.html

TMK KC_EJCT and AC_EJCT is actually 'Stop/Eject - 0xCC of Consumer Page 0x08' as of 2024-03.

How do Windows, Linux and Mac recognize the keys?

Can we replace 0xCC with 0xB8 simply?

Anyway, 0xB8 consumer key is need to be available on TMK.

BTW, HHKB pro/pro2(PD-KB300/400) uses 'F20 - 0x6F of Keyboard Page 0x07' for its Eject key(Fn+f). https://github.com/tmk/tmk_keyboard/issues/250

HHKB classic(PD-KB401) uses 'Eject - 0xB8 of Consumer Page 0x08'.

https://github.com/tmk/tmk_keyboard/wiki/FAQ-Keymap#eject-on-mac-osx

tmk commented 8 months ago

Xev shows on Ubuntu for 'Stop/Eject - 0xCC of Consumer Page 0x08':

    root 0x6b0, subw 0x0, time 1113870379, (-190,203), root:(1881,1194),
    state 0x10, keycode 248 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x5a00001,
    root 0x6b0, subw 0x0, time 1113870489, (-190,203), root:(1881,1194),
    state 0x10, keycode 248 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

for 'Eject 0xB8 of Consumer Page 0x08':

KeyPress event, serial 37, synthetic NO, window 0x5c00001,
    root 0x6b0, subw 0x0, time 1114072490, (-432,119), root:(1639,1110),
    state 0x10, keycode 169 (keysym 0x1008ff2c, XF86Eject), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x5c00001,
    root 0x6b0, subw 0x0, time 1114072607, (-432,119), root:(1639,1110),
    state 0x10, keycode 169 (keysym 0x1008ff2c, XF86Eject), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

for F20:

KeyPress event, serial 38, synthetic NO, window 0x5a00001,
    root 0x6b0, subw 0x0, time 1116492385, (-283,204), root:(1788,1195),
    state 0x10, keycode 198 (keysym 0x1008ffb2, XF86AudioMicMute), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x5a00001,
    root 0x6b0, subw 0x0, time 1116492489, (-283,204), root:(1788,1195),
    state 0x10, keycode 198 (keysym 0x1008ffb2, XF86AudioMicMute), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

Eject 0xB8 key makes disc drive tray open on ubuntu.

tmk commented 8 months ago

Windows 10 does not seems to recognize both 0xB8 and 0xCC.

tmk commented 8 months ago

Can we replace 0xCC with 0xB8 simply?

Yes, probably. There will be no big problem.

tmk commented 8 months ago

Now, TMK KC_EJCT(and AC_EJCT) are 'Eject 0xB8 of Consumer Page 0x08' as same as Apple Magic Keyboard.

MacOS should recognize the key. Not tested yet.

Prebuilt firmwares other than hhkb project should be compiled but not yet.