From 0a22a6eb5610604c24eb6ecd9fa3ccee65771545 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 17 Jul 2025 20:56:46 +1000 Subject: [PATCH] tools: ota_upgrade: support diffs from different app Support upgrading specific devices from one application to another if the diff file exists. Signed-off-by: Jordan Yates --- src/infuse_iot/tools/ota_upgrade.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/infuse_iot/tools/ota_upgrade.py b/src/infuse_iot/tools/ota_upgrade.py index e48a1ba..1512f23 100644 --- a/src/infuse_iot/tools/ota_upgrade.py +++ b/src/infuse_iot/tools/ota_upgrade.py @@ -111,7 +111,7 @@ def run(self): with Live(self.progress_table(), refresh_per_second=4) as live: for source, announce in self._client.observe_announce(): self.state_update(live, "Scanning") - if announce.application != self._app_id: + if announce.application != self._app_id and not self._single_id: continue if self._single_id: if self._single_id != source.infuse_id: @@ -159,11 +159,14 @@ def run(self): # Do we have a valid diff? diff_file = self._release.dir / "diffs" / f"{v_str}.bin" if not diff_file.exists(): - self._missing_diffs.add(v_str) - self._handled.append(source.infuse_id) - self._no_diff += 1 - self.state_update(live, "Scanning") - continue + # Is this a single diff from a different application we know about? + diff_file = self._release.dir / "diffs" / f"0x{announce.application:08x}" / f"{v_str}.bin" + if not diff_file.exists(): + self._missing_diffs.add(v_str) + self._handled.append(source.infuse_id) + self._no_diff += 1 + self.state_update(live, "Scanning") + continue # Is signal strong enough to connect? if self._min_rssi and source.rssi < self._min_rssi: