horizontal scrolling for otg

This commit is contained in:
Devaev Maxim
2019-10-01 05:48:20 +03:00
parent 74931a8096
commit 8cc5f631ca
7 changed files with 41 additions and 21 deletions

View File

@@ -421,10 +421,11 @@ class Server: # pylint: disable=too-many-instance-attributes
async def __handle_ws_mouse_wheel_event(self, event: Dict) -> None:
try:
delta_x = valid_hid_mouse_wheel(event["delta"]["x"])
delta_y = valid_hid_mouse_wheel(event["delta"]["y"])
except Exception:
return
await self.__hid.send_mouse_wheel_event(delta_y)
await self.__hid.send_mouse_wheel_event(delta_x, delta_y)
# ===== HID

View File

@@ -28,7 +28,7 @@ MOUSE_HID = Hid(
protocol=0,
subclass=0,
report_length=6,
report_length=7,
report_descriptor=bytes([
# https://github.com/NicoHood/HID/blob/0835e6a/src/SingleReport/SingleAbsoluteMouse.cpp
@@ -71,6 +71,15 @@ MOUSE_HID = Hid(
0x95, 0x01, # REPORT_COUNT (1)
0x81, 0x06, # INPUT (Data,Var,Rel)
# Horizontal wheel
0x05, 0x0C, # USAGE PAGE (Consumer Devices)
0x0A, 0x38, 0x02, # USAGE (AC Pan)
0x15, 0x81, # LOGICAL_MINIMUM (-127)
0x25, 0x7F, # LOGICAL_MAXIMUM (127)
0x75, 0x08, # REPORT_SIZE (8)
0x95, 0x01, # REPORT_COUNT (1)
0x81, 0x06, # INPUT (Data,Var,Rel)
# End
0xC0, # END_COLLECTION
]),