changed custom map list to set, added usb update folder structure format

This commit is contained in:
dekunukem
2022-01-14 22:37:07 +00:00
parent c898cc9192
commit 07bdf1862f
4 changed files with 20 additions and 92 deletions

View File

@@ -131,4 +131,20 @@ sudo apt install usbmount
sudo nano /lib/systemd/system/systemd-udevd.service sudo nano /lib/systemd/system/systemd-udevd.service
change to PrivateMounts=no change to PrivateMounts=no
-----------
usb folder format:
usb root:
usb4vc_data
rpi_app
source code of raspberry pi application
firmware
dfu file for protocol boards
naming format: PBFW_IBMPC_PBID1_V0_1_0.dfu
config
config and mapping files

View File

@@ -1,26 +0,0 @@
{
"display_name": "2js2map",
"device_type": "protocol_list_gamepad",
"protocol_board": "IBMPC",
"protocol_name": "GAMEPORT_GENERIC_GAMEPAD",
"mapping": {
"BTN_NORTH": {
"code": "IBM_GGP_BTN_1"
},
"BTN_WEST": {
"code": "IBM_GGP_BTN_2"
},
"ABS_X": {
"code": "IBM_GGP_JS1_X"
},
"ABS_Y": {
"code": "IBM_GGP_JS1_Y"
},
"BTN_TL": {
"code": "IBM_GGP_JS1_XN"
},
"BTN_TR": {
"code": "IBM_GGP_JS1_XP"
}
}
}

View File

@@ -1,62 +0,0 @@
{
"display_name": "my_map",
"device_type": "protocol_list_gamepad",
"protocol_board": "IBMPC",
"protocol_name": "GAMEPORT_GENERIC_GAMEPAD",
"mapping": {
"BTN_NORTH": {
"code": "IBM_GGP_BTN_1"
},
"BTN_WEST": {
"code": "IBM_GGP_BTN_2"
},
"ABS_X": {
"code": "IBM_GGP_JS1_X"
},
"ABS_Y": {
"code": "IBM_GGP_JS1_Y"
},
"BTN_TL": {
"code": "IBM_GGP_JS1_XN"
},
"BTN_TR": {
"code": "IBM_GGP_JS1_XP"
},
"BTN_START": {
"code": "KEY_A"
},
"BTN_SELECT": {
"code": "KEY_B"
},
"KEY_HOMEPAGE": {
"code": "KEY_C"
},
"KEY_BACK": {
"code": "KEY_D"
},
"ABS_HAT0X": {
"code": "KEY_1",
"code_neg": "KEY_2",
"deadzone_percent": 15
},
"ABS_HAT0Y": {
"code": "KEY_3",
"code_neg": "KEY_4",
"deadzone_percent": 15
},
"BTN_SOUTH": {
"code": "BTN_LEFT"
},
"BTN_EAST": {
"code": "BTN_RIGHT"
},
"ABS_Z": {
"code": "REL_X",
"deadzone_percent": 15
},
"ABS_RZ": {
"code": "REL_Y",
"deadzone_percent": 15
}
}
}

View File

@@ -127,7 +127,7 @@ PROTOCOL_RAW_KEYBOARD = {'pid':125, 'display_name':"Raw data"}
PROTOCOL_RAW_MOUSE = {'pid':126, 'display_name':"Raw data"} PROTOCOL_RAW_MOUSE = {'pid':126, 'display_name':"Raw data"}
PROTOCOL_RAW_GAMEPAD = {'pid':127, 'display_name':"Raw data"} PROTOCOL_RAW_GAMEPAD = {'pid':127, 'display_name':"Raw data"}
custom_profile_list = [] custom_profile_set = set()
mypath = '/home/pi/usb4vc_data' mypath = '/home/pi/usb4vc_data'
mypath = './' mypath = './'
@@ -137,7 +137,7 @@ try:
json_map_files = [os.path.join(mypath, x) for x in onlyfiles if x.lower().startswith('usb4vc_map') and x.lower().endswith(".json")] json_map_files = [os.path.join(mypath, x) for x in onlyfiles if x.lower().startswith('usb4vc_map') and x.lower().endswith(".json")]
for item in json_map_files: for item in json_map_files:
with open(item) as json_file: with open(item) as json_file:
custom_profile_list.append(json.load(json_file)) custom_profile_set.add(json.load(json_file))
except Exception as e: except Exception as e:
print('load json maps:', e) print('load json maps:', e)
@@ -656,7 +656,7 @@ def ui_init():
this_pboard_id = pboard_info_spi_msg[3] this_pboard_id = pboard_info_spi_msg[3]
if this_pboard_id in pboard_database: if this_pboard_id in pboard_database:
# load custom profile mapping into protocol list # load custom profile mapping into protocol list
for item in custom_profile_list: for item in custom_profile_set:
this_mapping_bid = usb4vc_shared.board_id_lookup.get(item['protocol_board'], 0) this_mapping_bid = usb4vc_shared.board_id_lookup.get(item['protocol_board'], 0)
if this_mapping_bid == this_pboard_id and item['device_type'] in pboard_database[this_pboard_id]: if this_mapping_bid == this_pboard_id and item['device_type'] in pboard_database[this_pboard_id]:
this_mapping_pid = usb4vc_shared.protocol_id_lookup.get(item['protocol_name']) this_mapping_pid = usb4vc_shared.protocol_id_lookup.get(item['protocol_name'])