← index #11619PR #10635
Related · high · value 0.540
QUERY · ISSUE

network.country availability

openby massimosalaopened 2023-05-25updated 2024-06-20
enhancement

Hi

Please see
https://github.com/orgs/micropython/discussions/11548

@glenn20 wrote:

Oh, I nearly forgot.... re. Question 4... the country setting is not currently used for micropython on the esp8266. In fact, it is only used currently for the cyw43 wifi driver (eg. the rpi pico-w).

I've wasted time reading docs, finding a function, coding with it... and finding out it doesn't work because it's not implemented!

I kindly but firmly ask you to remove this function on all micros where it is a No Operation.
It will save confusion and frustration for all other developers as well.

I've been trying to set up a PR, but it seems I don't have the privilege.

CANDIDATE · PULL REQUEST

top: Common network hostname/country configuration.

mergedby jimmoopened 2023-02-01updated 2023-06-26
ports

The overall goal is to allow configuration of the hostname on Pico W, but also unify the way networking works across ports. Fixes #8906, #10397

This PR adds network.hostname() and network.country() to globally set the device hostname (for all interfaces) and country (for radio compliance). For interfaces that previously supported nic.config(hostname) this will continue to work, as will pyb.country() (and rp2.country()).

Additionally configure the default hostname on a per-port and per-board basis. We may want to remove this change if it's considered a breaking change to change the default hostname?

It also updates the stm32 port to use the new cyw43-driver (in the lib/cyw43-driver submodule) and removes the old version from drivers. This relies on https://github.com/georgerobotics/cyw43-driver/pull/58.

Next steps (separate PR):

  • Investigate configuring mDNS more explicitly. See #9058 and #9086 for more history.
  • Implement hostname for other NICs (Nina, Wiznet) and country for all other non-cyw43 wifi (Nina, ESP8266, ESP32).
  • Unify other networking config, in particular the auth and mode constants, and make it possible to write the same code on all ports to manage the WiFi interface. Eventually I'd like to remove the modnetwork customisations used by ESP8266/ESP32 and have them work like the other ports.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied