From 258a04c88ee25886292ed4973fdf239effc893aa Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 8 Mar 2026 14:22:09 -0700 Subject: [PATCH 1/3] cli: auto-detect active slot for flash and erase commands When a partition name like "system" is given without a slot suffix (_a/_b), the CLI now auto-detects the active slot and resolves to e.g. "system_a". This matches fastboot's behavior and removes the need for callers to separately query the active slot. Co-Authored-By: Claude Opus 4.6 --- src/bin/qdl.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/bin/qdl.js b/src/bin/qdl.js index fadd99b..2592a98 100755 --- a/src/bin/qdl.js +++ b/src/bin/qdl.js @@ -25,6 +25,8 @@ Commands: erase Erase a partition flash Flash an image to a partition +Slot suffixes (_a/_b) are auto-detected from the active slot when omitted. + Flags: --programmer Use a different loader [default is comma 3/3X] --log-level, -l Set log level (silent, error, warn, info, debug) [default is info] @@ -93,14 +95,32 @@ if (command === "reset") { console.error("Expected partition name"); process.exit(1); } - const [partitionName] = commandArgs; + let [partitionName] = commandArgs; + // Auto-detect active slot if partition name doesn't have a slot suffix + if (!partitionName.endsWith("_a") && !partitionName.endsWith("_b")) { + const [found] = await qdl.detectPartition(partitionName); + if (!found) { + const activeSlot = await qdl.getActiveSlot(); + partitionName = `${partitionName}_${activeSlot}`; + console.error(`[qdl] Resolved to ${partitionName} (active slot: ${activeSlot})`); + } + } await qdl.erase(partitionName); } else if (command === "flash") { if (commandArgs.length !== 2) { console.error("Expected partition name and image path"); process.exit(1); } - const [partitionName, imageName] = commandArgs; + let [partitionName, imageName] = commandArgs; + // Auto-detect active slot if partition name doesn't have a slot suffix + if (!partitionName.endsWith("_a") && !partitionName.endsWith("_b")) { + const [found] = await qdl.detectPartition(partitionName); + if (!found) { + const activeSlot = await qdl.getActiveSlot(); + partitionName = `${partitionName}_${activeSlot}`; + console.error(`[qdl] Resolved to ${partitionName} (active slot: ${activeSlot})`); + } + } const image = Bun.file(imageName); await qdl.flashBlob(partitionName, image, createProgress(image.size)); } else { From d759d43d7cf65e60bd707f73ab97d0bcea3544f6 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 8 Mar 2026 14:25:38 -0700 Subject: [PATCH 2/3] cli: use console.info for slot resolution message Co-Authored-By: Claude Opus 4.6 --- src/bin/qdl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/qdl.js b/src/bin/qdl.js index 2592a98..f6c9acf 100755 --- a/src/bin/qdl.js +++ b/src/bin/qdl.js @@ -102,7 +102,7 @@ if (command === "reset") { if (!found) { const activeSlot = await qdl.getActiveSlot(); partitionName = `${partitionName}_${activeSlot}`; - console.error(`[qdl] Resolved to ${partitionName} (active slot: ${activeSlot})`); + console.info(`[qdl] Resolved to ${partitionName} (active slot: ${activeSlot})`); } } await qdl.erase(partitionName); @@ -118,7 +118,7 @@ if (command === "reset") { if (!found) { const activeSlot = await qdl.getActiveSlot(); partitionName = `${partitionName}_${activeSlot}`; - console.error(`[qdl] Resolved to ${partitionName} (active slot: ${activeSlot})`); + console.info(`[qdl] Resolved to ${partitionName} (active slot: ${activeSlot})`); } } const image = Bun.file(imageName); From ba34af9f4f49138f9c0dfabbe947d5cf139a09c0 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 8 Mar 2026 14:29:15 -0700 Subject: [PATCH 3/3] cli: improve slot detection log message Co-Authored-By: Claude Opus 4.6 --- src/bin/qdl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/qdl.js b/src/bin/qdl.js index f6c9acf..a1527f8 100755 --- a/src/bin/qdl.js +++ b/src/bin/qdl.js @@ -102,7 +102,7 @@ if (command === "reset") { if (!found) { const activeSlot = await qdl.getActiveSlot(); partitionName = `${partitionName}_${activeSlot}`; - console.info(`[qdl] Resolved to ${partitionName} (active slot: ${activeSlot})`); + console.info(`[qdl] Detected active slot ${activeSlot}, using ${partitionName}`); } } await qdl.erase(partitionName); @@ -118,7 +118,7 @@ if (command === "reset") { if (!found) { const activeSlot = await qdl.getActiveSlot(); partitionName = `${partitionName}_${activeSlot}`; - console.info(`[qdl] Resolved to ${partitionName} (active slot: ${activeSlot})`); + console.info(`[qdl] Detected active slot ${activeSlot}, using ${partitionName}`); } } const image = Bun.file(imageName);