Using Media Keys with Photon Keyboard Library

I’m trying to use the photon keyboard library to make a media controller for my Mac, however it seems that some keycodes are not being sent, or at least not being recognised by OSX.

I’m trying as set here but that doesn’t seem to work.

I have an application on mac called Karabiner, which comes with an event viewer which displays the keycodes of buttons pressed. When I press the play key on my actual keyboard, it logs a key code of 0xCD which is mapped to keypad space in the above file, but even using that, or the hex code directly, displays nothing on the event viewer.

Other keycodes seem to work like mute for instance.

I wonder if this is just a problem with OSX (Mojave) or something I’m doing wrong.

Any help appreciated.

1 Like

Sorry to bump such an old thread, but I haven’t found any other references Media Keys in the forums.

I’m also trying to emulate Media Keys using the Keyboard HID in Photon, but not much success.

I checked the source code and documentation, and while the media keys are documented in spark_wiring_usbkeyboard_scancode.h, it seems the Keyboard implementation only supports *keycodes ranging from 0x04 (KEY_A / Keyboard a and A) to 0xDD (KEY_KPHEX / Keypad Hexadecimal) .

From what I was able to see, all the media keys are above 0xDD. E.g.:

  KEY_AUDIONEXT          = 0x102,
  KEY_AUDIOPREV          = 0x103,
  KEY_AUDIOSTOP          = 0x104,
  KEY_AUDIOPLAY          = 0x105,
  KEY_AUDIOMUTE          = 0x106,


The scancodes from my keyboard for the Play/Pause button report:
0xe0 0x22, which match other documentation on the web, but it’s different than what Photon has in its HID / scan code translation table, above.

Does anybody have an idea how to get the Keyboard HID to accept scan codes higher than 0xDD and emulate play/pause, next, previous media keys?

Thanks in advance.