Author Topic: How is the "Keyboard Power" scancode used on Mac?  (Read 2722 times)

0 Members and 1 Guest are viewing this topic.

Offline metalliqaz

  • * Maker
  • Thread Starter
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
How is the "Keyboard Power" scancode used on Mac?
« on: Mon, 23 February 2015, 12:19:45 »
Hey guys, being a windows user I'm confused by this key and how I should support it.

The USB HID usage page 7 for keyboards defines scancode 0x66 as "Keyboard Power" and only lists it as supported on the Mac platform.  It also implies through a footnote that it never mapped to a key.

If I remember correctly, the KMAC keymapper included this scancode but it didn't do anything on Windows.  (I haven't used it in a long time)

So is this scancode useful when mapped to a key on the Mac?  What does it do?  Should I add it as an option?

To all you poor Apple users, thanks for any insights!

Offline metalliqaz

  • * Maker
  • Thread Starter
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: How is the "Keyboard Power" scancode used on Mac?
« Reply #1 on: Mon, 23 February 2015, 12:52:08 »
So there's a wiki page on the topic: https://en.wikipedia.org/wiki/Apple_Keyboard

However I'm still not sure if the modern USB boards actually send that scancode.  It appears the older boards had dedicated lines for the power switch.

Offline MJ45

  • HHKB Pro
  • Posts: 530
  • Location: Chicagoland
Re: How is the "Keyboard Power" scancode used on Mac?
« Reply #2 on: Mon, 23 February 2015, 13:27:59 »
I think that was from the ABD days before Apple went to USB.

Offline tufty

  • Posts: 347
  • Location: French Alps
Re: How is the "Keyboard Power" scancode used on Mac?
« Reply #3 on: Mon, 23 February 2015, 15:03:43 »
However I'm still not sure if the modern USB boards actually send that scancode.  It appears the older boards had dedicated lines for the power switch.
The older boards for ADB based macs do both.  They send a scancode, which the OS interprets as a command to power down, *and* do soft power on through the extra wire in the ADB connector.

The USB keyboards, with the exception of the original USB keyboard, don't have a power button.  You'd want to look at what's sent when you do cmd-option-eject, which is the "power off" keystroke these days

Offline hasu

  • Posts: 3474
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: How is the "Keyboard Power" scancode used on Mac?
« Reply #4 on: Tue, 24 February 2015, 08:36:24 »
I've not owned Mac for long time since my first-gen Macbook pro was broken miserably but I can remember 0x66 works on OSX.
Mac mode of HHKB sends the code as Power key(Fn + Esc).

Linux also recognize that code without problem but poor Windows doesn't so we have to use Usage page 0x01 instead.


EDIT: IIRC, volume control keys(0x7F, 0x80, 0x83) also can be used on Linux and Mac but not Windows :(
« Last Edit: Tue, 24 February 2015, 08:43:50 by hasu »

Offline metalliqaz

  • * Maker
  • Thread Starter
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: How is the "Keyboard Power" scancode used on Mac?
« Reply #5 on: Tue, 24 February 2015, 12:03:15 »
Thanks Hasu :)

I added the scancodes to the selector.  What the heck, doesn't hurt anything.

Aqua's key test on Windows saw a scancode but obviously didn't match it to anything.

Also apparently Mac-only is the KEYPAD_EQUALS, which I think is 0x67.