From 183f1ef4ef5aa4be9c7d516ba9b8fe2419b59555 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Tue, 5 May 2026 09:26:29 +1000 Subject: [PATCH 1/3] rpc_wrappers: fix incorrect error messages Fix incorrect error messages cause by copy pasting the wrappers. Signed-off-by: Jordan Yates --- src/infuse_iot/rpc_wrappers/application_info.py | 2 +- src/infuse_iot/rpc_wrappers/lte_state.py | 2 +- src/infuse_iot/rpc_wrappers/lte_state_v2.py | 2 +- src/infuse_iot/rpc_wrappers/security_state.py | 2 +- src/infuse_iot/rpc_wrappers/wifi_scan.py | 2 +- src/infuse_iot/rpc_wrappers/wifi_state.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/infuse_iot/rpc_wrappers/application_info.py b/src/infuse_iot/rpc_wrappers/application_info.py index 5298578..f5f7607 100644 --- a/src/infuse_iot/rpc_wrappers/application_info.py +++ b/src/infuse_iot/rpc_wrappers/application_info.py @@ -22,7 +22,7 @@ def request_json(self): def handle_response(self, return_code, response): if return_code != 0: - print(f"Failed to query current time ({errno.strerror(-return_code)})") + print(f"Failed to query application info ({errno.strerror(-return_code)})") return r = response diff --git a/src/infuse_iot/rpc_wrappers/lte_state.py b/src/infuse_iot/rpc_wrappers/lte_state.py index acea112..9cbd6cb 100644 --- a/src/infuse_iot/rpc_wrappers/lte_state.py +++ b/src/infuse_iot/rpc_wrappers/lte_state.py @@ -25,7 +25,7 @@ def request_json(self): def handle_response(self, return_code, response): if return_code != 0: - print(f"Failed to query current time ({errno.strerror(-return_code)})") + print(f"Failed to query LTE state ({errno.strerror(-return_code)})") return common = response.common diff --git a/src/infuse_iot/rpc_wrappers/lte_state_v2.py b/src/infuse_iot/rpc_wrappers/lte_state_v2.py index 33aaed4..dea80d5 100644 --- a/src/infuse_iot/rpc_wrappers/lte_state_v2.py +++ b/src/infuse_iot/rpc_wrappers/lte_state_v2.py @@ -25,7 +25,7 @@ def request_json(self): def handle_response(self, return_code, response): if return_code != 0: - print(f"Failed to query current time ({errno.strerror(-return_code)})") + print(f"Failed to query LTE state ({errno.strerror(-return_code)})") return common = response.common diff --git a/src/infuse_iot/rpc_wrappers/security_state.py b/src/infuse_iot/rpc_wrappers/security_state.py index 2250e76..93ac68c 100644 --- a/src/infuse_iot/rpc_wrappers/security_state.py +++ b/src/infuse_iot/rpc_wrappers/security_state.py @@ -87,7 +87,7 @@ def _decrypt_response(self, response): def handle_response(self, return_code, response): if return_code != 0: - print(f"Failed to query current time ({errno.strerror(-return_code)})") + print(f"Failed to query security state ({errno.strerror(-return_code)})") return def print_bytes(ctypes_array) -> str: diff --git a/src/infuse_iot/rpc_wrappers/wifi_scan.py b/src/infuse_iot/rpc_wrappers/wifi_scan.py index 8d90d84..641743f 100644 --- a/src/infuse_iot/rpc_wrappers/wifi_scan.py +++ b/src/infuse_iot/rpc_wrappers/wifi_scan.py @@ -21,7 +21,7 @@ def request_struct(self): def handle_response(self, return_code, response): if return_code != 0: - print(f"Failed to query current time ({errno.strerror(-return_code)})") + print(f"Failed to scan wifi networks ({errno.strerror(-return_code)})") return table = [] diff --git a/src/infuse_iot/rpc_wrappers/wifi_state.py b/src/infuse_iot/rpc_wrappers/wifi_state.py index c974d95..ee7587b 100644 --- a/src/infuse_iot/rpc_wrappers/wifi_state.py +++ b/src/infuse_iot/rpc_wrappers/wifi_state.py @@ -91,7 +91,7 @@ def request_struct(self): def handle_response(self, return_code, response): if return_code != 0: - print(f"Failed to query current time ({errno.strerror(-return_code)})") + print(f"Failed to query WiFi state ({errno.strerror(-return_code)})") return common = response.common From 6f005a6ba54a7c9d98114a024266e135e0e8616b Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Tue, 5 May 2026 09:27:15 +1000 Subject: [PATCH 2/3] tools: rpc_cloud: fix length for data read commands Use the RPC wrapper supplied length instead of always using the "Unknown" value. Signed-off-by: Jordan Yates --- src/infuse_iot/tools/rpc_cloud.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/infuse_iot/tools/rpc_cloud.py b/src/infuse_iot/tools/rpc_cloud.py index 15d7066..2d7d832 100644 --- a/src/infuse_iot/tools/rpc_cloud.py +++ b/src/infuse_iot/tools/rpc_cloud.py @@ -22,7 +22,6 @@ from infuse_iot.commands import InfuseCommand, InfuseRpcCommand from infuse_iot.credentials import get_api_key from infuse_iot.definitions.rpc import id_type_mapping -from infuse_iot.util.ctypes import UINT32_MAX from infuse_iot.zephyr.errno import errno @@ -82,7 +81,7 @@ def queue(self, client: Client): if command.RPC_DATA_RECEIVE: # Generic "unknown" data volume - rpc_req.data_header = RPCReqDataHeader(UINT32_MAX, 0) + rpc_req.data_header = RPCReqDataHeader(command.data_payload_recv_len(), 0) rpc_msg = NewRPCMessage(infuse_id, rpc_req, timeout_ms) rsp = send_rpc.sync(client=client, body=rpc_msg) From c0a58409dda63ce37dce7ce453c4a7565f3a4370 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Tue, 5 May 2026 09:28:06 +1000 Subject: [PATCH 3/3] tools: rpc_cloud: option to print parameters Add a command line option to print the raw arguments of the queued command. Signed-off-by: Jordan Yates --- src/infuse_iot/tools/rpc_cloud.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/infuse_iot/tools/rpc_cloud.py b/src/infuse_iot/tools/rpc_cloud.py index 2d7d832..4009023 100644 --- a/src/infuse_iot/tools/rpc_cloud.py +++ b/src/infuse_iot/tools/rpc_cloud.py @@ -38,6 +38,7 @@ def add_parser(cls, parser): parser_queue.set_defaults(_tool_action="queue") parser_queue.add_argument("--id", required=True, type=lambda x: int(x, 0), help="Infuse ID to run command on") parser_queue.add_argument("--queue-timeout", type=int, default=600, help="Timeout to send command in seconds") + parser_queue.add_argument("--print-params", action="store_true", help="Print queued RPC request") command_list_parser = parser_queue.add_subparsers(title="commands", metavar="", required=True) for _, name, _ in pkgutil.walk_packages(wrappers.__path__): @@ -84,6 +85,10 @@ def queue(self, client: Client): rpc_req.data_header = RPCReqDataHeader(command.data_payload_recv_len(), 0) rpc_msg = NewRPCMessage(infuse_id, rpc_req, timeout_ms) + + if self._args.print_params: + print(f"Request: {rpc_msg.to_dict()}") + rsp = send_rpc.sync(client=client, body=rpc_msg) if rsp is None: sys.exit("Failed to queue RPC (No response)")