updated protocol display name, added exception handling in custom gamepad mapping

This commit is contained in:
dekunukem
2022-02-05 02:05:50 +00:00
parent 010f17dad4
commit 66ce1bffea
4 changed files with 10 additions and 7 deletions

View File

@@ -16,10 +16,10 @@ usb4vc_usb_scan.usb_device_scan_thread.start()
usb4vc_usb_scan.raw_input_event_parser_thread.start() usb4vc_usb_scan.raw_input_event_parser_thread.start()
while 1: while 1:
time.sleep(2)
ertm_status = subprocess.getoutput("cat /sys/module/bluetooth/parameters/disable_ertm").replace('\n', '').replace('\r', '').strip() ertm_status = subprocess.getoutput("cat /sys/module/bluetooth/parameters/disable_ertm").replace('\n', '').replace('\r', '').strip()
if ertm_status != 'Y': if ertm_status != 'Y':
print('ertm_status:', ertm_status) print('ertm_status:', ertm_status)
print("Disabling ERTM....") print("Disabling ERTM....")
subprocess.call('echo 1 > /sys/module/bluetooth/parameters/disable_ertm') subprocess.call('echo 1 > /sys/module/bluetooth/parameters/disable_ertm')
print("DONE") print("DONE")
time.sleep(2)

View File

@@ -1,4 +1,4 @@
RPI_APP_VERSION_TUPLE = (0, 0, 1) RPI_APP_VERSION_TUPLE = (0, 0, 2)
code_name_to_value_lookup = { code_name_to_value_lookup = {
'KEY_RESERVED':(0, 'kb_key'), 'KEY_RESERVED':(0, 'kb_key'),

View File

@@ -127,9 +127,9 @@ PROTOCOL_AT_PS2_KB = {'pid':1, 'display_name':"AT/PS2"}
PROTOCOL_XT_KB = {'pid':2, 'display_name':"PC XT"} PROTOCOL_XT_KB = {'pid':2, 'display_name':"PC XT"}
PROTOCOL_ADB_KB = {'pid':3, 'display_name':"ADB"} PROTOCOL_ADB_KB = {'pid':3, 'display_name':"ADB"}
PROTOCOL_PS2_MOUSE = {'pid':4, 'display_name':"PS/2"} PROTOCOL_PS2_MOUSE = {'pid':4, 'display_name':"PS/2"}
PROTOCOL_MICROSOFT_SERIAL_MOUSE = {'pid':5, 'display_name':"MS Serial"} PROTOCOL_MICROSOFT_SERIAL_MOUSE = {'pid':5, 'display_name':"Microsft Serial"}
PROTOCOL_ADB_MOUSE = {'pid':6, 'display_name':"ADB"} PROTOCOL_ADB_MOUSE = {'pid':6, 'display_name':"ADB"}
PROTOCOL_GENERIC_GAMEPORT_GAMEPAD = {'pid':7, 'display_name':"Generic PC", 'mapping':IBM_GGP_DEAULT_MAPPING} PROTOCOL_GENERIC_GAMEPORT_GAMEPAD = {'pid':7, 'display_name':"Generic 15-Pin", 'mapping':IBM_GGP_DEAULT_MAPPING}
PROTOCOL_GAMEPORT_GRAVIS_GAMEPAD = {'pid':8, 'display_name':"Gravis Pro"} PROTOCOL_GAMEPORT_GRAVIS_GAMEPAD = {'pid':8, 'display_name':"Gravis Pro"}
PROTOCOL_GAMEPORT_MICROSOFT_SIDEWINDER = {'pid':9, 'display_name':"MS Sidewinder"} PROTOCOL_GAMEPORT_MICROSOFT_SIDEWINDER = {'pid':9, 'display_name':"MS Sidewinder"}
PROTOCOL_RAW_KEYBOARD = {'pid':125, 'display_name':"Raw data"} PROTOCOL_RAW_KEYBOARD = {'pid':125, 'display_name':"Raw data"}

View File

@@ -408,8 +408,11 @@ def make_generic_gamepad_spi_packet(gp_status_dict, gp_id, axes_info, mapping_in
def make_gamepad_spi_packet(gp_status_dict, gp_id, axes_info): def make_gamepad_spi_packet(gp_status_dict, gp_id, axes_info):
current_protocol = usb4vc_ui.get_gamepad_protocol() current_protocol = usb4vc_ui.get_gamepad_protocol()
if current_protocol['pid'] in [PID_GENERIC_GAMEPORT_GAMEPAD, PID_PROTOCOL_OFF]: try:
return make_generic_gamepad_spi_packet(gp_status_dict, gp_id, axes_info, current_protocol) if current_protocol['pid'] in [PID_GENERIC_GAMEPORT_GAMEPAD, PID_PROTOCOL_OFF]:
return make_generic_gamepad_spi_packet(gp_status_dict, gp_id, axes_info, current_protocol)
except Exception as e:
print("make_generic_gamepad_spi_packet:", e)
return list(nop_spi_msg_template), None, None return list(nop_spi_msg_template), None, None
def change_kb_led(scrolllock, numlock, capslock): def change_kb_led(scrolllock, numlock, capslock):