mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-05 20:34:27 +01:00
The firmware checked its payload only after waiting up to 10 s for a console; meanwhile the data port said state=off, which the app takes as "no payload, reprogram this board": it reflashed the board, the board rebooted into the same wait, and with a new device name the once-per-board guard never held. Now the payload is checked first and the port says "boot" until then; the app reprograms only after 4 s of "off" and once per board serial number. Diagnostics: the app reads the RP2040's console (CDC 0) all the time and Diagnosis.java turns it into plain words (keying and packet count, ACK, swapped D+/D-, attached or not, boot mode, chip, errors), tested on four real Transporter logs. New buttons: share the full log, restart the boot signal (rekey). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UVqsRpwNe3f8G3bWubf9TX
37 lines
1.7 KiB
Java
37 lines
1.7 KiB
Java
// SPDX-License-Identifier: MIT
|
|
// Diagnosis on real FM-1 Transporter logs: android/rescue/test/run_diag.sh LOG...
|
|
import fm.jiant.rescue.Diagnosis;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Path;
|
|
|
|
public class DiagTest {
|
|
public static void main(String[] a) throws Exception {
|
|
for (String f : a) {
|
|
Diagnosis d = new Diagnosis();
|
|
int n = 0;
|
|
for (String line : Files.readAllLines(Path.of(f))) {
|
|
int i = line.indexOf("console: ");
|
|
d.feed(i >= 0 ? line.substring(i + 9) : line);
|
|
n++;
|
|
}
|
|
String[] s = d.summary(true);
|
|
System.out.println(Path.of(f).getFileName() + " (" + n + " lines)\n -> " + s[0] + "\n " + s[1]);
|
|
}
|
|
// synthetic cases
|
|
String[][] cases = {
|
|
{"[ 1 us] KEY: sending 0x16EF", "[ 2 us] KEY: 4070 packets"},
|
|
{"[ 1 us] KEY: sending 0x16EF", "[ 2 us] KEY: 300000 packets"},
|
|
{"[ 1 us] KEY: sending", "D- pulled up instead of D+ - are D+/D- wired swapped?"},
|
|
{"[ 1 us] ACK (data line held low) after 10 packets", "[ 2 us] HANDOFF: x", "[ 9 us] HOST: no device mounted yet (2.0 s after host start)"},
|
|
{"[1 us] RESCUE: ERROR at 000000: this is not an FM-1 (chip key / flash ID)", "RESCUE: chip key 1234, type 3, flash id EF4014"},
|
|
{"RESCUE: DONE in 80.1 s."},
|
|
};
|
|
for (String[] c : cases) {
|
|
Diagnosis d = new Diagnosis();
|
|
for (String l : c) d.feed(l);
|
|
String[] s = d.summary(true);
|
|
System.out.println("synthetic: " + c[c.length - 1].substring(0, Math.min(40, c[c.length - 1].length())) + "\n -> " + s[0] + "\n " + s[1]);
|
|
}
|
|
}
|
|
}
|