Closed Gadgetoid closed 3 years ago
thanks, please make a PR for it!
thanks, please make a PR for it!
I was worried you might say this.
Already half way down the rabbit hole of figuring out how to compile and test :laughing:
@Gadgetoid
The practical implications of this seem to be that it's not possible to set the hostname,
Why would someone want to do this - what's the purpose in the context of this lib.? (asking b/c I'm trying to understand the practical consideration for the issue).
Well twofold:
It was 2 that sent me down the rabbit hole chasing this bug, since a customer had tried to set a hostname to no avail and was - as per 1 - understandably confused 🤣
The upstream
WiFiClass::hostname
copies the incoming "name" value into a "_hostname" char array here:https://github.com/arduino/nina-fw/blob/9b4c4355cb82c6ebbdbf9bc178696e3b60712026/arduino/libraries/WiFi/src/WiFi.cpp#L420-L423
And then re-uses it on a system event to update the hostname, here:
https://github.com/arduino/nina-fw/blob/9b4c4355cb82c6ebbdbf9bc178696e3b60712026/arduino/libraries/WiFi/src/WiFi.cpp#L712
By contrast, this fork attempts to update the value immediately like so:
https://github.com/adafruit/nina-fw/blob/ec9e20f5085a121bfeb6348a9ab98bba69193369/arduino/libraries/WiFi/src/WiFi.cpp#L321-L324
And then always uses the default hostname in handleSystemEvent:
https://github.com/adafruit/nina-fw/blob/ec9e20f5085a121bfeb6348a9ab98bba69193369/arduino/libraries/WiFi/src/WiFi.cpp#L607
The practical implications of this seem to be that it's not possible to set the hostname, since I have tried issuing the command to do this and received a response.
The fix for this originates from this PR - https://github.com/arduino/nina-fw/pull/24 - which doesn't seem to have made it into this fork.