feat: pair controllers and show them in the app

Port the MT76 client functions (send_wlan, associate_client,
pair_client, set_client_key, remove_client) and wire the RX dispatch
into the session: EP IN frames are parsed, ASSOC_REQ associates a
controller (WCID plus chip programming), PAIR_REQ replies with
PAIR_RESP, and DISASSOC or client-lost removes it. The C API exposes
connected controllers and the app lists them by MAC. Bumps
xone_cli/xone_app to C++23: they were falling back to the default
standard once mt76.hpp started using std::span. Adds a unit test pinning
the WCID regions, the 32-byte rxwi, and the new frame control values.

Co-Authored-By: qwen3.8-27b@q2_k_xl: client functions, RX dispatch, GUI list
This commit is contained in:
portersky
2026-08-17 20:40:47 +02:00
parent b3e747b900
commit dae51f085b
9 changed files with 682 additions and 7 deletions
+24
View File
@@ -117,6 +117,29 @@ void test_beacon_layout(void)
TEST_ASSERT_EQUAL_UINT32(sizeof(xone::mt76::broadcast_address), 6);
}
// Pin the WCID regions and RX descriptor to transport/mt76_defs.h values.
void test_client_association_layout(void)
{
// WCID register regions (1-based index; slot 0 is reserved).
TEST_ASSERT_EQUAL_UINT32(xone::mt76::mt_wcid_addr(0), 0x1800);
TEST_ASSERT_EQUAL_UINT32(xone::mt76::mt_wcid_addr(1), 0x1808);
TEST_ASSERT_EQUAL_UINT32(xone::mt76::mt_wcid_key(1), 0x8020);
TEST_ASSERT_EQUAL_UINT32(xone::mt76::mt_wcid_iv(1), 0xa008);
TEST_ASSERT_EQUAL_UINT32(xone::mt76::mt_wcid_attr(1), 0xa804);
TEST_ASSERT_EQUAL_UINT32(
static_cast<std::uint32_t>(xone::mt76::xone_mt_wcid_key_len), 16);
// RX descriptor is 32 bytes on the wire.
TEST_ASSERT_EQUAL_UINT32(sizeof(xone::mt76::mt76_rxwi), 32);
// Client command and 802.11 frame control values.
TEST_ASSERT_EQUAL_UINT16(xone::mt76::ieee80211_stype_assoc_resp, 0x0010);
TEST_ASSERT_EQUAL_UINT16(xone::mt76::ieee80211_stype_disassoc, 0x00a0);
TEST_ASSERT_EQUAL_UINT16(xone::mt76::ieee80211_stype_qos_data, 0x0070);
TEST_ASSERT_EQUAL_UINT16(
xone::mt76::ieee80211_stype_wlan_reserved, 0x0070);
}
int main(void)
{
UNITY_BEGIN();
@@ -127,5 +150,6 @@ int main(void)
RUN_TEST(test_radio_registers);
RUN_TEST(test_channel_table);
RUN_TEST(test_beacon_layout);
RUN_TEST(test_client_association_layout);
return UNITY_END();
}