From 4b69cda61939b6082d1dd25c0dc24a5f7c23d0d3 Mon Sep 17 00:00:00 2001 From: "Rich O." Date: Sun, 1 Nov 2026 15:35:45 -0500 Subject: [PATCH] palm-client: an empty channel name means an unused slot The bridge log showed GET_CHANNEL replies for unused slots with an empty name but non-zero bytes after it: the firmware builds them in a reused buffer, so they carry the previous reply's leftovers. Treating a non-zero secret as in use listed all 40 slots as channels. --- palm-client/src/channels.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/palm-client/src/channels.c b/palm-client/src/channels.c index 0ca20a8..af951ed 100644 --- a/palm-client/src/channels.c +++ b/palm-client/src/channels.c @@ -66,17 +66,14 @@ Boolean ChannelsFindSlot(UInt8 slot, VmChannel *out) return false; } -/* A slot with no name and an all-zero secret is unused. */ +/* + * A slot with an empty name is unused. The secret can't be used to tell: the + * firmware fills unused slots' replies from a reused buffer, so the bytes after + * the empty name are left over from the previous reply. + */ static Boolean InUse(const VmChannel *c) { - UInt16 i; - - if (c->name[0]) - return true; - for (i = 0; i < VM_CHANNEL_SECRET_SIZE; i++) - if (c->secret[i]) - return true; - return false; + return c->name[0] != 0; } Err ChannelsRefresh(UInt8 maxChannels)