Add IPv6 link-local address to net_init and info response, use WaitGroup.Go

This commit is contained in:
Ian Gulliver
2026-04-06 17:20:13 +09:00
parent 1fa1b2076c
commit 00ab432a72
7 changed files with 34 additions and 28 deletions

View File

@@ -51,6 +51,7 @@ int main() {
std::copy(uid.id, uid.id + 8, resp.board_id.begin());
auto ninfo = w6300::get_net_info();
resp.mac = ninfo.mac;
resp.link_local = ninfo.lla;
usb.send(encode_response(msg->message_id, resp));
break;
}

View File

@@ -47,8 +47,9 @@ struct ResponseInfo {
static constexpr int8_t ext_id = 5;
std::array<uint8_t, 8> board_id;
std::array<uint8_t, 6> mac;
auto as_tuple() const { return std::tie(board_id, mac); }
auto as_tuple() { return std::tie(board_id, mac); }
std::array<uint8_t, 16> link_local;
auto as_tuple() const { return std::tie(board_id, mac, link_local); }
auto as_tuple() { return std::tie(board_id, mac, link_local); }
};
static constexpr uint8_t hash_key[8] = {};

View File

@@ -18,6 +18,18 @@ bool net_init() {
info.mac[3] = uid.id[3];
info.mac[4] = uid.id[4];
info.mac[5] = uid.id[5];
info.lla[0] = 0xfe;
info.lla[1] = 0x80;
info.lla[8] = info.mac[0] ^ 0x02;
info.lla[9] = info.mac[1];
info.lla[10] = info.mac[2];
info.lla[11] = 0xff;
info.lla[12] = 0xfe;
info.lla[13] = info.mac[3];
info.lla[14] = info.mac[4];
info.lla[15] = info.mac[5];
w6300::init_net(info);
return true;

View File

@@ -47,6 +47,7 @@ int main() {
std::copy(uid.id, uid.id + 8, resp.board_id.begin());
auto ninfo = w6300::get_net_info();
resp.mac = ninfo.mac;
resp.link_local = ninfo.lla;
usb.send(encode_response(msg->message_id, resp));
break;
}