From e57e6ed268ad33f91fbb457516d0742c392d2530 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 14 Jul 2026 17:55:02 -0700 Subject: [PATCH] feat(lf): force device debug quiet during identify identify_lf now sets the device debug level to NONE (hw.dbg(0)) before its LF captures. On debug-heavy firmware a raised g_dbglevel makes LF acquisition emit device-side Dbprintf frames over USB, which interleave with the sample download and desync it. This is the device-side knob (g_dbglevel), distinct from the C client's g_debugMode terminal spam; quieting it removes a source of async frames during pm3py's own reads. Co-Authored-By: Claude Opus 4.8 --- pm3py/lf/capture.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pm3py/lf/capture.py b/pm3py/lf/capture.py index 5e8c651..566905a 100644 --- a/pm3py/lf/capture.py +++ b/pm3py/lf/capture.py @@ -120,6 +120,12 @@ def identify_lf(device, emit=None) -> dict | None: if device is None: return None + # Force the device debug level to NONE for the duration: on debug-heavy firmware a raised + # g_dbglevel makes LF acquisition emit Dbprintf frames over USB, which interleave with the + # sample download and desync it. This is the device-side knob (not the C client's g_debugMode + # spam), and pm3py's own reads are what matter here. + _try(lambda: device.hw.dbg(0), None) + config = read_config(device) # T55xx? -> chip + emulation emitted = read_emitted(device) # what's on the air -> EM4100 ID (etc.)