Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion software/io/wifi/wifi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ void BrowsableWifiAP :: fetch_context_items(IndexedList<Action *>&items)

SubsysResultCode_e BrowsableWifiAP :: connect_ap(SubsysCommand *cmd)
{
char password[64] = { 0 };
char password[65] = { 0 }; // string_box takes 64 characters plus the terminator
BrowsableWifiAP *bap = (BrowsableWifiAP *)cmd->functionID;
if (bap->auth) {
if(cmd->user_interface) {
Expand Down
2 changes: 2 additions & 0 deletions software/u64ctrl/main/rpc_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ void cmd_wifi_connect(command_buf_t *buf)
ev.command = CMD_WIFI_CONNECT;
ev.auth_mode = param->auth_mode;
memcpy(&ev.ssid, param->ssid, 32);
ev.ssid[32] = 0;
memcpy(&ev.pw, param->password, 64);
ev.pw[64] = 0;

if (xQueueSend(connect_commands, &ev, 1000) == pdFALSE) {
resp->esp_err = ESP_ERR_NO_MEM;
Expand Down
6 changes: 4 additions & 2 deletions software/u64ctrl/main/rpc_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ void start_dispatch(QueueHandle_t queue);
void send_button_event(uint8_t button);
void send_keepalive();

#define IDENT_STRING "ESP32 WiFi Bridge V1.19"
#define IDENT_STRING "ESP32 WiFi Bridge V1.20"
#define IDENT_MAJOR 1
// 1.20: terminates 32-character SSIDs and 64-character passwords, and reads
// them back from NVS whole.
// 1.19: a recovery also tries the my_hotspot access point after the stored ones.
// 1.18: recovers the firmware over Wi-Fi when the switch is held down for three
// seconds while off, and stores the recovery server the menu sets.
Expand All @@ -38,7 +40,7 @@ void send_keepalive();
// when this is higher than what the module reports, so a module change that
// does not bump it is silently never installed, and an older release never
// replaces a newer module.
#define IDENT_MINOR 19
#define IDENT_MINOR 20
#define MULTITHREADED 0
#define DISPATCHER_STACK 3072

Expand Down
13 changes: 7 additions & 6 deletions software/u64ctrl/main/wifi_modem.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ esp_err_t wifi_store_ap(ConnectCommand_t *cmd)
key[0] = 's';
key[1] = 'a' + i;
key[2] = '0'; // SSID sa, sb, sc, sd, ...
size_t len = 32;
char ssid_buf[32];
size_t len = 33;
char ssid_buf[33];
// see if the ssid has been stored already
err = nvs_get_str(handle, key, ssid_buf, &len);
if (err != ESP_OK) { // nope, it doesn't exist
Expand Down Expand Up @@ -650,17 +650,18 @@ esp_err_t wifi_connect_to_scanned(int index)
// now look up password
err = ESP_OK;
if (ap_info[index].authmode) {
err = wifi_find_password(ap_info[index].ssid, last_connect.pw, 64, &last_connect.list_index);
err = wifi_find_password(ap_info[index].ssid, last_connect.pw, sizeof(last_connect.pw), &last_connect.list_index);
} else {
// no authentication required. But make sure the user has configured this AP.
err = wifi_find_password(ap_info[index].ssid, last_connect.pw, 64, &last_connect.list_index);
err = wifi_find_password(ap_info[index].ssid, last_connect.pw, sizeof(last_connect.pw), &last_connect.list_index);
if ((err == ESP_OK) && (last_connect.pw[0] != 0)) {
// AP is known and configured, however, with a password. Do not allow to connect.
err = ESP_ERR_NOT_FOUND;
}
}
if (err == ESP_OK) { // known AP found
strncpy(last_connect.ssid, (const char *)(ap_info[index].ssid), 32);
last_connect.ssid[32] = 0;
last_connect.auth_mode = ap_info[index].authmode;
return attempt_connect(last_connect.ssid, last_connect.pw, last_connect.auth_mode);
}
Expand All @@ -687,11 +688,11 @@ esp_err_t wifi_connect_to_stored(int index)
key[1] = 'a' + index;
key[2] = '0'; // SSID sa, sb, sc, sd, ...

size_t len = 32;
size_t len = sizeof(last_connect.ssid);
err = nvs_get_str(handle, key, last_connect.ssid, &len);
if (err == ESP_OK) {
key[0] = 'p'; // password pa, pb, pc, pd, ...
len = 64;
len = sizeof(last_connect.pw);
err = nvs_get_str(handle, key, last_connect.pw, &len);
if (err == ESP_OK) {
key[0] = 'm'; // authmode ma, mb, mc, md, ...
Expand Down
2 changes: 1 addition & 1 deletion software/u64ctrl/main/wifi_modem.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extern QueueHandle_t connect_commands;
extern SemaphoreHandle_t connect_semaphore;

typedef struct {
char ssid[32];
char ssid[33]; // 32 SSID bytes plus the terminator
char pw[68];
uint8_t auth_mode;
uint8_t command;
Expand Down
2 changes: 2 additions & 0 deletions software/wifi/raw_c3/main/rpc_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ void cmd_wifi_connect(command_buf_t *buf)
ev.command = CMD_WIFI_CONNECT;
ev.auth_mode = param->auth_mode;
memcpy(&ev.ssid, param->ssid, 32);
ev.ssid[32] = 0;
memcpy(&ev.pw, param->password, 64);
ev.pw[64] = 0;

if (xQueueSend(connect_commands, &ev, 1000) == pdFALSE) {
resp->esp_err = ESP_ERR_NO_MEM;
Expand Down
6 changes: 4 additions & 2 deletions software/wifi/raw_c3/main/rpc_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ void start_dispatch(QueueHandle_t queue);
void send_button_event(uint8_t button);
void send_keepalive();

#define IDENT_STRING "ESP32 WiFi Bridge V1.6"
#define IDENT_STRING "ESP32 WiFi Bridge V1.7"
#define IDENT_MAJOR 1
// 1.7: terminates 32-character SSIDs and 64-character passwords, and reads
// them back from NVS whole.
// 1.6: the connector retries after a dropped link instead of idling in
// Disconnected forever. The Ultimate's updater only reflashes the module
// when this differs from what the module reports, so a module change that
// does not bump it is silently never installed.
#define IDENT_MINOR 6
#define IDENT_MINOR 7
#define MULTITHREADED 0
#define DISPATCHER_STACK 3072

Expand Down
13 changes: 7 additions & 6 deletions software/wifi/raw_c3/main/wifi_modem.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ esp_err_t wifi_store_ap(ConnectCommand_t *cmd)
key[0] = 's';
key[1] = 'a' + i;
key[2] = '0'; // SSID sa, sb, sc, sd, ...
size_t len = 32;
char ssid_buf[32];
size_t len = 33;
char ssid_buf[33];
// see if the ssid has been stored already
err = nvs_get_str(handle, key, ssid_buf, &len);
if (err != ESP_OK) { // nope, it doesn't exist
Expand Down Expand Up @@ -545,17 +545,18 @@ esp_err_t wifi_connect_to_scanned(int index)
// now look up password
err = ESP_OK;
if (ap_info[index].authmode) {
err = wifi_find_password(ap_info[index].ssid, last_connect.pw, 64, &last_connect.list_index);
err = wifi_find_password(ap_info[index].ssid, last_connect.pw, sizeof(last_connect.pw), &last_connect.list_index);
} else {
// no authentication required. But make sure the user has configured this AP.
err = wifi_find_password(ap_info[index].ssid, last_connect.pw, 64, &last_connect.list_index);
err = wifi_find_password(ap_info[index].ssid, last_connect.pw, sizeof(last_connect.pw), &last_connect.list_index);
if ((err == ESP_OK)&&(last_connect.pw[0] != 0)) {
// AP is known and configured, however, with a password. Do not allow to connect.
err = ESP_ERR_NOT_FOUND;
}
}
if (err == ESP_OK) { // known AP found
strncpy(last_connect.ssid, (const char *)(ap_info[index].ssid), 32);
last_connect.ssid[32] = 0;
last_connect.auth_mode = ap_info[index].authmode;
return attempt_connect(last_connect.ssid, last_connect.pw, last_connect.auth_mode);
}
Expand All @@ -582,11 +583,11 @@ esp_err_t wifi_connect_to_stored(int index)
key[1] = 'a' + index;
key[2] = '0'; // SSID sa, sb, sc, sd, ...

size_t len = 32;
size_t len = sizeof(last_connect.ssid);
err = nvs_get_str(handle, key, last_connect.ssid, &len);
if (err == ESP_OK) {
key[0] = 'p'; // password pa, pb, pc, pd, ...
len = 64;
len = sizeof(last_connect.pw);
err = nvs_get_str(handle, key, last_connect.pw, &len);
if (err == ESP_OK) {
key[0] = 'm'; // authmode ma, mb, mc, md, ...
Expand Down
2 changes: 1 addition & 1 deletion software/wifi/raw_c3/main/wifi_modem.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extern QueueHandle_t connect_commands;
extern SemaphoreHandle_t connect_semaphore;

typedef struct {
char ssid[32];
char ssid[33]; // 32 SSID bytes plus the terminator
char pw[68];
uint8_t auth_mode;
uint8_t command;
Expand Down
2 changes: 2 additions & 0 deletions software/wifi/raw_u64/main/rpc_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ void cmd_wifi_connect(command_buf_t *buf)
ev.command = CMD_WIFI_CONNECT;
ev.auth_mode = param->auth_mode;
memcpy(&ev.ssid, param->ssid, 32);
ev.ssid[32] = 0;
memcpy(&ev.pw, param->password, 64);
ev.pw[64] = 0;

if (xQueueSend(connect_commands, &ev, 1000) == pdFALSE) {
resp->esp_err = ESP_ERR_NO_MEM;
Expand Down
6 changes: 4 additions & 2 deletions software/wifi/raw_u64/main/rpc_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ void start_dispatch(QueueHandle_t queue);
void send_button_event(uint8_t button);
void send_keepalive();

#define IDENT_STRING "ESP32 WiFi Bridge V1.6"
#define IDENT_STRING "ESP32 WiFi Bridge V1.7"
#define IDENT_MAJOR 1
// 1.7: terminates 32-character SSIDs and 64-character passwords, and reads
// them back from NVS whole.
// 1.6: the connector retries after a dropped link instead of idling in
// Disconnected forever. The Ultimate's updater only reflashes the module
// when this differs from what the module reports, so a module change that
// does not bump it is silently never installed.
#define IDENT_MINOR 6
#define IDENT_MINOR 7
#define MULTITHREADED 0
#define DISPATCHER_STACK 3072

Expand Down
13 changes: 7 additions & 6 deletions software/wifi/raw_u64/main/wifi_modem.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ esp_err_t wifi_store_ap(ConnectCommand_t *cmd)
key[0] = 's';
key[1] = 'a' + i;
key[2] = '0'; // SSID sa, sb, sc, sd, ...
size_t len = 32;
char ssid_buf[32];
size_t len = 33;
char ssid_buf[33];
// see if the ssid has been stored already
err = nvs_get_str(handle, key, ssid_buf, &len);
if (err != ESP_OK) { // nope, it doesn't exist
Expand Down Expand Up @@ -545,17 +545,18 @@ esp_err_t wifi_connect_to_scanned(int index)
// now look up password
err = ESP_OK;
if (ap_info[index].authmode) {
err = wifi_find_password(ap_info[index].ssid, last_connect.pw, 64, &last_connect.list_index);
err = wifi_find_password(ap_info[index].ssid, last_connect.pw, sizeof(last_connect.pw), &last_connect.list_index);
} else {
// no authentication required. But make sure the user has configured this AP.
err = wifi_find_password(ap_info[index].ssid, last_connect.pw, 64, &last_connect.list_index);
err = wifi_find_password(ap_info[index].ssid, last_connect.pw, sizeof(last_connect.pw), &last_connect.list_index);
if ((err == ESP_OK)&&(last_connect.pw[0] != 0)) {
// AP is known and configured, however, with a password. Do not allow to connect.
err = ESP_ERR_NOT_FOUND;
}
}
if (err == ESP_OK) { // known AP found
strncpy(last_connect.ssid, (const char *)(ap_info[index].ssid), 32);
last_connect.ssid[32] = 0;
last_connect.auth_mode = ap_info[index].authmode;
return attempt_connect(last_connect.ssid, last_connect.pw, last_connect.auth_mode);
}
Expand All @@ -582,11 +583,11 @@ esp_err_t wifi_connect_to_stored(int index)
key[1] = 'a' + index;
key[2] = '0'; // SSID sa, sb, sc, sd, ...

size_t len = 32;
size_t len = sizeof(last_connect.ssid);
err = nvs_get_str(handle, key, last_connect.ssid, &len);
if (err == ESP_OK) {
key[0] = 'p'; // password pa, pb, pc, pd, ...
len = 64;
len = sizeof(last_connect.pw);
err = nvs_get_str(handle, key, last_connect.pw, &len);
if (err == ESP_OK) {
key[0] = 'm'; // authmode ma, mb, mc, md, ...
Expand Down
2 changes: 1 addition & 1 deletion software/wifi/raw_u64/main/wifi_modem.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extern QueueHandle_t connect_commands;
extern SemaphoreHandle_t connect_semaphore;

typedef struct {
char ssid[32];
char ssid[33]; // 32 SSID bytes plus the terminator
char pw[68];
uint8_t auth_mode;
uint8_t command;
Expand Down