-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
WPS functionality added #1694
WPS functionality added #1694
Conversation
static int ICACHE_FLASH_ATTR wps_start(lua_State* L) | ||
{ | ||
// retrieve callback arg (optional) | ||
if (wps_callback_ref != LUA_NOREF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to do the test -- you can unref LUA_NOREF
@@ -68,6 +68,7 @@ | |||
//#define LUA_USE_MODULES_UCG | |||
//#define LUA_USE_MODULES_WEBSOCKET | |||
#define LUA_USE_MODULES_WIFI | |||
#define LUA_USE_MODULES_WPS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should default to OFF
- both WiFi and Wi-Fi are valid but we seem to have opted for WiFi (although not 100% consistently) - we don't use "Errors" sections - we omit the "Examples" section if they'd be trivial
@@ -0,0 +1,63 @@ | |||
# WPS Module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A reference to this file needs to be added to /mkdocs.yaml.
The CI build fails with
Looks like the fix that @djphoenix provided in #1566 didn't last long. |
Fix whitespace
I don't mind having this available as an off-by-default module. However, I think we should prominently mention the security concerns our WiFi module maintainer @dnc40085 raised a long time ago in the docs. |
I guess we can add a statement to the WPS module documentation:
|
@marcelstoer, @djphoenix: any ideas how to fix the CI build error? |
I don't, not my area of expertise 😞 |
Rebased this PR on current After temporary increase For And the winner is...
Very close to what we see... The solution is patch LD script as I was originally propose - keep only |
@djphoenix: I am willing to test, but it's not clear how to modify the current dev LD script. |
In + *libmain.a:*(.literal .text)
+ *libnet80211.a:*(.literal .text)
+ *libphy.a:*(.literal .text)
+ *libpp.a:*(.literal .text)
+ *libgcc.a:*(.literal .text)
- *sdk/esp_iot_sdk_*lib/lib*.a:*(.literal .text) |
Thanks @djphoenix: no problems compiling. |
Keep only main, pp, phy, net80211 and gcc libs of SDK in iram, and therefore wps in irom.
// Lua: wps.disable() | ||
static int ICACHE_FLASH_ATTR wps_disable(lua_State* L) | ||
{ | ||
wifi_wps_disable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there should be error handler, as far as wps-related functions (in includes) returns bool as success/failure status.
if (lua_type(L, 1) == LUA_TFUNCTION || lua_type(L, 1) == LUA_TLIGHTFUNCTION) | ||
wps_callback_ref = luaL_ref(L, LUA_REGISTRYINDEX); | ||
else | ||
return luaL_error (L, "Argument not a function"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With luaL_checkanyfunction
no needed to manually raise an error.
And so safer way is check arguments before any internal state change.
|
||
wps_callback_ref = LUA_NOREF; | ||
|
||
if (lua_type(L, 1) == LUA_TFUNCTION || lua_type(L, 1) == LUA_TLIGHTFUNCTION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
luaL_checkanyfunction
should be there
wps_callback_ref = LUA_NOREF; | ||
|
||
if (lua_type(L, 1) == LUA_TFUNCTION || lua_type(L, 1) == LUA_TLIGHTFUNCTION) | ||
wps_callback_ref = luaL_ref(L, LUA_REGISTRYINDEX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There will be issue when more than one argument is passed, so call lua_pushvalue(L, 1)
before luaL_ref
*libnet80211.a:*(.literal .text) | ||
*libphy.a:*(.literal .text) | ||
*libpp.a:*(.literal .text) | ||
*libgcc.a:*(.literal .text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is outside this PR's scope.
@marcelstoer @jmattsson should we move it in another issue/PR or keep there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer a dedicated PR. Once it's merged we can restart the CI build here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really wary of this change altogether. As you already pointed out Yury, Espressif has put almost everything into irom0.text
, except for what appears to be a few internal pieces. Presumably they had a really good reason for keeping those in IRAM. Maybe it would be worthwhile raising the large iram1_0_seg size with Espressif as a potential bug? If they respond, we'd know for certain whether it has to be kept in IRAM or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmattsson Johny, as I reviewed, a lot of Espressif code is a mess. I think there was some internal Espressif's issues e.g. "radius of the developers hands curvature does not comply with the platform requirements" :)
Anyway for WPS we decide that it works when fully putted in irom. And for most places it right (with exceptions for interrupts-related stuff). I haven't see any of interrupt-related code here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah! Well I can't argue too strongly here seeing as I've used the "I've reviewed and tested it, and it works" argument myself in regard to flash vs ram.
Could we perhaps leave a comment in the nodemcu.ld
file indicating that we're specifically excluding ilbwps.a
due to size constraints?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmattsson I think we should move this discussion to #1710.
For @FrankX0 - just revert this part, we will fix this issue in other way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For @FrankX0 - just revert this part, we will fix this issue in other way.
The cool thing is that GitHub allows us to do that yourselves right in the browser. You can't revert but you can resolve conflicts by editing code - which is just did.
I'll add the doc amendment we talked about at #1694 (comment) after merging. Thanks Frank, Yury and Johny. |
Fixes #1556 .
dev
branch rather than formaster
.docs/en/*
.Although there seems to be some opposition against using WPS, I still think it is worthwhile making it available to whomever wants to use it.
Please bare in mind that my software/Github skills are somewhat limited.
Looking forward to your comments/acceptance.