mirror of
https://github.com/dekuNukem/USB4VC.git
synced 2025-10-31 11:26:46 -07:00
updated exception message
This commit is contained in:
@@ -157,7 +157,7 @@ try:
|
||||
with open(item) as json_file:
|
||||
custom_profile_list.append(json.load(json_file))
|
||||
except Exception as e:
|
||||
print('json load exception:', e)
|
||||
print('exception json load:', e)
|
||||
|
||||
def get_list_of_usb_drive():
|
||||
usb_drive_set = set()
|
||||
@@ -166,7 +166,7 @@ def get_list_of_usb_drive():
|
||||
for item in [x for x in usb_drive_path if len(x) > 2]:
|
||||
usb_drive_set.add(os.path.join(item.split(' ')[-1], 'usb4vc'))
|
||||
except Exception as e:
|
||||
print("get_list_of_usb_drive:", e)
|
||||
print("exception get_list_of_usb_drive:", e)
|
||||
return usb_drive_set
|
||||
|
||||
def copy_debug_log():
|
||||
@@ -207,13 +207,13 @@ def get_pbid_and_version(dfu_file_name):
|
||||
try:
|
||||
pbid = int(dfu_file_name.split('PBID')[-1].split('_')[0])
|
||||
except Exception as e:
|
||||
print("fw pbid parse:", e)
|
||||
print("exception fw pbid parse:", e)
|
||||
fw_ver_tuple = None
|
||||
try:
|
||||
fw_ver = dfu_file_name.split('_V')[-1].split('.')[0].split('_')
|
||||
fw_ver_tuple = (int(fw_ver[0]), int(fw_ver[1]), int(fw_ver[2]))
|
||||
except Exception as e:
|
||||
print('fw ver parse:', e)
|
||||
print('exception fw ver parse:', e)
|
||||
return pbid, fw_ver_tuple
|
||||
|
||||
i2c_bootloader_pbid = [1]
|
||||
@@ -413,7 +413,7 @@ def get_paired_devices():
|
||||
continue
|
||||
dev_set.add((line_split[1], line_split[2]))
|
||||
except Exception as e:
|
||||
print('get_paired_devices exception:', e)
|
||||
print('exception get_paired_devices:', e)
|
||||
return dev_set
|
||||
|
||||
def load_config():
|
||||
@@ -428,7 +428,7 @@ def load_config():
|
||||
else:
|
||||
configuration_dict[key] = temp_dict[key]
|
||||
except Exception as e:
|
||||
print("config load failed!", e)
|
||||
print("exception config load failed!", e)
|
||||
|
||||
def get_ip_name():
|
||||
ip_str = subprocess.getoutput("timeout 1 hostname -I")
|
||||
@@ -442,7 +442,7 @@ def save_config():
|
||||
with open(config_file_path, 'w', encoding='utf-8') as save_file:
|
||||
save_file.write(json.dumps(configuration_dict))
|
||||
except Exception as e:
|
||||
print("config save failed!", e)
|
||||
print("exception config save failed!", e)
|
||||
|
||||
curve_vertial_axis_x_pos = 80
|
||||
curve_horizontal_axis_width = 32
|
||||
@@ -709,7 +709,7 @@ class usb4vc_menu(object):
|
||||
try:
|
||||
usb4vc_show_ev.ev_loop([plus_button, minus_button, enter_button])
|
||||
except Exception as e:
|
||||
print('ev_loop exception:', e)
|
||||
print('exception ev_loop:', e)
|
||||
self.goto_level(0)
|
||||
elif page == 4:
|
||||
self.paired_devices_list = list(get_paired_devices())
|
||||
|
||||
@@ -142,7 +142,7 @@ def get_range_max_and_midpoint(axes_dict, axis_key):
|
||||
try:
|
||||
return axes_dict[axis_key]['max'] - axes_dict[axis_key]['min'], int((axes_dict[axis_key]['max'] + axes_dict[axis_key]['min']) / 2)
|
||||
except Exception as e:
|
||||
print('get_range_max_and_midpoint:', e)
|
||||
print('exception get_range_max_and_midpoint:', e)
|
||||
return None, None
|
||||
|
||||
def convert_to_8bit_midpoint127(value, axes_dict, axis_key):
|
||||
@@ -461,7 +461,7 @@ def apply_curve(x_0_255, y_0_255):
|
||||
yyyyy = int(y_neg127_127 / ratio)
|
||||
return xxxxx + 127, yyyyy + 127
|
||||
except Exception as e:
|
||||
# print('apply_curve:', e)
|
||||
# print('exception apply_curve:', e)
|
||||
pass
|
||||
return x_0_255, y_0_255
|
||||
|
||||
@@ -680,7 +680,7 @@ def make_gamepad_spi_packet(gp_status_dict, gp_id, this_device_info):
|
||||
if current_protocol['pid'] in [PID_GENERIC_GAMEPORT_GAMEPAD, PID_PROTOCOL_OFF]:
|
||||
return make_generic_gamepad_spi_packet(gp_status_dict, gp_id, this_device_info, current_protocol)
|
||||
except Exception as e:
|
||||
print("make_generic_gamepad_spi_packet:", e)
|
||||
print("exception make_generic_gamepad_spi_packet:", e)
|
||||
return list(nop_spi_msg_template), None, None
|
||||
|
||||
def change_kb_led(scrolllock, numlock, capslock):
|
||||
@@ -812,7 +812,6 @@ def raw_input_event_worker():
|
||||
elif data[0] == EV_REL and event_code == REL_HWHEEL:
|
||||
mouse_status_dict['hscroll'] = data[4]
|
||||
|
||||
|
||||
# event is absolute axes AKA joystick
|
||||
elif this_device['is_gp'] and data[0] == EV_ABS:
|
||||
abs_value = int.from_bytes(data[4:8], byteorder='little', signed=True)
|
||||
@@ -859,7 +858,7 @@ def raw_input_event_worker():
|
||||
change_kb_led(slave_result[3], slave_result[4], slave_result[5])
|
||||
change_kb_led(slave_result[3], slave_result[4], slave_result[5])
|
||||
except Exception as e:
|
||||
print('change_kb_led exception:', e)
|
||||
print('exception change_kb_led:', e)
|
||||
|
||||
def get_input_devices():
|
||||
result = []
|
||||
@@ -890,7 +889,7 @@ def get_input_devices():
|
||||
for item in this_device.capabilities()[EV_ABS]:
|
||||
dev_dict['axes_info'][item[0]] = item[1]._asdict()
|
||||
except Exception as e:
|
||||
print('get_input_devices exception:', e)
|
||||
print('exception get_input_devices:', e)
|
||||
result.append(dev_dict)
|
||||
return result
|
||||
|
||||
@@ -914,7 +913,7 @@ def usb_device_scan_worker():
|
||||
try:
|
||||
device_list = get_input_devices()
|
||||
except Exception as e:
|
||||
print('exception at get_input_devices:', e)
|
||||
print('exception get_input_devices:', e)
|
||||
continue
|
||||
if len(device_list) == 0:
|
||||
print('No input devices found')
|
||||
@@ -934,7 +933,7 @@ def usb_device_scan_worker():
|
||||
opened_device_dict[item['path']] = item
|
||||
print("opened device:", hex(item['vendor_id']), hex(item['product_id']), item['name'])
|
||||
except Exception as e:
|
||||
print("Device open exception:", e, item)
|
||||
print("exception Device open:", e, item)
|
||||
|
||||
raw_input_event_parser_thread = threading.Thread(target=raw_input_event_worker, daemon=True)
|
||||
usb_device_scan_thread = threading.Thread(target=usb_device_scan_worker, daemon=True)
|
||||
|
||||
Reference in New Issue
Block a user