USBComposite and keymapping

Post here all questions related to LibMaple core if you can't find a relevant section!
Post Reply
Phil242
Posts: 7
Joined: Tue Aug 09, 2022 10:10 pm

USBComposite and keymapping

Post by Phil242 »

Hi,

USBComposite is working like a charm to simulate a keyboard.

But, how to deal with key-mapping ?
On my test machine I have a french keyboard (AZERTY) and a "Keyboard.press('a');" give a "q".

Is there a way to deal with this problem ?

Cheers,

Phil
arpruss
Posts: 83
Joined: Sat Dec 21, 2019 10:06 pm

Re: USBComposite and keymapping

Post by arpruss »

Background: https://stackoverflow.com/questions/393 ... d-keyboard

I guess you'll need to generate a map for the locale. I don't think there is a general solution on the stm side.
Phil242
Posts: 7
Joined: Tue Aug 09, 2022 10:10 pm

Re: USBComposite and keymapping

Post by Phil242 »

Hi Arpruss,

Thanks for the pointer.

As the project was for an event mid November, I've found a quick & dirt solution: I have map myself an AZERTY keyboard over the QWERTY template I've found. Just modify the output code with a translate table.
The major issue was the need of the key "Alt Gr" to obtain the specific chars related to this combo key. If someone have to do a similar job, have a look at the "modifiers". So the table is a char translation plus optionally the Alt Gr or Shift pressed and released.

It's so ugly, I can't show this mess ... But it worked as expected.
It's a shame I can't commit it, but as I'm not an expert of those HID devices, my patch will not be useful to someone aware of how it really works.

Cheers,

Phil
celinedion
Posts: 1
Joined: Thu Feb 02, 2023 6:42 am

Re: USBComposite and keymapping

Post by celinedion »

arpruss wrote: Tue Dec 27, 2022 3:10 pm Background: https://stackoverflow.com/questions/393 ... d-keyboard

I guess you'll need to generate a map for the locale. I don't think there is a general solution on the stm side.
I had a similar problem. I will try it. Thank you!
Post Reply

Return to “General discussion”