USB keyboard issues

Status
Not open for further replies.

Maleckii

New member
I'm developing a USB/bluetooth keyboard based on the Teensy 3. I've managed to get most things working, but there's two issues I've noticed.

It looks like setting keyboard_media_keys doesn't work properly in Windows. I can get keypresses for Play/Pause to register in Linux, but not Windows 10. Digging through the forums a little bit, it looks like this has been known for awhile. I'm not very clear on why this doesn't work on Windows. It looks like the HID report descriptor for KEYBOARD_INTERFACE does include a Consumer usage page, but I admit that's pretty much the extent of my knowledge of the USB code or how it work.s

The second issue is that the Teensy doesn't appear to be able to wake the computer from sleep on keypress. I'm not sure what magic happens to make that work, but I should be able to press any key on the keyboard while the host computer is asleep to wake it.

(Embarrassing) code is here: https://github.com/Maleckii/armkeys/tree/devel
 
So, I've done a little more digging into this. It looks like the kiibohd project (https://github.com/kiibohd/controller/tree/master/Output/pjrcUSB/arm) does implement media keys on Windows, but they do that by defining a new USB interface in a way that's a little over my head.

I tried setting the remote wakeup configuration bit on the HID config descriptor as well to try and fix the wakeup issue, but that didn't seem to help either. That's 0xE0 or 0xA0 for bmAttributes instead of 0xC0.
 
Small amount of progress? I've broken out the consumer control/media keys handling into another USB interface, and created a function in usb_keyboard.c to handle sending the HID report for the media keys. As always, the code is here: https://github.com/Maleckii/armkeys/tree/devel That's the same approach that's taken by the kiibohd project on Teensy 3, and the tmk_keyboard project on Teensy 2.

But again nothing seems to work on Windows. System control (sleep, etc) and media control keys work perfectly fine in Linux on the new interface, but don't work at all in Windows. I've tested both my keyboard firmware and a regular Logitech keyboard in Linux with evtest. Both keyboards look like they're sending identical keycodes. Is there something special that Windows wants in the way that I send the HID report to actually work?
 
Status
Not open for further replies.
Back
Top