Wi-Fi over USB tab for firmware with the USB console (v13)
Writes / reads / removes the box's Wi-Fi over the serial port with the usb_console commands (kota ping, wifi set|get|clear, health) and follows the box through the restart until it joins the network. The password is sent hex-encoded and never logged. firmware/ now holds merged-binary-v13.bin (build 3ae273ec) instead of the previous 1.0.16 build; error_ids.csv synced with the firmware. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0d21c5c205
commit
ab420220e1
11 files changed
+758
No files matched your search
@@ -335,6 +335,8 @@ class DiagnosticsEngine:
|
||||
self.matter_qr: str | None = None # "KOTA: matter ... qr=MT:..."
|
||||
self.matter_manual: str | None = None
|
||||
self.kota_seen = False # firmware prints KOTA: lines
|
||||
self.console_api: int | None = None # "cmd ping ... api=N": box accepts USB commands
|
||||
self.wifi_config: dict[str, str] | None = None # last "cmd wifi_get" reply (never a password)
|
||||
self._reset_led_state()
|
||||
|
||||
def _reset_led_state(self) -> None:
|
||||
@@ -714,6 +716,20 @@ class DiagnosticsEngine:
|
||||
fd = self._custom(key, Severity[sev.upper()], title, meaning, actions, expl)
|
||||
self._touch(fd, line)
|
||||
|
||||
def _kota_cmd(self, line: LogLine, f: dict[str, str]) -> None:
|
||||
"""Replies to commands sent by this tool (firmware usb_console)."""
|
||||
name = line.words[0] if line.words else ""
|
||||
if f.get("ok") != "1":
|
||||
return # the Wi-Fi tab reports failures itself
|
||||
if name == "ping":
|
||||
api = f.get("api", "")
|
||||
self.console_api = int(api) if api.isdigit() else None
|
||||
elif name == "health":
|
||||
self.boot.kota["health"] = line # same fields as the periodic health line
|
||||
self._kota_health(line, f)
|
||||
elif name == "wifi_get":
|
||||
self.wifi_config = {k: f.get(k, "?") for k in ("ssid", "password_set", "mode")}
|
||||
|
||||
def _kota_led(self, line: LogLine, f: dict[str, str]) -> None:
|
||||
if "previous_boot" in line.words:
|
||||
code = f.get("code", "0")
|
||||
@@ -845,6 +861,12 @@ class DiagnosticsEngine:
|
||||
if ln := k.get("mic"):
|
||||
on = ln.fields.get("enabled") == "1"
|
||||
out.append(("Microphone", "on" if on else "switched OFF (switch on the back)", "ok" if on else "info"))
|
||||
if self.wifi_config:
|
||||
from ..serialio.commands import unhex_utf8
|
||||
w = self.wifi_config
|
||||
ssid = unhex_utf8(w["ssid"])
|
||||
out.append(("Wi-Fi config", (f"network '{ssid}', password {'set' if w['password_set'] == '1' else 'NOT set'}"
|
||||
if ssid else "no network on the SD card") + f", mode {w['mode']}", "info"))
|
||||
if ln := k.get("health"):
|
||||
f = ln.fields
|
||||
wifi = f.get("wifi", "?")
|
||||
|
||||
Reference in new issue
Block a user