Author Topic: How is key repeat handled on MacOS  (Read 2214 times)

0 Members and 1 Guest are viewing this topic.

Offline gator456

  • Thread Starter
  • Posts: 30
How is key repeat handled on MacOS
« on: Mon, 23 October 2023, 10:27:22 »
Hello

I have implemented a keyboard controller using the PJRC Teensy microcontroller.  I used the example on their page to implement the firmware (https://www.pjrc.com/teensy/usb_keyboard.html)

The problem I am seeing is that if I hold down a key I do not get a repeat for MacOS but I do get a repeat for Windows&Linux.

After some searching on the internet I found that you have to turn on repeat in the MacOS:
https://www.howtogeek.com/267463/how-to-enable-key-repeating-in-macos/

With this change I get repeats on the laptop keyboard and commercial keyboards.  However MacOS will not give me repeats on my keyboard.
BTW: I do not own a USB bus sniffer or a logic analyzer.

A typical event sequence from my controller looks like
- Key is pressed & keycode is sent
- Key is released & 0x00 is sent (this is the key release event)

For a hold of A key the sequence of events is:
- Letter 'A' is pressed & controller send 0x04
- If the OS does not see a key release event (0x00) then the OS starts repeating the key (until 0x00 is sent)

With MacOS a repeat never occurs.

I am unable to figure out what a commercial keyboard is doing different.

Anyone have experience with this?