-
-
Notifications
You must be signed in to change notification settings - Fork 791
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
Fix: WiFi configuration issues via USB (HTTP/WPS provisioning sometimes unreliable) #2059
Fix: WiFi configuration issues via USB (HTTP/WPS provisioning sometimes unreliable) #2059
Conversation
758729a
to
4e6ea5c
Compare
4e6ea5c
to
791891e
Compare
447e76d
to
eabddff
Compare
Hi! |
@Misaka0x2730 Hello! This was previously suggested by @ALTracer, and is a good idea. Since this PR is a feature update it is awaiting review and merging until after the next release. Hopefully, during this period I can adopt the suggestion. |
I am not sure this is such a good idea since it prevents grouping the custom commands logically in the command list. Plus, there are quite a few other custom commands already in the command list, e.g. TraceSWO & RTT. I think unless the maintainers (@dragonmux ) feel it is required I am going to leave the added command for this PR as it is. |
I agree that @dragonmux is the one who’ll ultimately decide here. |
I agree that these should be platform commands at least for now, though not having control over the grouping is unfortunate. |
@perigoso Thanks for your input. I would be happy to review the platform commands should the command table/architecture change in the future. |
…d save for display to user.
Display is incorrect, needs to treat input bytes as hex.
This is required to keep the wi-fi stack operational, the BMF code blocks in this function at times and therefore, wi-fi is not serviced.
eabddff
to
11b0093
Compare
Having had a conversation with Sid on Discord, we are switching this to being a fix PR rather than a feature, and promoting it into the v2.0 track for after rc2's release. |
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.
Apologies getting to review this took so long. Most of the items are types related (signed-unsigned conversions mostly) and should all be pretty simple fixes. With them taken care of we'll get this merged so this issue can be fixed for the full v2.0 release.
#ifdef PLATFORM_HAS_BATTERY | ||
static bool cmd_target_battery(target_s *t, int argc, const char **argv); | ||
#endif | ||
#ifdef PLATFORM_HAS_WIFI | ||
static bool cmd_wifi(target_s *t, int argc, const char **argv); | ||
#endif |
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.
Not for this PR, but for a future one: These should probably both become platform commands. That way you don't need to export as much platform state into the rest of the code base, and they get grouped under the platform commands heading in the mon help
output. We can look at improving this in v2.1 though so this is fine as is for now.
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.
Agreed as previously discussed.
@@ -531,6 +536,12 @@ static void app_wifi_callback(uint8_t msg_type, void *msg) | |||
break; | |||
} | |||
|
|||
case M2M_WIFI_CONN_INFO_RESPONSE_EVENT: { | |||
tstrM2MConnInfo *connection_info = (tstrM2MConnInfo *)msg; | |||
memcpy(&conn_info, connection_info, sizeof(tstrM2MConnInfo)); |
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 what it's worth, memcpy()
takes a void pointer for the pointer parameters so you could simplify this to memcpy(&conn_info, msg, sizeof(tstrM2MConnInfo));
and forgo the pointer conversion and local.
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.
Agreed, however the local aids with debugging, that is why it was added.
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.
Hmm.. ah, by allowing you to view the pre-and-post-image of the memcpy() before running it?
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.
Not really, the parameter "msg" is a void pointer from the WINC1500 stack and it may point to one of several different structures depending upon the message type (msg_type). I use an intermediate local of the expected type to allow easier examination of the structure with the debugger. I think originally, the debugger didn't handle type casting too well, hence this approach.
@@ -558,10 +569,14 @@ static void app_wifi_callback(uint8_t msg_type, void *msg) | |||
} | |||
|
|||
case M2M_WIFI_IP_ADDRESS_ASSIGNED_EVENT: { | |||
t_wifiEventData *wifi_event_data = (t_wifiEventData *)msg; | |||
if (wifi_event_data != NULL) | |||
tstrM2MIPConfig *ip_config = (tstrM2MIPConfig *)msg; |
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.
Beyond checking the pointer is non-NULL, is this local used for anything here? If not then the if
should probably become if (msg != NULL)
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.
Like the above comment, the local is a useful debugging addition.
Required for new network "forget" command.
Embedded spaces not being processed correctly.
11b0093
to
af71d57
Compare
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 is looking much better - good work! Spotted a couple of small things in the rewritten wifi_connect()
logic, but with them taken care of we're happy to merge this.
Previous version of the parser did not handle multiple spaces.
af71d57
to
bf9529a
Compare
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.
LGTM, merging - nice work cleaning things up so quickly. Thank you for the contribution!
This PR adds Wi-Fi management for ctxLink using GDB and a new monitor command.
With the original releases of ctxLink some users had issues using the HTTP and WPS provisioning features of ctxLink.
Also, after provisioning some users found it hard to discover the IP address of ctxLink, this is required to connect to the probe.
The new monitor command is "wifi".
To inspect the current Wi-Fi status the following command is used:
mon wifi
This will display either "Not Connected," or the SSID, Signal Strength (RSSI), and IP address of the connected Access Point.
To connect to a Wi-Fi Access Point the following command is used, substituting the SSID and PassPhrase settings of the AP:
mon wifi SSID,Passphrase
Spaces are accepted for these two parameters, however, there should be no space before or after the ",".
Your checklist for this pull request
Closing issues
None.