Setting hostname on Pico W
Setting hostname on Pico W
Can the hostname be set on cyw43-based boards? My Raspberry Pi Pico W's all want to appear as PYBD, which seems to be the hard-coded hostname in the driver:
netif_set_hostname(n, "PYBD");
WLAN.config(dhcp_hostname="...") or WLAN.config(hostname="...") are not supported as parameters, either.
netif_set_hostname(n, "PYBD");
WLAN.config(dhcp_hostname="...") or WLAN.config(hostname="...") are not supported as parameters, either.
Re: Setting hostname on Pico W
Not at the moment. Same issue (unsurprisingly) on the pybd.
It's quite a simple fix - just need to wire up the plumbing to ultimately call netif_set_hostname like you say. It's been on my TODO list for a while because I have a project with several pyboards on the same network... but just haven't got to it yet.
Re: Setting hostname on Pico W
Thanks, Jim. This is a nice to have enhancement rather than an i-can't-connect issue.
I've put a feature request here: Set hostname on cyw43-based boards - Issue #8910 - micropython/micropython. Sorry I can't contribute code or sponsorship, and cakes don't travel well.
I've put a feature request here: Set hostname on cyw43-based boards - Issue #8910 - micropython/micropython. Sorry I can't contribute code or sponsorship, and cakes don't travel well.
Re: Setting hostname on Pico W
+1 needing this.
I have a project where I will have at least 2 pico W's on the same network, probably many more once I get more familiar with them.
I have a project where I will have at least 2 pico W's on the same network, probably many more once I get more familiar with them.
Re: Setting hostname on Pico W
There's a PR, but it hasn't been accepted yet: CYW43: Allow setting hostname. #8918
and of course, despite searching, my issue was a duplicate. Here's the live issue: Can't set hostname in AP mode
and of course, despite searching, my issue was a duplicate. Here's the live issue: Can't set hostname in AP mode
Re: Setting hostname on Pico W
The pull request has been closed which I think means it is merged in. I downloaded the latest build v1.19.1-240-g9dfabcd6d (2022-08-05) .uf2 and I've tried setting the hostname:
So now I don't know if the parameter "hostname" is wrong or if it just isn't in the latest build yet. Any ideas?
Code: Select all
sta_if.config("hostname")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: unknown config param
Re: Setting hostname on Pico W
I don't think it's in the nightlies yet. I just tried the same uf2 as you did, and the only known config parameters are channel, mac, security, ssid and txpower:
Code: Select all
# check WLAN config values
# table from
# https://docs.micropython.org/en/latest/library/network.WLAN.html
import network
sta_if = network.WLAN(network.STA_IF)
for i in ("channel", "hidden", "hostname", "key", "mac",
"reconnects", "security", "ssid", "txpower"):
try:
cfg=sta_if.config(i)
except:
cfg="unknown config parameter"
print(i, ":", cfg)
Re: Setting hostname on Pico W
Hi, just tried build rp2-pico-w-20220808-unstable-v1.19.1-241-g6baeded32.uf2
But unfortunately no success.
Anyone any clues?
But unfortunately no success.
Anyone any clues?
Re: Setting hostname on Pico W
Looking into the sources, there are two variants of the CYW43 driver, one in lib/cyw43-drivers, one in drivers/cyw43. And there is a compile switch controlling which of both is used. Only the driver in drivers/cyw43 supports setting the hostname, but the standard compile uses the other driver.
Trying to build the other variant fails. Looks messy!
Trying to build the other variant fails. Looks messy!
Re: Setting hostname on Pico W
The drivers/cyw43 driver will be merged into the one in lib soon, hopefully for the 1.20 release.