Hid: working WIN key and Context key

This commit is contained in:
Petr Kracik 2020-05-25 01:29:17 +02:00
parent feb9f571ea
commit cc17254ebf
2 changed files with 10 additions and 7 deletions

View File

@ -32,7 +32,7 @@ def hid_write(data):
hiddev.flush()
def send_key(hidkey, shift, alt, ctlr, meta):
def send_key(hidkey, shift, alt, ctlr):
modkey = ord(NULL)
if shift:
modkey += hidkeycodes['KEY_MOD_LSHIFT']
@ -40,8 +40,10 @@ def send_key(hidkey, shift, alt, ctlr, meta):
modkey += hidkeycodes['KEY_MOD_LALT']
if ctlr:
modkey += hidkeycodes['KEY_MOD_LCTRL']
if meta:
modkey += hidkeycodes['KEY_MOD_LMETA']
if hidkey == hidkeycodes['KEY_MOD_LMETA'] or hidkey == hidkeycodes['KEY_MOD_RMETA']:
modkey += hidkey
hidkey=ord(NULL)
hid_write(chr(modkey)+NULL+chr(hidkey)+NULL*5)
hid_write(NULL*8)
@ -83,8 +85,7 @@ def keypress():
hidkeycode,
keyevent['shiftKey'],
keyevent['altKey'],
keyevent['ctrlKey'],
False)
keyevent['ctrlKey'])
except Exception as e:
print("Error sending HID message", e)

View File

@ -119,8 +119,10 @@ jskeycodes = {
'KEY_CAPSLOCK': 'CapsLock',
'KEY_SCROLLLOCK': 'ScrollLock',
'KEY_LEFTWINDOWS': 'MetaLeft',
'KEY_RIGHTMETA': 'ContextMenu',
'KEY_MOD_LMETA': 'MetaLeft',
'KEY_MOD_RMETA': 'MetaRight',
'KEY_COMPOSE': 'ContextMenu',
}
jskeywhich = {