aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-04-15 18:21:39 +0000
committerGitHub <[email protected]>2024-04-15 18:21:39 +0000
commit27ba2ad5b0aaf0638aac3b1f141e98f6ff2b84ab (patch)
tree1ce1a68bb7689a17f0045393961e9b4c74fe2142
parent40e7ea47bac9afc70696a66010b28928535ca075 (diff)
parentaeb4daa22fb767b239781a3f9abd85e70c767917 (diff)
Merge pull request #2818 from ImTheSquid/main
Add MAC address getter to cyw43 controller
-rw-r--r--cyw43/src/control.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/cyw43/src/control.rs b/cyw43/src/control.rs
index 135b8c245..a3808f56f 100644
--- a/cyw43/src/control.rs
+++ b/cyw43/src/control.rs
@@ -124,8 +124,7 @@ impl<'a> Control<'a> {
124 self.set_iovar_u32("apsta", 1).await; 124 self.set_iovar_u32("apsta", 1).await;
125 125
126 // read MAC addr. 126 // read MAC addr.
127 let mut mac_addr = [0; 6]; 127 let mac_addr = self.address().await;
128 assert_eq!(self.get_iovar("cur_etheraddr", &mut mac_addr).await, 6);
129 debug!("mac addr: {:02x}", Bytes(&mac_addr)); 128 debug!("mac addr: {:02x}", Bytes(&mac_addr));
130 129
131 let country = countries::WORLD_WIDE_XX; 130 let country = countries::WORLD_WIDE_XX;
@@ -574,6 +573,13 @@ impl<'a> Control<'a> {
574 self.ioctl(IoctlType::Set, IOCTL_CMD_DISASSOC, 0, &mut []).await; 573 self.ioctl(IoctlType::Set, IOCTL_CMD_DISASSOC, 0, &mut []).await;
575 info!("Disassociated") 574 info!("Disassociated")
576 } 575 }
576
577 /// Gets the MAC address of the device
578 pub async fn address(&mut self) -> [u8; 6] {
579 let mut mac_addr = [0; 6];
580 assert_eq!(self.get_iovar("cur_etheraddr", &mut mac_addr).await, 6);
581 mac_addr
582 }
577} 583}
578 584
579/// WiFi network scanner. 585/// WiFi network scanner.