Added MAC address getter to cyw43 controller

This commit is contained in:
Jack Hogan 2024-04-15 14:11:28 -04:00
parent 20110ce6c7
commit 6ffecb1250
No known key found for this signature in database
GPG Key ID: 818B3CB459CCC8A9

View File

@ -124,8 +124,7 @@ impl<'a> Control<'a> {
self.set_iovar_u32("apsta", 1).await; self.set_iovar_u32("apsta", 1).await;
// read MAC addr. // read MAC addr.
let mut mac_addr = [0; 6]; let mac_addr = self.address().await;
assert_eq!(self.get_iovar("cur_etheraddr", &mut mac_addr).await, 6);
debug!("mac addr: {:02x}", Bytes(&mac_addr)); debug!("mac addr: {:02x}", Bytes(&mac_addr));
let country = countries::WORLD_WIDE_XX; let country = countries::WORLD_WIDE_XX;
@ -574,6 +573,13 @@ impl<'a> Control<'a> {
self.ioctl(IoctlType::Set, IOCTL_CMD_DISASSOC, 0, &mut []).await; self.ioctl(IoctlType::Set, IOCTL_CMD_DISASSOC, 0, &mut []).await;
info!("Disassociated") info!("Disassociated")
} }
/// Gets the MAC address of the device
pub async fn address(&mut self) -> [u8; 6] {
let mut mac_addr = [0; 6];
assert_eq!(self.get_iovar("cur_etheraddr", &mut mac_addr).await, 6);
mac_addr
}
} }
/// WiFi network scanner. /// WiFi network scanner.