Kbd Hid: FIX MOD meta act as 'e' char
This commit is contained in:
parent
05b97b0d8c
commit
bd776abe91
11
hidinput.py
11
hidinput.py
@ -46,7 +46,7 @@ def hid_mouse_write(btn, x, y, wheel):
|
||||
hidmouse.flush()
|
||||
|
||||
|
||||
def send_key(hidkey, shift, alt, ctlr):
|
||||
def send_key(hidkey, shift, alt, ctlr, mod):
|
||||
data = bytearray(8)
|
||||
if shift:
|
||||
data[0] += hidkeycodes['KEY_MOD_LSHIFT']
|
||||
@ -55,7 +55,7 @@ def send_key(hidkey, shift, alt, ctlr):
|
||||
if ctlr:
|
||||
data[0] += hidkeycodes['KEY_MOD_LCTRL']
|
||||
|
||||
if hidkey == hidkeycodes['KEY_MOD_LMETA'] or hidkey == hidkeycodes['KEY_MOD_RMETA']:
|
||||
if mod and (hidkey == hidkeycodes['KEY_MOD_LMETA'] or hidkey == hidkeycodes['KEY_MOD_RMETA']):
|
||||
data[0] += hidkey
|
||||
hidkey=0
|
||||
|
||||
@ -80,7 +80,7 @@ def get_hid_by_jscode(rawkeycode):
|
||||
|
||||
print ("JS key: {} HID key: {}({})".format(rawkeycode, hidkeyname, hidkeycode))
|
||||
|
||||
return hidkeycode
|
||||
return hidkeycode, (hidkeyname is not None and "MOD" in hidkeyname)
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
@ -117,7 +117,7 @@ def keypress():
|
||||
print ("Raw data: {}".format(request.data))
|
||||
|
||||
rawkeycode = keyevent['code']
|
||||
hidkeycode = get_hid_by_jscode(rawkeycode)
|
||||
hidkeycode, mod = get_hid_by_jscode(rawkeycode)
|
||||
|
||||
if hidkeycode is not None:
|
||||
try:
|
||||
@ -125,7 +125,8 @@ def keypress():
|
||||
hidkeycode,
|
||||
keyevent['shiftKey'],
|
||||
keyevent['altKey'],
|
||||
keyevent['ctrlKey'])
|
||||
keyevent['ctrlKey'],
|
||||
mod)
|
||||
except Exception as e:
|
||||
print("Error sending HID message", e)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user