Hid: working WIN key and Context key
This commit is contained in:
parent
feb9f571ea
commit
cc17254ebf
11
hidinput.py
11
hidinput.py
@ -32,7 +32,7 @@ def hid_write(data):
|
|||||||
hiddev.flush()
|
hiddev.flush()
|
||||||
|
|
||||||
|
|
||||||
def send_key(hidkey, shift, alt, ctlr, meta):
|
def send_key(hidkey, shift, alt, ctlr):
|
||||||
modkey = ord(NULL)
|
modkey = ord(NULL)
|
||||||
if shift:
|
if shift:
|
||||||
modkey += hidkeycodes['KEY_MOD_LSHIFT']
|
modkey += hidkeycodes['KEY_MOD_LSHIFT']
|
||||||
@ -40,8 +40,10 @@ def send_key(hidkey, shift, alt, ctlr, meta):
|
|||||||
modkey += hidkeycodes['KEY_MOD_LALT']
|
modkey += hidkeycodes['KEY_MOD_LALT']
|
||||||
if ctlr:
|
if ctlr:
|
||||||
modkey += hidkeycodes['KEY_MOD_LCTRL']
|
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(chr(modkey)+NULL+chr(hidkey)+NULL*5)
|
||||||
hid_write(NULL*8)
|
hid_write(NULL*8)
|
||||||
@ -83,8 +85,7 @@ def keypress():
|
|||||||
hidkeycode,
|
hidkeycode,
|
||||||
keyevent['shiftKey'],
|
keyevent['shiftKey'],
|
||||||
keyevent['altKey'],
|
keyevent['altKey'],
|
||||||
keyevent['ctrlKey'],
|
keyevent['ctrlKey'])
|
||||||
False)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Error sending HID message", e)
|
print("Error sending HID message", e)
|
||||||
|
|
||||||
|
@ -119,8 +119,10 @@ jskeycodes = {
|
|||||||
'KEY_CAPSLOCK': 'CapsLock',
|
'KEY_CAPSLOCK': 'CapsLock',
|
||||||
'KEY_SCROLLLOCK': 'ScrollLock',
|
'KEY_SCROLLLOCK': 'ScrollLock',
|
||||||
|
|
||||||
'KEY_LEFTWINDOWS': 'MetaLeft',
|
'KEY_MOD_LMETA': 'MetaLeft',
|
||||||
'KEY_RIGHTMETA': 'ContextMenu',
|
'KEY_MOD_RMETA': 'MetaRight',
|
||||||
|
|
||||||
|
'KEY_COMPOSE': 'ContextMenu',
|
||||||
}
|
}
|
||||||
|
|
||||||
jskeywhich = {
|
jskeywhich = {
|
||||||
|
Loading…
Reference in New Issue
Block a user