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.
This commit is contained in:
1 parent
40412223a4
commit
4b69cda619
1 file changed
+6
-9
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user