Confirm EXECUTE_USER_CMD execution; retarget exec_cmd to the OEM-default name - #6
Conversation
…ault name Captured AjDevTools' file-upload, then traced comm_server/mainctrl: an uploaded file is routed by its FilePath BASENAME. OEM-default config names (defaultconfig.xml / config.default.xml / default_2_priority.xml) are copied into /mnt/nand/cust/ and processed by get_user_cmd_from_xml, which RUNS the embedded <CMD DATA=...>. An arbitrary basename is only stored (why earlier uploads didn't execute). Verified live on MTF45-4G_AF: uploading <CMD DATA='killall comm_server'/> under defaultconfig.xml dropped the control connection mid-upload (daemon actually killed, procman respawned it); camera stayed healthy (ONVIF config intact), and I cleaned up the persisted OEM-default files. exec_cmd now defaults remote_name='defaultconfig.xml' (executes), documents the persistence side effect and self-cleaning, and drops the 'unverified' caveat. 57 tests green. docs/devices.md updated.
PR Summary by QodoExecute user commands via OEM-default config names
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
- exec_cmd validates remote_name against EXEC_TRIGGER_NAMES (the OEM-default basenames the device actually executes); a non-executing name now raises ValueError instead of silently storing commands that never run. - README: drop the stale 'EXECUTE_USER_CMD wiring is a follow-up' note — it's implemented and execution-confirmed. - Test for the remote_name guard. 58 green.
Closes the one open question from #5: what makes an uploaded
EXECUTE_USER_CMDactually execute.How it was resolved
comm_serversaves the upload to/tmp/upfile_*.datand routes it by theFilePathbasename;mainctrl'sget_user_cmd_from_xmlrunsEXECUTE_USER_CMDonly for OEM-default config names (defaultconfig.xml,config.default.xml,default_2_priority.xml) copied into/mnt/nand/cust/. An arbitrary basename is only stored — which is exactly why the earlier uploads didn't run.<CMD DATA="killall comm_server"/>underdefaultconfig.xmldropped the control connection mid-upload (the daemon was actually killed, then respawned byprocman). Camera stayed healthy (ONVIF config intact), and I removed the persisted OEM-default files afterward.Changes
exec_cmd(*cmds, remote_name="defaultconfig.xml", confirm=True)now targets the executing name and drops the "unverified" caveat — execution is confirmed.ptzClear.xmlbehaviour; self-clean with a trailingrm -f /mnt/nand/cust/<name>), and a command that stopscomm_serverdrops the connection as it runs (expected).docs/devices.mdupdated. 57 tests green.Note: I did this the safe way — a targeted test using the exact names the device's own code recognises (not blind file-type brute-forcing), with the self-healing
killallas the observable, and cleaned up after.