From 13ea3e644f70f8a13abddb5bda53e0abde1bbbea Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 29 May 2025 14:13:56 +1000 Subject: [PATCH 1/2] tools: data_logger_sync: fix sync'ing removable loggers Update the packet filters to filter out announce packets that don't match the requested logger, rather than hardcoded to ignoring removable loggers. Signed-off-by: Jordan Yates --- src/infuse_iot/tools/data_logger_sync.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/infuse_iot/tools/data_logger_sync.py b/src/infuse_iot/tools/data_logger_sync.py index 6ac7ec4..7498f19 100644 --- a/src/infuse_iot/tools/data_logger_sync.py +++ b/src/infuse_iot/tools/data_logger_sync.py @@ -180,8 +180,10 @@ def run(self): self.state_update(live, "Scanning") if self._app and announce.application != self._app: continue - if announce.flags & 0x01: - # Skip data on removable loggers + # Don't consider announce packets that don't contain information about the requested logger + req_removable = self._logger == rpc_enum_data_logger.FLASH_REMOVABLE + announce_is_removable = announce.flags & 0x01 + if req_removable != announce_is_removable: continue if source.infuse_id not in self._device_state: From d7544da772482140a64d5845238dcf0cc56f36e0 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 29 May 2025 14:20:21 +1000 Subject: [PATCH 2/2] tools: data_logger_sync: add percentage Add the percentage of the data currently downloaded to disk to the status table. Signed-off-by: Jordan Yates --- src/infuse_iot/tools/data_logger_sync.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/infuse_iot/tools/data_logger_sync.py b/src/infuse_iot/tools/data_logger_sync.py index 7498f19..89e3c7f 100644 --- a/src/infuse_iot/tools/data_logger_sync.py +++ b/src/infuse_iot/tools/data_logger_sync.py @@ -114,12 +114,13 @@ def add_parser(cls, parser): def progress_table(self): table = Table() table.add_column("Device ID") - table.add_column("On Disk") - table.add_column("On Device") - table.add_column("Downloaded") + table.add_column("On Disk", justify="right") + table.add_column("On Device", justify="right") + table.add_column("Downloaded", justify="right") for device, state in self._device_state.items(): on_device = str(state.on_device) if state.on_device is not None else "?" - table.add_row(f"{device:016x}", str(state.on_disk), on_device, str(state.downloaded)) + percent = f"{100 * state.on_disk / state.on_device:.0f}" if state.on_device is not None else "?" + table.add_row(f"{device:016x}", f"{state.on_disk} ({percent:>3s}%)", on_device, str(state.downloaded)) meta = Table(box=None) meta.add_column()