How to use the context menu key with the Teensy keyboard emulation?

Status
Not open for further replies.

Experimentalist

Well-known member
Hi

I am trying to figure out how to send the context menu key which is usually positioned between the right Alt and Ctrl keys on UK keyboards, I am unsure as to its presence in other countries. I am using TeensyDuino with a Teensy 3 and "Serial + Keyboard + Mouse + Joystick". I have scoured keylayouts.h and can see no reference to this key. It has the same effect as clicking the right mouse button so I suppose I could use that as a work around but since it exists as a keyboard key I guess I should also be able to use something like:

Keyboard.set_key1(KEY_MNU);
Keyboard.send_now();

However KEY_MNU does not exist.

Can anyone advise hbow to do this?

Ta
Ex
 
try SHIFT + F10

Should be a windows generic keyboard shortcut to RMB on the current cursor pos :)

(this is ofcourse assuming you need it in Windows)
 
Try 0x75 instead of KEY_MNU. if that works you can add an entry to keylayouts.h: #define KEY_VK_APPS 0x75

if not and you are on windows, try with 0x5D.

let us know if it works.
 
Thanks for the replies, the mouse tricks are no good as I will need to move the cursor first. Tried 0x75 (117 decimal) and it appears to emulate the enter key, 0x5D is 93 decimal so will be KEYPAD_5 already defined in Keylayouts.h

I may just have to try sending 0x00 to 0xFF and see where I get !

Any other ideas gladly received?

Anyone know of free tools to spy on the HID traffic and figure it out that way?

Thanks again
 
Okay so tried what I said, simple really, sending 0x00 to 0xFF

The context menu key is 0x65 (101 Decimal)

I stopped my test then but guess it may be worth letting it execute to see what I learn :)
 
Great, you found the solution. Did you stumble over any of the media keys in the process? afaik they dont work under windows with the current lib.
 
I am trying to figure out how to send the context menu key which is usually positioned between the right Alt and Ctrl keys on UK keyboards, I am unsure as to its presence in other countries. I am using TeensyDuino with a Teensy 3 and "Serial + Keyboard + Mouse + Joystick". I have scoured keylayouts.h and can see no reference to this key.

You won't, because the codes in keylayouts.h go up to 115 (73 hex) while the official USB codes go up to 231 (hex E7). And the code you want is is fact the last one of those, E7 "Keyboard Right GUI". See pages 53-60 of
http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf

I have previously reported this, and offered a patch, but Paul does not want this because (mistakenly, in my view) he thinks these are related to the media keys and won't work in Windows. Why the 'right Windows key' wouldn't work in Windows, or why the IME switching keys for Japanese, Korean etc wouldn't work in Windows, beats me (last time I was in Japan most of the laptops I saw were running Windows). I can send you the additions to keylayouts.h if you PM me with an email address.
 
the code you want is is fact the last one of those, E7 "Keyboard Right GUI".

Hi

Thanks for the response but the key you refer to is the right Windows key not the applications key, which is defined on page 56 of said document as "101 decimal, 0x65, Keyboard Application". I wonder if this means Paul will include it in later versions of Keylayouts.h

I did email him the other day with the request but heard nothing back as yet.

I will PM you for the additions though

Thanks again

Ex.
 
Can anyone confirm if this code does indeed work as the menu key on Windows, Mac and/or Linux?

Code:
Keyboard.set_key1(101);
Keyboard.send_now();
delay(100);
Keyboard.set_key1(0);
Keyboard.send_now();
 
Status
Not open for further replies.
Back
Top