Skip to content

Commit fd289dd

Browse files
committed
Fix 1537 double-association when pairing
1 parent 6c5bda7 commit fd289dd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

dongle/mt76.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ bool Mt76::beforeClose()
6060

6161
void Mt76::handleWlanPacket(const Bytes &packet)
6262
{
63+
const RxWi *rxWi = packet.toStruct<RxWi>();
6364
const WlanFrame *wlanFrame = packet.toStruct<WlanFrame>(sizeof(RxWi));
6465

6566
const Bytes source(
@@ -104,6 +105,26 @@ void Mt76::handleWlanPacket(const Bytes &packet)
104105
clientConnected(wcid, source);
105106
}
106107

108+
// Only kept for compatibility with 1537 controllers
109+
// They associate, disassociate and associate again during pairing
110+
// Disassociations happen without triggering EVT_CLIENT_LOST
111+
else if (subtype == MT_WLAN_DISASSOC)
112+
{
113+
Log::debug(
114+
"Client disassociating: %s",
115+
Log::formatBytes(source).c_str()
116+
);
117+
118+
if (!removeClient(rxWi->wcid))
119+
{
120+
Log::error("Failed to remove client");
121+
122+
return;
123+
}
124+
125+
clientDisconnected(rxWi->wcid);
126+
}
127+
107128
// Reserved frames are used for different purposes
108129
// Most of them are yet to be discovered
109130
else if (subtype == MT_WLAN_RESERVED)

0 commit comments

Comments
 (0)