some fixes
This commit is contained in:
parent
37bb164cc4
commit
77e90328a1
@ -46,6 +46,7 @@ class ActionId(enum.IntEnum):
|
||||
CP_HELPER = 52
|
||||
MV_HELPER = 53
|
||||
RM_HELPER = 54
|
||||
MKDIR_HELPER = 55
|
||||
|
||||
|
||||
class ParamId(enum.IntEnum):
|
||||
@ -68,6 +69,7 @@ class OpCode:
|
||||
CP_HELPER = "cp_helper"
|
||||
MV_HELPER = "mv_helper"
|
||||
RM_HELPER = "rm_helper"
|
||||
MKDIR_HELPER = "mkdir_helper"
|
||||
SET_PREF_SD = "set_pref_sd"
|
||||
REBOOT_XSC = ["reboot_xsc"]
|
||||
XSC_REBOOT_SELF = ["reboot_self"]
|
||||
@ -114,6 +116,7 @@ class Info:
|
||||
CP_HELPER = "Filesystem Copy Helper"
|
||||
MV_HELPER = "Filesystem Move Helper"
|
||||
RM_HELPER = "Filesystem Removal Helper"
|
||||
MKDIR_HELPER = "Filesystem Directory Creation Helper"
|
||||
|
||||
|
||||
class Chip(enum.IntEnum):
|
||||
@ -203,6 +206,7 @@ def add_core_controller_definitions(defs: TmtcDefinitionWrapper):
|
||||
oce.add(keys=OpCode.MV_HELPER, info=Info.MV_HELPER)
|
||||
oce.add(keys=OpCode.CP_HELPER, info=Info.CP_HELPER)
|
||||
oce.add(keys=OpCode.RM_HELPER, info=Info.RM_HELPER)
|
||||
oce.add(keys=OpCode.MKDIR_HELPER, info=Info.MKDIR_HELPER)
|
||||
defs.add_service(CustomServiceList.CORE.value, "Core Controller", oce)
|
||||
|
||||
|
||||
@ -412,7 +416,9 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
if rm_force not in [0, 1]:
|
||||
raise ValueError("Invalid value, only 0 or 1 allowed")
|
||||
user_data = bytearray([rm_recursive, rm_force])
|
||||
user_data.extend(packet_source_dest_path("Copy"))
|
||||
removed_file_or_dir = input("Specify absolute path to be removed: ")
|
||||
user_data.extend(removed_file_or_dir.encode())
|
||||
user_data.append(0)
|
||||
q.add_log_cmd(Info.RM_HELPER)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(CORE_CONTROLLER_ID, ActionId.RM_HELPER, user_data)
|
||||
@ -436,6 +442,14 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
CORE_CONTROLLER_ID, ActionId.LIST_DIR_DUMP_DIRECTLY, user_data
|
||||
)
|
||||
)
|
||||
elif op_code == OpCode.MKDIR_HELPER:
|
||||
q.add_log_cmd(Info.MKDIR_HELPER)
|
||||
user_data = input("Specify absolute path of newly created directory: ")
|
||||
user_data = bytearray(user_data.encode())
|
||||
user_data.append(0)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(CORE_CONTROLLER_ID, ActionId.MKDIR_HELPER, user_data)
|
||||
)
|
||||
else:
|
||||
_LOGGER.warning(
|
||||
f"Unknown operation code {op_code} for core controller commands"
|
||||
@ -460,8 +474,8 @@ def list_directory_base_user_data() -> bytearray:
|
||||
|
||||
|
||||
def packet_source_dest_path(context: str) -> bytes:
|
||||
source = input(f"{context} source file")
|
||||
dest = input(f"{context} destination file")
|
||||
source = input(f"Specify {context} source file: ")
|
||||
dest = input(f"Specify {context} destination file: ")
|
||||
raw_src_dest = bytearray(source.encode())
|
||||
raw_src_dest.append(0)
|
||||
raw_src_dest.extend(dest.encode())
|
||||
|
Loading…
Reference in New Issue
Block a user