Enable debug on flipper when attaching blackmagic --nobuild

This commit is contained in:
Willy-JL
2025-03-02 00:42:06 +00:00
parent 2de9dabffd
commit ab85ec4cc9
2 changed files with 58 additions and 0 deletions
+15
View File
@@ -1,4 +1,6 @@
from SCons.Errors import StopError
from flipper.storage import FlipperStorage
import serial.tools.list_ports as list_ports
class BlackmagicResolver:
@@ -30,6 +32,18 @@ class BlackmagicResolver:
# print("\n".join([f"{p.device} {vars(p)}" for p in ports]))
return sorted(ports, key=lambda p: f"{p.location}_{p.name}")[0]
def _enable_flipper_debug(self):
flippers = list(list_ports.grep("flip_"))
if len(flippers) != 1:
return
with FlipperStorage(flippers[0].device) as storage:
storage.send_and_wait_eol("sysctl debug 1\r")
storage.read.until(storage.CLI_EOL)
storage.send_and_wait_eol("sysctl sleep_mode legacy\r")
storage.read.until(storage.CLI_EOL)
storage.send_and_wait_eol("sysctl log_level debug\r")
storage.read.until(storage.CLI_EOL)
# Look up blackmagic probe hostname with dns
def _resolve_hostname(self):
import socket
@@ -43,6 +57,7 @@ class BlackmagicResolver:
def get_serial(self):
if not (probe := self._find_probe()):
return None
self._enable_flipper_debug()
# print(f"Found Blackmagic probe on {probe.device}")
if self.env.subst("$PLATFORM") == "win32":
return f"\\\\.\\{probe.device}"