HID: mouse RAW data
This commit is contained in:
		
							
								
								
									
										12
									
								
								hidinput.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								hidinput.py
									
									
									
									
									
								
							@@ -5,6 +5,7 @@ from flask import request
 | 
			
		||||
from flask_socketio import SocketIO
 | 
			
		||||
import argparse
 | 
			
		||||
import json
 | 
			
		||||
import struct
 | 
			
		||||
 | 
			
		||||
from hidkeycodes import hidkeycodes
 | 
			
		||||
from jskeycodes import jscodehidmap
 | 
			
		||||
@@ -100,6 +101,17 @@ def keyboardIndex():
 | 
			
		||||
    return render_template("keyboard.html")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@socketio.on('mouseEventRaw')
 | 
			
		||||
def handle_mouseEvent(data):
 | 
			
		||||
    print(data)
 | 
			
		||||
 | 
			
		||||
    (btn, x, y, wheel) = struct.unpack('BHHb', data)
 | 
			
		||||
 | 
			
		||||
    print("RAW Btn: {}, X: {}, Y: {}, W: {}".format(btn, x, y, wheel))
 | 
			
		||||
 | 
			
		||||
#    hid_mouse_writeabs(btn, x, y, wheel)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@socketio.on('mouseEvent')
 | 
			
		||||
def handle_mouseEvent(data):
 | 
			
		||||
    mouseevent = json.loads(data)
 | 
			
		||||
 
 | 
			
		||||
@@ -87,7 +87,17 @@
 | 
			
		||||
        wheel: wheel,
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      var data = new Array(6);
 | 
			
		||||
      data[0] = btn;
 | 
			
		||||
      data[1] = x & 255;
 | 
			
		||||
      data[2] = x >> 8
 | 
			
		||||
      data[3] = y & 255;
 | 
			
		||||
      data[4] = y >> 8
 | 
			
		||||
      data[5] = 0;
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
      socket.emit('mouseEvent', JSON.stringify(obj));
 | 
			
		||||
      socket.emit('mouseEventRaw', data);
 | 
			
		||||
    };
 | 
			
		||||
    </script>
 | 
			
		||||
</head>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user