diff --git a/hidinput.py b/hidinput.py index 51d60e5..06b8160 100644 --- a/hidinput.py +++ b/hidinput.py @@ -21,7 +21,6 @@ hiddev = None hidmouse = None hidmouseabs = None -hid_init() def hid_init(): global hiddev, hidmouse, hidmouseabs @@ -146,8 +145,8 @@ def mouseabs(): @socketio.on('mouseEvent') -def handle_my_custom_event(json): - mouseevent = json.loads(json) +def handle_my_custom_event(data): + mouseevent = json.loads(data) print(mouseevent) btn = mouseevent['btn'] x = mouseevent['x'] @@ -180,6 +179,7 @@ def keypress(): return Response("Press {}".format(hidkeycode), mimetype="text/plain") +hid_init() # check to see if this is the main thread of execution if __name__ == '__main__': diff --git a/templates/hid.html b/templates/hid.html index a1ab649..8747072 100644 --- a/templates/hid.html +++ b/templates/hid.html @@ -12,6 +12,8 @@