fix(#3): improve bypass module selection diagnostics

Resolves #3: [ERROR] No compatible bypass module for this device

Two bugs caused iPhone 15 (A12+, Path B) to get a generic "No compatible
bypass module" error despite being fully supported:

Bug A: select_module() in main.c printed a single unhelpful error line
when bypass_select() returned NULL, with no indication of WHY the device
was rejected. Added print_module_diagnostics() that reports DFU mode
status, CPID, chip name, checkm8 status, product type, and a specific
explanation (not in DFU, CPID unread, chip not in DB).

Bug B: handle_dfu_requirement() in start.sh only guided checkm8 (Path A)
devices into DFU mode. A12+ Path B devices were never prompted for DFU
entry, so the binary was launched with is_dfu_mode=0 and both path probes
rejected the device. Refactored to a shared wait_for_dfu_entry() helper
that is called for ALL supported devices not already in DFU mode.

Files modified:
- src/main.c
- start.sh

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
tr4m0ryp 2026-04-12 19:59:10 +02:00
parent 7225d83717
commit 92e9f99f25
2 changed files with 64 additions and 29 deletions

View file

@ -162,6 +162,30 @@ static void register_modules(void)
log_debug("Registered %d bypass module(s)", bypass_count());
}
static void print_module_diagnostics(const device_info_t *dev)
{
log_error("No compatible bypass module for this device");
log_error("--- Diagnostic info ---");
log_error(" DFU mode: %s", dev->is_dfu_mode ? "YES" : "NO");
log_error(" CPID: 0x%04X", dev->cpid);
log_error(" Chip: %s", dev->chip_name[0] ? dev->chip_name : "(unknown)");
log_error(" checkm8: %s", dev->checkm8_vulnerable ? "vulnerable" : "not vulnerable");
log_error(" Product: %s", dev->product_type[0] ? dev->product_type : "(unknown)");
if (!dev->is_dfu_mode) {
log_error("Both bypass paths require DFU mode.");
log_error("Run ./start.sh for guided DFU entry, or enter DFU manually.");
} else if (dev->cpid == 0) {
log_error("CPID is 0x0000 -- device chip not identified.");
log_error("Ensure device is properly in DFU mode (screen must be BLACK).");
} else if (dev->chip_name[0] == '\0' ||
strcmp(dev->chip_name, "Unknown") == 0) {
log_error("Chip CPID 0x%04X not found in database.", dev->cpid);
}
log_error("-----------------------");
}
static const bypass_module_t *select_module(device_info_t *dev,
const cli_opts_t *opts)
{
@ -176,7 +200,7 @@ static const bypass_module_t *select_module(device_info_t *dev,
const bypass_module_t *mod = bypass_select(dev);
if (!mod) {
log_error("No compatible bypass module for this device");
print_module_diagnostics(dev);
return NULL;
}