Description
CircuitPython version and board name
Adafruit CircuitPython 9.2.4-11-g9eeb5d93e7 on 2025-02-05; Adafruit QT Py ESP32C3 with ESP32-C3FN4
Adafruit CircuitPython 9.2.4 on 2025-01-29; Seeed Studio XIAO ESP32C3 with ESP32-C3FN4
Adafruit CircuitPython 9.0.0 on 2024-03-19; Seeed Studio XIAO ESP32C3 with ESP32-C3FN4
Code/REPL
import mdns
import wifi
mdnserv = mdns.Server(wifi.radio)
mdnserv.hostname = "test-name"
Behavior
When the mdns hostname is set just before the code ends, it ends up being scrambled with random data, (looking like a dangling pointer). This is solved by not leaving code.py, or seemingly adding some seconds of sleep before the end. Although for example with a 5 seconds sleep I still get a bad mdns after power cycle, sometimes.
I could not repro on an S2 or S3 QTPY, it seems limited to the C3.
It happens with 9.0.0 but not 8.2.10
- The bad hostname does not seem to affect the actual hostname used as reported by a mdns scanner.
- It makes the web workflow
version.json
(accessed via IP) be invalid json if the characters are bad. wifi.radio.hostname
however still reports the default hostname. For example:cpy-d_xiao_esp32c3-d4f98d03fbec
There seems to be other issues related to mdns since 9.0, but they don't seem to be the same, though they might have the same underlying cause.
Description
No response
Additional information
Board properly reported from the home page of another board as test-name
:
Default hostname reported by the wifi module:
Adafruit CircuitPython 9.2.4-44-g255eea9b9c on 2025-02-09; Seeed Studio XIAO ESP32C3 with ESP32-C3FN4
>>> import wifi
>>> wifi.radio.hostname
'cpy-d_xiao_esp32c3-d4f98d03fbec'
>>>
But has a bad name in web workflow:
If the name causes a bad json:
Uncaught (in promise) SyntaxError: JSON.parse: bad control character in string literal at line 1 column 297 of the JSON data
One such json (varies on reloads):
{"web_api_version": 4, "version": "9.2.4-44-g255eea9b9c", "build_date": "2025-02-09", "board_name": "Seeed Studio XIAO ESP32C3", "mcu_name": "ESP32-C3FN4", "board_id": "seeed_xiao_esp32c3", "creator_id": 796806, "creation_id": 12779521, "hostname": "be8d94e303e36182432040d60379fbc2592cf3ca3fa158�tp=UDP�vn=65537
vs=845.6.1�ov=18.3�vv=1�Z", "port": 80, "UID": "4D9FD830BFCE", "ip": "192.168.1.44"}