mirror of
https://github.com/dekuNukem/USB4VC.git
synced 2025-10-31 11:26:46 -07:00
adjusted custom controller mapping name, updated default mapping
This commit is contained in:
@@ -57,138 +57,138 @@ raw_usb_gamepad_abs_axes_to_spi_msg_index_lookup = {
|
||||
}
|
||||
|
||||
xbox_one_to_linux_ev_code_dict = {
|
||||
"XB1_A":"BTN_SOUTH",
|
||||
"XB1_B":"BTN_EAST",
|
||||
"XB1_X":"BTN_NORTH",
|
||||
"XB1_Y":"BTN_WEST",
|
||||
"XB1_LSB":"BTN_THUMBL",
|
||||
"XB1_RSB":"BTN_THUMBR",
|
||||
"XB1_LB":"BTN_TL",
|
||||
"XB1_RB":"BTN_TR",
|
||||
"XB1_VIEW":"BTN_SELECT",
|
||||
"XB1_MENU":"BTN_START",
|
||||
"XB1_LOGO":"BTN_MODE",
|
||||
"XB1_LSX":"ABS_X",
|
||||
"XB1_LSY":"ABS_Y",
|
||||
"XB1_RSX":"ABS_RX",
|
||||
"XB1_RSY":"ABS_RY",
|
||||
"XB1_LT":"ABS_Z",
|
||||
"XB1_RT":"ABS_RZ",
|
||||
"XB1_DPX":"ABS_HAT0X",
|
||||
"XB1_DPY":"ABS_HAT0Y",
|
||||
"XB_A":"BTN_SOUTH",
|
||||
"XB_B":"BTN_EAST",
|
||||
"XB_X":"BTN_NORTH",
|
||||
"XB_Y":"BTN_WEST",
|
||||
"XB_LSB":"BTN_THUMBL",
|
||||
"XB_RSB":"BTN_THUMBR",
|
||||
"XB_LB":"BTN_TL",
|
||||
"XB_RB":"BTN_TR",
|
||||
"XB_VIEW":"BTN_SELECT",
|
||||
"XB_MENU":"BTN_START",
|
||||
"XB_LOGO":"BTN_MODE",
|
||||
"XB_LSX":"ABS_X",
|
||||
"XB_LSY":"ABS_Y",
|
||||
"XB_RSX":"ABS_RX",
|
||||
"XB_RSY":"ABS_RY",
|
||||
"XB_LT":"ABS_Z",
|
||||
"XB_RT":"ABS_RZ",
|
||||
"XB_DPX":"ABS_HAT0X",
|
||||
"XB_DPY":"ABS_HAT0Y",
|
||||
}
|
||||
|
||||
ps5_to_linux_ev_code_dict = {
|
||||
"PS5_CROSS":"BTN_EAST",
|
||||
"PS5_CIRCLE":"BTN_C",
|
||||
"PS5_SQUARE":"BTN_SOUTH",
|
||||
"PS5_TRIANGLE":"BTN_NORTH",
|
||||
"PS5_L1":"BTN_WEST",
|
||||
"PS5_R1":"BTN_Z",
|
||||
"PS5_CREATE":"BTN_TL2",
|
||||
"PS5_OPTION":"BTN_TR2",
|
||||
"PS5_LOGO":"BTN_MODE",
|
||||
"PS5_L2_BUTTON":"BTN_TL",
|
||||
"PS5_R2_BUTTON":"BTN_TR",
|
||||
"PS5_MUTE":"BTN_THUMBR",
|
||||
"PS5_TOUCHPAD_BUTTON":"BTN_THUMBL",
|
||||
"PS5_LSB":"BTN_SELECT",
|
||||
"PS5_RSB":"BTN_START",
|
||||
"PS5_LSX":"ABS_X",
|
||||
"PS5_LSY":"ABS_Y",
|
||||
"PS5_RSX":"ABS_Z",
|
||||
"PS5_RSY":"ABS_RZ",
|
||||
"PS5_L2_ANALOG":"ABS_RX",
|
||||
"PS5_R2_ANALOG":"ABS_RY",
|
||||
"PS5_DPX":"ABS_HAT0X",
|
||||
"PS5_DPY":"ABS_HAT0Y",
|
||||
"PS_CROSS":"BTN_EAST",
|
||||
"PS_CIRCLE":"BTN_C",
|
||||
"PS_SQUARE":"BTN_SOUTH",
|
||||
"PS_TRIANGLE":"BTN_NORTH",
|
||||
"PS_L1":"BTN_WEST",
|
||||
"PS_R1":"BTN_Z",
|
||||
"PS_CREATE":"BTN_TL2",
|
||||
"PS_OPTION":"BTN_TR2",
|
||||
"PS_LOGO":"BTN_MODE",
|
||||
"PS_L2_BUTTON":"BTN_TL",
|
||||
"PS_R2_BUTTON":"BTN_TR",
|
||||
"PS_MUTE":"BTN_THUMBR",
|
||||
"PS_TOUCHPAD_BUTTON":"BTN_THUMBL",
|
||||
"PS_LSB":"BTN_SELECT",
|
||||
"PS_RSB":"BTN_START",
|
||||
"PS_LSX":"ABS_X",
|
||||
"PS_LSY":"ABS_Y",
|
||||
"PS_RSX":"ABS_Z",
|
||||
"PS_RSY":"ABS_RZ",
|
||||
"PS_L2_ANALOG":"ABS_RX",
|
||||
"PS_R2_ANALOG":"ABS_RY",
|
||||
"PS_DPX":"ABS_HAT0X",
|
||||
"PS_DPY":"ABS_HAT0Y",
|
||||
}
|
||||
|
||||
ps4_to_linux_ev_code_dict = {
|
||||
"PS4_CROSS":"BTN_SOUTH",
|
||||
"PS4_CIRCLE":"BTN_EAST",
|
||||
"PS4_SQUARE":"BTN_WEST",
|
||||
"PS4_TRIANGLE":"BTN_NORTH",
|
||||
"PS4_L1":"BTN_TL",
|
||||
"PS4_R1":"BTN_TR",
|
||||
"PS4_SHARE":"BTN_SELECT",
|
||||
"PS4_OPTION":"BTN_START",
|
||||
"PS4_LOGO":"BTN_MODE",
|
||||
"PS4_L2_BUTTON":"BTN_TL2",
|
||||
"PS4_R2_BUTTON":"BTN_TR2",
|
||||
"PS4_LSB":"BTN_THUMBL",
|
||||
"PS4_RSB":"BTN_THUMBR",
|
||||
"PS4_LSX":"ABS_X",
|
||||
"PS4_LSY":"ABS_Y",
|
||||
"PS4_RSX":"ABS_RX",
|
||||
"PS4_RSY":"ABS_RY",
|
||||
"PS4_L2_ANALOG":"ABS_Z",
|
||||
"PS4_R2_ANALOG":"ABS_RZ",
|
||||
"PS4_DPX":"ABS_HAT0X",
|
||||
"PS4_DPY":"ABS_HAT0Y",
|
||||
"PS_CROSS":"BTN_SOUTH",
|
||||
"PS_CIRCLE":"BTN_EAST",
|
||||
"PS_SQUARE":"BTN_WEST",
|
||||
"PS_TRIANGLE":"BTN_NORTH",
|
||||
"PS_L1":"BTN_TL",
|
||||
"PS_R1":"BTN_TR",
|
||||
"PS_SHARE":"BTN_SELECT",
|
||||
"PS_OPTION":"BTN_START",
|
||||
"PS_LOGO":"BTN_MODE",
|
||||
"PS_L2_BUTTON":"BTN_TL2",
|
||||
"PS_R2_BUTTON":"BTN_TR2",
|
||||
"PS_LSB":"BTN_THUMBL",
|
||||
"PS_RSB":"BTN_THUMBR",
|
||||
"PS_LSX":"ABS_X",
|
||||
"PS_LSY":"ABS_Y",
|
||||
"PS_RSX":"ABS_RX",
|
||||
"PS_RSY":"ABS_RY",
|
||||
"PS_L2_ANALOG":"ABS_Z",
|
||||
"PS_R2_ANALOG":"ABS_RZ",
|
||||
"PS_DPX":"ABS_HAT0X",
|
||||
"PS_DPY":"ABS_HAT0Y",
|
||||
}
|
||||
|
||||
XBOX_DEFAULT_KB_MOUSE_MAPPING = {
|
||||
'XB1_A': {'code': 'BTN_LEFT'},
|
||||
'XB1_B': {'code': 'BTN_RIGHT'},
|
||||
'XB1_LSX': {'code': 'REL_X'},
|
||||
'XB1_LSY': {'code': 'REL_Y'},
|
||||
'XB1_LB': {'code': 'BTN_LEFT'},
|
||||
'XB1_RB': {'code': 'BTN_RIGHT'},
|
||||
'XB1_RSX': {'code': 'KEY_RIGHT', 'code_neg': 'KEY_LEFT'},
|
||||
'XB1_RSY': {'code': 'KEY_DOWN', 'code_neg': 'KEY_UP'},
|
||||
'XB1_DPX': {'code': 'KEY_RIGHT', 'code_neg': 'KEY_LEFT'},
|
||||
'XB1_DPY': {'code': 'KEY_DOWN', 'code_neg': 'KEY_UP'},
|
||||
'XB1_X': {'code': 'BTN_LEFT'},
|
||||
'XB1_Y': {'code': 'BTN_RIGHT'},
|
||||
'XB1_MENU': {'code': 'KEY_ESC'},
|
||||
'XB1_VIEW': {'code': 'KEY_ESC'}
|
||||
'XB_A': {'code': 'BTN_LEFT'},
|
||||
'XB_B': {'code': 'BTN_RIGHT'},
|
||||
'XB_LSX': {'code': 'REL_X'},
|
||||
'XB_LSY': {'code': 'REL_Y'},
|
||||
'XB_LB': {'code': 'BTN_LEFT'},
|
||||
'XB_RB': {'code': 'BTN_RIGHT'},
|
||||
'XB_RSX': {'code': 'KEY_RIGHT', 'code_neg': 'KEY_LEFT'},
|
||||
'XB_RSY': {'code': 'KEY_DOWN', 'code_neg': 'KEY_UP'},
|
||||
'XB_DPX': {'code': 'KEY_RIGHT', 'code_neg': 'KEY_LEFT'},
|
||||
'XB_DPY': {'code': 'KEY_DOWN', 'code_neg': 'KEY_UP'},
|
||||
'XB_X': {'code': 'BTN_LEFT'},
|
||||
'XB_Y': {'code': 'BTN_RIGHT'},
|
||||
'XB_MENU': {'code': 'KEY_ESC'},
|
||||
'XB_VIEW': {'code': 'KEY_ESC'}
|
||||
}
|
||||
|
||||
PS5_DEFAULT_KB_MOUSE_MAPPING = {
|
||||
'PS5_CROSS': {'code': 'BTN_LEFT'},
|
||||
'PS5_SQUARE': {'code': 'BTN_LEFT'},
|
||||
'PS5_L1': {'code': 'BTN_LEFT'},
|
||||
'PS5_L2_BUTTON': {'code': 'BTN_LEFT'},
|
||||
'PS_CROSS': {'code': 'BTN_LEFT'},
|
||||
'PS_SQUARE': {'code': 'BTN_LEFT'},
|
||||
'PS_L1': {'code': 'BTN_LEFT'},
|
||||
'PS_L2_BUTTON': {'code': 'BTN_LEFT'},
|
||||
|
||||
'PS5_CIRCLE': {'code': 'BTN_RIGHT'},
|
||||
'PS5_TRIANGLE': {'code': 'BTN_RIGHT'},
|
||||
'PS5_R1': {'code': 'BTN_RIGHT'},
|
||||
'PS5_R2_BUTTON': {'code': 'BTN_RIGHT'},
|
||||
'PS_CIRCLE': {'code': 'BTN_RIGHT'},
|
||||
'PS_TRIANGLE': {'code': 'BTN_RIGHT'},
|
||||
'PS_R1': {'code': 'BTN_RIGHT'},
|
||||
'PS_R2_BUTTON': {'code': 'BTN_RIGHT'},
|
||||
|
||||
'PS5_LSX': {'code': 'REL_X'},
|
||||
'PS5_LSY': {'code': 'REL_Y'},
|
||||
'PS_LSX': {'code': 'REL_X'},
|
||||
'PS_LSY': {'code': 'REL_Y'},
|
||||
|
||||
'PS5_RSX': {'code': 'KEY_RIGHT', 'code_neg': 'KEY_LEFT'},
|
||||
'PS5_RSY': {'code': 'KEY_DOWN', 'code_neg': 'KEY_UP'},
|
||||
'PS5_DPX': {'code': 'KEY_RIGHT', 'code_neg': 'KEY_LEFT'},
|
||||
'PS5_DPY': {'code': 'KEY_DOWN', 'code_neg': 'KEY_UP'},
|
||||
'PS_RSX': {'code': 'KEY_RIGHT', 'code_neg': 'KEY_LEFT'},
|
||||
'PS_RSY': {'code': 'KEY_DOWN', 'code_neg': 'KEY_UP'},
|
||||
'PS_DPX': {'code': 'KEY_RIGHT', 'code_neg': 'KEY_LEFT'},
|
||||
'PS_DPY': {'code': 'KEY_DOWN', 'code_neg': 'KEY_UP'},
|
||||
|
||||
'PS5_CREATE': {'code': 'KEY_ESC'},
|
||||
'PS5_OPTION': {'code': 'KEY_ESC'}
|
||||
'PS_CREATE': {'code': 'KEY_ESC'},
|
||||
'PS_OPTION': {'code': 'KEY_ESC'}
|
||||
}
|
||||
|
||||
PS4_DEFAULT_KB_MOUSE_MAPPING = {
|
||||
'PS4_CROSS': {'code': 'BTN_LEFT'},
|
||||
'PS4_SQUARE': {'code': 'BTN_LEFT'},
|
||||
'PS4_L1': {'code': 'BTN_LEFT'},
|
||||
'PS4_L2_BUTTON': {'code': 'BTN_LEFT'},
|
||||
'PS_CROSS': {'code': 'BTN_LEFT'},
|
||||
'PS_SQUARE': {'code': 'BTN_LEFT'},
|
||||
'PS_L1': {'code': 'BTN_LEFT'},
|
||||
'PS_L2_BUTTON': {'code': 'BTN_LEFT'},
|
||||
|
||||
'PS4_CIRCLE': {'code': 'BTN_RIGHT'},
|
||||
'PS4_TRIANGLE': {'code': 'BTN_RIGHT'},
|
||||
'PS4_R1': {'code': 'BTN_RIGHT'},
|
||||
'PS4_R2_BUTTON': {'code': 'BTN_RIGHT'},
|
||||
'PS_CIRCLE': {'code': 'BTN_RIGHT'},
|
||||
'PS_TRIANGLE': {'code': 'BTN_RIGHT'},
|
||||
'PS_R1': {'code': 'BTN_RIGHT'},
|
||||
'PS_R2_BUTTON': {'code': 'BTN_RIGHT'},
|
||||
|
||||
'PS4_LSX': {'code': 'REL_X'},
|
||||
'PS4_LSY': {'code': 'REL_Y'},
|
||||
'PS_LSX': {'code': 'REL_X'},
|
||||
'PS_LSY': {'code': 'REL_Y'},
|
||||
|
||||
'PS4_RSX': {'code': 'KEY_RIGHT', 'code_neg': 'KEY_LEFT'},
|
||||
'PS4_RSY': {'code': 'KEY_DOWN', 'code_neg': 'KEY_UP'},
|
||||
'PS4_DPX': {'code': 'KEY_RIGHT', 'code_neg': 'KEY_LEFT'},
|
||||
'PS4_DPY': {'code': 'KEY_DOWN', 'code_neg': 'KEY_UP'},
|
||||
'PS_RSX': {'code': 'KEY_RIGHT', 'code_neg': 'KEY_LEFT'},
|
||||
'PS_RSY': {'code': 'KEY_DOWN', 'code_neg': 'KEY_UP'},
|
||||
'PS_DPX': {'code': 'KEY_RIGHT', 'code_neg': 'KEY_LEFT'},
|
||||
'PS_DPY': {'code': 'KEY_DOWN', 'code_neg': 'KEY_UP'},
|
||||
|
||||
'PS4_SHARE': {'code': 'KEY_ESC'},
|
||||
'PS4_OPTION': {'code': 'KEY_ESC'}
|
||||
'PS_SHARE': {'code': 'KEY_ESC'},
|
||||
'PS_OPTION': {'code': 'KEY_ESC'}
|
||||
}
|
||||
|
||||
XBOX_DEFAULT_MAPPING = {
|
||||
@@ -198,8 +198,8 @@ XBOX_DEFAULT_MAPPING = {
|
||||
'BTN_B': {'code':'IBM_GGP_BTN_3'},
|
||||
'BTN_Y': {'code':'IBM_GGP_BTN_4'},
|
||||
|
||||
'BTN_TL': {'code':'IBM_GGP_BTN_1'},
|
||||
'BTN_TR': {'code':'IBM_GGP_BTN_2'},
|
||||
'BTN_TL': {'code':'IBM_GGP_BTN_3'},
|
||||
'BTN_TR': {'code':'IBM_GGP_BTN_4'},
|
||||
# buttons to keyboard keys
|
||||
'BTN_SELECT': {'code':'KEY_ESC'},
|
||||
'BTN_START': {'code':'KEY_ENTER'},
|
||||
@@ -221,8 +221,8 @@ PS5_DEFAULT_MAPPING = {
|
||||
'BTN_C': {'code':'IBM_GGP_BTN_3'},
|
||||
'BTN_NORTH': {'code':'IBM_GGP_BTN_4'},
|
||||
|
||||
'BTN_WEST': {'code':'IBM_GGP_BTN_1'},
|
||||
'BTN_Z': {'code':'IBM_GGP_BTN_2'},
|
||||
'BTN_WEST': {'code':'IBM_GGP_BTN_3'},
|
||||
'BTN_Z': {'code':'IBM_GGP_BTN_4'},
|
||||
|
||||
# 'BTN_TL': {'code':'IBM_GGP_BTN_3'},
|
||||
# 'BTN_TR': {'code':'IBM_GGP_BTN_4'},
|
||||
@@ -241,24 +241,24 @@ PS5_DEFAULT_MAPPING = {
|
||||
|
||||
PS4_DEFAULT_MAPPING = {
|
||||
# buttons to buttons
|
||||
'PS4_CROSS': {'code':'IBM_GGP_BTN_1'},
|
||||
'PS4_SQUARE': {'code':'IBM_GGP_BTN_2'},
|
||||
'PS4_CIRCLE': {'code':'IBM_GGP_BTN_3'},
|
||||
'PS4_TRIANGLE': {'code':'IBM_GGP_BTN_4'},
|
||||
'PS_CROSS': {'code':'IBM_GGP_BTN_1'},
|
||||
'PS_SQUARE': {'code':'IBM_GGP_BTN_2'},
|
||||
'PS_CIRCLE': {'code':'IBM_GGP_BTN_3'},
|
||||
'PS_TRIANGLE': {'code':'IBM_GGP_BTN_4'},
|
||||
|
||||
'PS4_L1': {'code':'IBM_GGP_BTN_1'},
|
||||
'PS4_R1': {'code':'IBM_GGP_BTN_2'},
|
||||
'PS_L1': {'code':'IBM_GGP_BTN_3'},
|
||||
'PS_R1': {'code':'IBM_GGP_BTN_4'},
|
||||
|
||||
# 'PS4_L2_BUTTON': {'code':'IBM_GGP_BTN_3'},
|
||||
# 'PS4_R2_BUTTON': {'code':'IBM_GGP_BTN_4'},
|
||||
# 'PS_L2_BUTTON': {'code':'IBM_GGP_BTN_3'},
|
||||
# 'PS_R2_BUTTON': {'code':'IBM_GGP_BTN_4'},
|
||||
|
||||
# analog axes to analog axes
|
||||
'PS4_LSX': {'code':'IBM_GGP_JS1_X'},
|
||||
'PS4_LSY': {'code':'IBM_GGP_JS1_Y'},
|
||||
'PS4_DPX': {'code':'IBM_GGP_JS1_X'},
|
||||
'PS4_DPY': {'code':'IBM_GGP_JS1_Y'},
|
||||
'PS4_RSX': {'code':'IBM_GGP_JS2_X'},
|
||||
'PS4_RSY': {'code':'IBM_GGP_JS2_Y'},
|
||||
'PS4_L2_ANALOG':{'code':'IBM_GGP_JS2_YP'},
|
||||
'PS4_R2_ANALOG':{'code':'IBM_GGP_JS2_YN'},
|
||||
'PS_LSX': {'code':'IBM_GGP_JS1_X'},
|
||||
'PS_LSY': {'code':'IBM_GGP_JS1_Y'},
|
||||
'PS_DPX': {'code':'IBM_GGP_JS1_X'},
|
||||
'PS_DPY': {'code':'IBM_GGP_JS1_Y'},
|
||||
'PS_RSX': {'code':'IBM_GGP_JS2_X'},
|
||||
'PS_RSY': {'code':'IBM_GGP_JS2_Y'},
|
||||
'PS_L2_ANALOG':{'code':'IBM_GGP_JS2_YP'},
|
||||
'PS_R2_ANALOG':{'code':'IBM_GGP_JS2_YN'},
|
||||
}
|
||||
|
||||
@@ -506,7 +506,7 @@ class usb4vc_menu(object):
|
||||
for xxx in range(curve_horizontal_axis_width):
|
||||
dict_key = xxx*4
|
||||
this_point_x = xxx + curve_vertial_axis_x_pos
|
||||
this_point_y = OLED_HEIGHT - this_curve[dict_key]//4 - 1
|
||||
this_point_y = usb4vc_oled.OLED_HEIGHT - this_curve[dict_key]//4 - 1
|
||||
draw.line((this_point_x,this_point_y,this_point_x,this_point_y), fill="white")
|
||||
|
||||
def display_page(self, level, page):
|
||||
|
||||
@@ -192,6 +192,7 @@ def translate_dict(old_mapping_dict, lookup_dict):
|
||||
return translated_map_dict
|
||||
|
||||
def find_keycode_in_mapping(source_code, mapping_dict, usb_gamepad_type):
|
||||
print(source_code, mapping_dict, usb_gamepad_type)
|
||||
map_dict_copy = dict(mapping_dict)
|
||||
if 'DualSense' in usb_gamepad_type and map_dict_copy.get("MAPPING_TYPE") == "DEFAULT_15PIN":
|
||||
map_dict_copy = usb4vc_gamepads.PS5_DEFAULT_MAPPING
|
||||
@@ -269,7 +270,7 @@ def apply_curve(x_0_255, y_0_255):
|
||||
prev_gp_output = {}
|
||||
prev_kb_output = {}
|
||||
curr_mouse_output = {}
|
||||
def make_generic_gamepad_spi_packet(gp_status_dict, this_device_info, mapping_info):
|
||||
def make_15pin_gamepad_spi_packet(gp_status_dict, this_device_info, mapping_info):
|
||||
global prev_gp_output
|
||||
global prev_kb_output
|
||||
global curr_mouse_output
|
||||
@@ -469,11 +470,11 @@ def make_gamepad_spi_packet(gp_status_dict, this_device_info):
|
||||
current_protocol = usb4vc_ui.get_gamepad_protocol()
|
||||
try:
|
||||
if current_protocol['pid'] in [PID_GENERIC_GAMEPORT_GAMEPAD, PID_PROTOCOL_OFF]:
|
||||
return make_generic_gamepad_spi_packet(gp_status_dict, this_device_info, current_protocol)
|
||||
return make_15pin_gamepad_spi_packet(gp_status_dict, this_device_info, current_protocol)
|
||||
elif current_protocol['pid'] == PID_RAW_USB_GAMEPAD:
|
||||
return make_raw_gamepad_spi_packet(gp_status_dict, this_device_info)
|
||||
except Exception as e:
|
||||
print("exception make_generic_gamepad_spi_packet:", e)
|
||||
print("exception make_15pin_gamepad_spi_packet:", e)
|
||||
return list(nop_spi_msg_template), None, None
|
||||
|
||||
def change_kb_led(scrolllock, numlock, capslock):
|
||||
|
||||
Reference in New Issue
Block a user