HID: mouse RAW data

This commit is contained in:
Petr Kracík 2020-06-07 15:07:12 +02:00
parent 42ec2611e3
commit 0dbf3f9b7a
2 changed files with 8 additions and 8 deletions

View File

@ -105,7 +105,10 @@ def keyboardIndex():
def handle_mouseEvent(data): def handle_mouseEvent(data):
print(data) print(data)
(btn, x, y, wheel) = struct.unpack('BHHb', data) btn = data[0]
x = data[1]
y = data[2]
wheel = data[3]
print("RAW Btn: {}, X: {}, Y: {}, W: {}".format(btn, x, y, wheel)) print("RAW Btn: {}, X: {}, Y: {}, W: {}".format(btn, x, y, wheel))

View File

@ -87,14 +87,11 @@
wheel: wheel, wheel: wheel,
} }
var data = new Array(6); var data = new Array(4);
data[0] = btn; data[0] = btn;
data[1] = x & 255; data[1] = x;
data[2] = x >> 8 data[2] = y;
data[3] = y & 255; data[3] = wheel;
data[4] = y >> 8
data[5] = 0;
socket.emit('mouseEvent', JSON.stringify(obj)); socket.emit('mouseEvent', JSON.stringify(obj));
socket.emit('mouseEventRaw', data); socket.emit('mouseEventRaw', data);