Bring back 'set ap_mac' command.

This commit is contained in:
Michael Smith 2018-03-14 22:09:23 +01:00
parent 61044fe751
commit 689ac7abbb
4 changed files with 24 additions and 7 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
#ifndef _USER_CONFIG_
#define _USER_CONFIG_
#define ESPERPASS_VERSION "V0.0.4"
#define ESPERPASS_VERSION "V0.0.5"
#define WIFI_SSID "ssid"
#define WIFI_PASSWORD "password"

View File

@ -501,17 +501,19 @@ console_handle_command(struct espconn *pespconn)
IP2STR(&config.my_gw));
to_console(response);
uint8_t current_mac[6];
wifi_get_macaddr(SOFTAP_IF, current_mac);
os_sprintf(response,
"STA MAC: %02x:%02x:%02x:%02x:%02x:%02x\r\nAP MAC: %02x:%02x:%02x:%02x:%02x:%02x\r\n",
config.STA_MAC_address[0], config.STA_MAC_address[1],
config.STA_MAC_address[2], config.STA_MAC_address[3],
config.STA_MAC_address[4], config.STA_MAC_address[5],
config.mac_list[config.current_mac_address][0],
config.mac_list[config.current_mac_address][1],
config.mac_list[config.current_mac_address][2],
config.mac_list[config.current_mac_address][3],
config.mac_list[config.current_mac_address][4],
config.mac_list[config.current_mac_address][5]);
current_mac[0],
current_mac[1],
current_mac[2],
current_mac[3],
current_mac[4],
current_mac[5]);
to_console(response);
os_sprintf(response, "STA hostname: %s\r\n", config.sta_hostname);
to_console(response);
@ -1072,6 +1074,21 @@ console_handle_command(struct espconn *pespconn)
goto command_handled;
}
if (strcmp(tokens[1], "ap_mac") == 0)
{
uint8_t new_ap_mac[6];
if (!parse_mac(new_ap_mac, tokens[2]))
{
os_sprintf(response, INVALID_ARG);
}
else
{
wifi_set_macaddr(SOFTAP_IF, new_ap_mac);
os_sprintf(response, "AP MAC set\r\n");
}
goto command_handled;
}
if (strcmp(tokens[1],"sta_mac") == 0)
{
if (!parse_mac(config.STA_MAC_address, tokens[2]))