From d02fcbd2a690d1f56834831443bc023444171bce Mon Sep 17 00:00:00 2001 From: Reed Krantz Date: Thu, 11 Jun 2026 01:46:41 -0500 Subject: [PATCH] feat: set hostname for the device --- Cargo.toml | 4 +++- src/bin/main.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ad8f782..8802981 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,10 +35,12 @@ critical-section = "1.2.0" static_cell = "2.1.1" embassy-net = { version = "0.9.0", features = [ - "dhcpv4", + "defmt", + "dhcpv4-hostname", "medium-ethernet", "tcp", "dns", + "mdns", ] } esp-radio = { version = "0.18.0", features = [ "defmt", diff --git a/src/bin/main.rs b/src/bin/main.rs index 801c75b..3955c72 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -83,7 +83,9 @@ async fn main(spawner: Spawner) -> ! { ) .expect("Failed to initialize Wi-Fi controller"); - let net_config = embassy_net::Config::dhcpv4(Default::default()); + let mut dhcp_config = embassy_net::DhcpConfig::default(); + dhcp_config.hostname = Some("cover-theif".try_into().unwrap()); + let net_config = embassy_net::Config::dhcpv4(dhcp_config); let rng = esp_hal::rng::Rng::new(); let seed = (rng.random() as u64) << 32 | rng.random() as u64;