From f938174d86332d48f0f53d244e826a02a9f69773 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Thu, 23 Jul 2026 17:03:12 +0200 Subject: [PATCH] debug(gamestream): hex-dump the first few undecodable pointer packets Co-Authored-By: Claude Fable 5 --- .../punktfunk-host/src/gamestream/control.rs | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/crates/punktfunk-host/src/gamestream/control.rs b/crates/punktfunk-host/src/gamestream/control.rs index a39bbe34..511ae27b 100644 --- a/crates/punktfunk-host/src/gamestream/control.rs +++ b/crates/punktfunk-host/src/gamestream/control.rs @@ -291,11 +291,22 @@ fn on_receive( return; } else if super::input::is_pointer_magic(&pt) { // A pointer magic that failed the body parse — a layout mismatch against this - // client, exactly what an on-glass "touch/pen does nothing" needs surfaced. - tracing::warn!( - len = pt.len(), - "gamestream: SS_TOUCH/SS_PEN packet failed to decode (malformed/unexpected layout)" - ); + // client, exactly what an on-glass "touch/pen does nothing" needs surfaced. The + // first few dump their bytes so the mismatch is diagnosable from the log alone. + static HEX_DUMPS: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0); + if HEX_DUMPS.fetch_add(1, std::sync::atomic::Ordering::Relaxed) < 5 { + let hex: String = pt.iter().map(|b| format!("{b:02x}")).collect(); + tracing::warn!( + len = pt.len(), + bytes = %hex, + "gamestream: SS_TOUCH/SS_PEN packet failed to decode (malformed/unexpected layout)" + ); + } else { + tracing::warn!( + len = pt.len(), + "gamestream: SS_TOUCH/SS_PEN packet failed to decode (malformed/unexpected layout)" + ); + } return; }