mirror of
https://github.com/dekuNukem/USB4VC.git
synced 2025-10-31 11:26:46 -07:00
ignore mouse typymatic
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
|
||||
|
||||
# if this_mouse_msg[13:18] ==
|
||||
|
||||
# if not (this_mouse_msg[4:] == last_mouse_msg[4:] and sum(this_mouse_msg[4:]) == 0):
|
||||
# print(mouse_status_dict["x"])
|
||||
|
||||
GPIO.setup(PBOARD_RESET_PIN, GPIO.OUT)
|
||||
GPIO.output(PBOARD_RESET_PIN, 1)
|
||||
# print(check_usb_drive())
|
||||
|
||||
@@ -455,7 +455,6 @@ def raw_input_event_worker():
|
||||
mouse_status_dict = {'x': [0, 0], 'y': [0, 0], 'scroll': [0, 0], BTN_LEFT:0, BTN_RIGHT:0, BTN_MIDDLE:0, BTN_SIDE:0, BTN_EXTRA:0, BTN_FORWARD:0, BTN_BACK:0, BTN_TASK:0}
|
||||
gamepad_status_dict = {}
|
||||
next_gamepad_hold_check = time.time() + gamepad_hold_check_interval
|
||||
last_mouse_msg = []
|
||||
print("raw_input_event_worker started")
|
||||
while 1:
|
||||
now = time.time()
|
||||
@@ -491,11 +490,12 @@ def raw_input_event_worker():
|
||||
if 0x1 <= event_code <= 248 and event_code not in gamepad_buttons_as_kb_codes:
|
||||
pcard_spi.xfer(make_keyboard_spi_packet(data, this_id))
|
||||
# Mouse buttons
|
||||
elif 0x110 <= event_code <= 0x117 and data[4] != 2:
|
||||
elif 0x110 <= event_code <= 0x117:
|
||||
mouse_status_dict[event_code] = data[4]
|
||||
clear_mouse_movement(mouse_status_dict)
|
||||
pcard_spi.xfer(make_mouse_spi_packet(mouse_status_dict, this_id))
|
||||
next_gamepad_hold_check = now + gamepad_hold_check_interval
|
||||
if data[4] != 2:
|
||||
clear_mouse_movement(mouse_status_dict)
|
||||
pcard_spi.xfer(make_mouse_spi_packet(mouse_status_dict, this_id))
|
||||
# Gamepad buttons
|
||||
elif BTN_SOUTH <= event_code <= BTN_THUMBR or event_code in gamepad_buttons_as_kb_codes:
|
||||
gamepad_status_dict[this_id][event_code] = data[4]
|
||||
@@ -521,12 +521,11 @@ def raw_input_event_worker():
|
||||
elif data[0] == EV_SYN and event_code == SYN_REPORT:
|
||||
if this_device['is_mouse']:
|
||||
this_mouse_msg = make_mouse_spi_packet(mouse_status_dict, this_id)
|
||||
if not (this_mouse_msg[4:] == last_mouse_msg[4:] and sum(this_mouse_msg[4:]) == 0):
|
||||
# print(mouse_status_dict["x"])
|
||||
# send spi mouse message if there is moment, or the button is not typematic
|
||||
if max(this_mouse_msg[13:18]) != 2 or sum(this_mouse_msg[4:10]) != 0:
|
||||
pcard_spi.xfer(list(this_mouse_msg))
|
||||
last_mouse_msg = list(this_mouse_msg)
|
||||
next_gamepad_hold_check = now + gamepad_hold_check_interval
|
||||
clear_mouse_movement(mouse_status_dict)
|
||||
next_gamepad_hold_check = now + gamepad_hold_check_interval
|
||||
clear_mouse_movement(mouse_status_dict)
|
||||
if this_device['is_gp']:
|
||||
gp_to_transfer, kb_to_transfer, mouse_to_transfer = make_gamepad_spi_packet(gamepad_status_dict, this_id, this_device['axes_info'])
|
||||
pcard_spi.xfer(gp_to_transfer)
|
||||
|
||||
Reference in New Issue
Block a user