debug: trace GIP authentication headers

Log incoming and outgoing authentication context, command, option, and
length fields to isolate the handshake failure before input reports begin.

Co-Authored-By: openai/gpt-5.6-luna: added authentication diagnostics
This commit is contained in:
portersky
2026-08-29 13:47:43 +02:00
parent bc39c37b28
commit 0ed7a4bc3e
+12
View File
@@ -157,6 +157,12 @@ auto auth::process_pkt(std::span<u8 const> data) -> int
if (data.size() < sizeof(*hdr))
return -EINVAL;
log_msg(log_level::debug,
"auth: rx context=0x%02x options=0x%02x error=0x%02x "
"command=0x%02x length=%u",
hdr->context, hdr->options, hdr->error, hdr->command,
load_be16(&hdr->length));
if (hdr->error)
return -EPROTO;
@@ -187,6 +193,9 @@ auto auth::send_pkt(u8 cmd, void const* pkt, std::size_t len) -> int
store_be16(&hdr->data.length, static_cast<u16>(data_len - sizeof(hdr->data)));
last_sent_command_ = cmd;
log_msg(log_level::debug,
"auth: tx command=0x%02x data_length=%u acknowledge=1",
cmd, data_len);
transcript_.update(
{reinterpret_cast<u8 const*>(hdr) + sizeof(hdr->handshake), data_len});
@@ -204,6 +213,9 @@ auto auth::request_pkt(u8 cmd, std::uint16_t len) -> int
req.header.command = cmd;
store_be16(&req.header.length, data_len);
log_msg(log_level::debug,
"auth: tx request command=0x%02x data_length=%u acknowledge=1",
cmd, data_len);
return sink_.send({reinterpret_cast<u8 const*>(&req), sizeof(req)}, true);
}