0

I have modified the STM32F1 USB HID Device Example generated by STM32CubMX from Mouse to a Keyboard and I am able to send characters to the host by sending the scan codes in the USB Reports.

Now I want some special characters to be sent from the keyboard on the press of a specific button.

They way I see it is to send the scan codes for the keys that comprise the Unicode for the character.

For Example to send a smiley with Unicode U+1F601 (Decimal 128513) to a windows machine I will have to send scan codes for 1,2,8,5,1,3. What I don't understand is how to send this with the ALT Key modifier ?

All the scan codes should be sent in a single report with the ALT Modifier set or in different reports ?

I have a Ubuntu machine and sending CTRL+SHIFT+u in the report then the scan codes followed by an Enter key works fine.

RishabhHardas
  • 495
  • 1
  • 5
  • 25

1 Answers1

1

As far as I know you send the ALT key modifier first and then the scan codes of the keys. That should work just fine. You need to keep in mind the key-down and key-up event so when you don't need the ALT modification you need to send the key-up.

Clifford
  • 88,407
  • 13
  • 85
  • 165
Stefan
  • 36
  • 8
  • 1
    Comments should not be used to post answers in any case. This appears to be an answer, so _not posting as a comment_ is exactly the right thing to do. Including discussion of your SO privileges is however irrelevant. – Clifford Aug 26 '19 at 11:16
  • Okay, thanks for the information. I just did not have the feeling that my answer was researched in detail, because I remembered it from the top of my head. – Stefan Aug 26 '19 at 11:37