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

SoftAP name not set properly #1151

Closed
hyteoo opened this issue Aug 23, 2018 · 4 comments
Closed

SoftAP name not set properly #1151

hyteoo opened this issue Aug 23, 2018 · 4 comments

Comments

@hyteoo
Copy link
Contributor

hyteoo commented Aug 23, 2018

When in soft AP, it seems that the hostname and is ignored.
Ex.
esp
wifi

@mcspr

ESP_... comes from justwifi lib: https://github.com/xoseperez/justwifi/blob/c423f102d0ece574beac6b536f11cb692709763c/src/JustWifi.cpp#L52
If no SSID provided, it uses hostname: https://github.com/xoseperez/justwifi/blob/c423f102d0ece574beac6b536f11cb692709763c/src/JustWifi.cpp#L296-298

As Xose did mention, something funky must be happening to the settings. Only thing that makes sense if hostname is empty here / hostname key from eeprom settings returns nothing.

#if USE_PASSWORD
jw.setSoftAP(getSetting("hostname").c_str(), getSetting("adminPass", ADMIN_PASS).c_str());
#else
jw.setSoftAP(getSetting("hostname").c_str());
#endif

And looking at wifi listings only common thing I did notice that in all cases ESP APs are passwordless, which is likely happening because setSoftAP returns early with some condition failing.

@mcspr
Copy link
Collaborator

mcspr commented Aug 24, 2018

@hyteoo tnx :) #1103 did mention long hostname... and i did mention justwifi as a source but that's not it. this is just sdk doing which happens to have the same ssid creating logic.

Still, from justwifi: WiFi.softAP is called at some point and it will enable AP first and only then check / set given ssid+passphrase. If hostname is longer than 31 chars or pass is less than 8 i too can see this behaviour. e.g. erasing flash (sdk does persist softap settings) and adding '-DHOSTNAME="..."' or '-DADMIN_PASS="test"' results in the same ESP_XXXXXX ssid.

WebUI does enforce hostname / password lengths.
code/espurna/config/{defaults,general}.h should mention this limitation for both HOSTNAME and ADMIN_PASS.
And there must be 3rd layer of length checks so debug log shows this too, otherwise this is confusing :/

@hyteoo
Copy link
Contributor Author

hyteoo commented Aug 24, 2018

I checked this and indeed, the password was the problem. In my case it had 7 characters.
I had it setup in my general.h define, so I never changed it from the webui.
After checking the webUI, it seems that that is also wrong, as it suggests a minimum of 5 characters.
Therefore I propose the following:

  1. Add a comment for the password define, warning it should be at least 8 characters (maybe even a preprocessor validation...even though I'm not sure you can do a strlen there....)

    #ifndef ADMIN_PASS
    #define ADMIN_PASS "fibonacci" // Default password (WEB, OTA, WIFI)
    #endif

  2. Change the WebUI text and validation from 5 to 8.

@stale
Copy link

stale bot commented Oct 24, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 24, 2018
@stale
Copy link

stale bot commented Oct 31, 2018

This issue will be auto-closed because there hasn't been any activity for two months. Feel free to open a new one if you still experience this problem.

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

No branches or pull requests

3 participants