blocking and non-blocking shell cmd exec
This commit is contained in:
parent
8993ccdf66
commit
005e15b21b
@ -40,6 +40,7 @@ class ActionId(enum.IntEnum):
|
||||
XSC_REBOOT = 32
|
||||
FULL_REBOOT = 34
|
||||
EXECUTE_SHELL_CMD_BLOCKING = 40
|
||||
EXECUTE_SHELL_CMD_NON_BLOCKING = 41
|
||||
SYSTEMCTL_CMD_EXECUTOR = 42
|
||||
|
||||
|
||||
@ -55,7 +56,8 @@ class OpCode:
|
||||
ANNOUNCE_VERSION = "announce_version"
|
||||
ANNOUNCE_CURRENT_IMAGE = "announce_current_image"
|
||||
ANNOUNCE_BOOT_COUNTS = "announce_boot_counts"
|
||||
EXECUTE_SHELL_CMD_BLOCKING = "exec_shell_cmd_blocking"
|
||||
EXECUTE_SHELL_CMD_BLOCKING = "exec_cmd_blocking"
|
||||
EXECUTE_SHELL_CMD_NON_BLOCKING = "exec_cmd_non_blocking"
|
||||
SYSTEMCTL_CMD_EXECUTOR = "systemctl_cmd"
|
||||
SET_PREF_SD = "set_pref_sd"
|
||||
REBOOT_XSC = ["reboot_xsc"]
|
||||
@ -87,7 +89,8 @@ class Info:
|
||||
ANNOUNCE_CURRENT_IMAGE = "Announce current image"
|
||||
ANNOUNCE_BOOT_COUNTS = "Announce boot counts"
|
||||
SYSTEMCTL_CMD_EXECUTOR = "Perform systemctl command"
|
||||
EXECUTE_SHELL_CMD_BLOCKING = "Execute shell command (blocking)"
|
||||
EXECUTE_SHELL_CMD_BLOCKING = "Execute shell command blocking"
|
||||
EXECUTE_SHELL_CMD_NON_BLOCKING = "Execute shell command non-blocking"
|
||||
SET_PREF_SD = "Set preferred SD card"
|
||||
REBOOT_XSC = "XSC reboot with prompt"
|
||||
REBOOT_FULL = "Full regular reboot"
|
||||
@ -222,13 +225,20 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
||||
action_id=ActionId.SYSTEMCTL_CMD_EXECUTOR,
|
||||
user_data=cmd_data
|
||||
))
|
||||
elif op_code in OpCode.EXECUTE_SHELL_CMD_BLOCKING:
|
||||
elif op_code == OpCode.EXECUTE_SHELL_CMD_BLOCKING:
|
||||
custom_cmd = input("Please specify command to execute: ")
|
||||
q.add_pus_tc(create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionId.EXECUTE_SHELL_CMD_BLOCKING,
|
||||
user_data=custom_cmd.encode()
|
||||
))
|
||||
elif op_code == OpCode.EXECUTE_SHELL_CMD_NON_BLOCKING:
|
||||
custom_cmd = input("Please specify command to execute: ")
|
||||
q.add_pus_tc(create_action_cmd(
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionId.EXECUTE_SHELL_CMD_NON_BLOCKING,
|
||||
user_data=custom_cmd.encode()
|
||||
))
|
||||
elif op_code in OpCode.XSC_REBOOT_0_0:
|
||||
add_xsc_reboot_cmd(
|
||||
q=q, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_0_NOM
|
||||
|
Loading…
Reference in New Issue
Block a user