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 @@
+ +
Server response: @@ -78,4 +80,4 @@ $(window).bind('keydown', function(event) { - \ No newline at end of file + diff --git a/templates/mouse.html b/templates/mouse.html index d5257d4..7a097f0 100644 --- a/templates/mouse.html +++ b/templates/mouse.html @@ -39,7 +39,6 @@ $(document).ready(function(){ }); $("canvas").mousemove(function(event){ -// sendMouse(0, event.originalEvent.movementX, event.originalEvent.movementY); posX=event.offsetX; posY=event.offsetY; handleMouse(); @@ -65,7 +64,7 @@ function sendMouse(btn, x, y) {

- +