Author Topic: Need help with USB keyboard project (MacOs)  (Read 740 times)

0 Members and 1 Guest are viewing this topic.

Offline gator456

  • Thread Starter
  • Posts: 30
Need help with USB keyboard project (MacOs)
« on: Mon, 03 April 2017, 12:14:24 »
To all

I am looking for assistance on a USB keyboard project. I built a USB keyboard controller using a Teensy and the example code on pjrc.com. It has been working fine for years on Windows machines and Linux machines. Today I plugged it into a 2015 Macbook pro and I am seeing an odd behavior by the MacOS

If I type a fast key sequence like "it" then I am seeing double keys on the MAC. By using the hidlisten this is what I see going on

- 'I' key is pressed
- Keyboard sends a 0Cx to host
- 'T' key is pressed before the 'I' is released (I am not a fast typist but fast enough to have this happen fairly often)
- Keyboard sends USB event with both 0Cx and 17x
- 'i' key is released
- Keyboard sends USB event with 17x
- 'T' key is released
- Keyboard sends USB event with 00x

- On a windows host or Linux host this sequence is interpreted as 'it'
- On the MacOS this is interpreted as 'itit'

I have a section of the code that filters out debounce. I have tried increasing the debounce wait time. But this causes really quick key presses to get missed.  It seems to me the root issue is that the 'i' and 't' keys are down at the same time for a split second. 

I assume that the MacOS is expecting an event sequence like:
0Cx
00x
17x
00x

Suggestions?

Thanks