Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to set hostname? #392

Closed
brychanrobot opened this issue Dec 27, 2023 · 1 comment
Closed

Is there a way to set hostname? #392

brychanrobot opened this issue Dec 27, 2023 · 1 comment

Comments

@brychanrobot
Copy link

The idf API allows setting the hostname by adding CONFIG_LWIP_LOCAL_HOSTNAME=<chosen-hostname> to the sdkconfig.defaults file. That doesn't seem to work in esp-wifi. Is there another way to do it?

@brychanrobot
Copy link
Author

I figured out how to do this at least with embassy-net. For posterity, you can set a hostname on the DhcpConfig. This does require enabling the dchpv4-hostname feature on the embassy-net dep.

let mut dhcp_config = DhcpConfig::default();
dhcp_config.hostname = Some(heapless::String::from_str("test-hostname").unwrap());
let embassy_net_config = embassy_net::Config::dhcpv4(dhcp_config);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

1 participant