First of all my target system is android.
I created a c++ application to communicate with wpa_supplicant through the control interface provided as a wpa_ctrl.c file (I included the header file wpa_ctrl.h and linked with the library libwpa_client.so)
here is the documentation page.
Every thing was working fine, but suddenly every command I send is replied by UNKNOWN COMMAND, I suppose that the commands that work fine (ping, list_networks, status, and terminate) have a common thing (maybe they do not need to open the wpa_supplicant.conf which causes the problem on other commands)
here is how I open the connection:
this->ctrl = wpa_ctrl_open(this->socket.c_str());
here is how I send commands:
s = wpa_ctrl_request(this->ctrl, cmd.c_str(), cmd.length(), this->_reply, &reply_len, msg_cb);
above method signatures:
struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path);
int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
char *reply, size_t *reply_len,
void (*msg_cb)(char *msg, size_t len));
example output:
PING
PONG
UNKNOWN COMMAND: MIB
UNKNOWN COMMAND: STATUS-VERBOSE
UNKNOWN COMMAND: PMKSA
UNKNOWN COMMAND: LOGON
UNKNOWN COMMAND: LOGOFF
UNKNOWN COMMAND: REASSOCIATE
UNKNOWN COMMAND: RECONNECT
UNKNOWN COMMAND: RECONFIGURE
LIST_NETWORKS
network id / ssid / bssid / flags
UNKNOWN COMMAND: DISCONNECT
UNKNOWN COMMAND: SCAN
UNKNOWN COMMAND: SCAN_RESULTS
UNKNOWN COMMAND: BSS
UNKNOWN COMMAND: ADD_NETWORK
STATUS
p2p_device_address=12:d3:8a:c8:34:ef
p2p_state=IDLE
wifi_display=1
ifname=p2p0
address=12:d3:8a:c8:34:ef
ifname=wlan0
address=10:d3:8a:c8:34:ef
UNKNOWN COMMAND: ADD_NETWORK
closed connection with wpa_supplicant.
Can not create Network
Here is a screenshot of an older version of the program working almost fine:
any help is appreciated.
EDIT: I tested the program on my other device and it worked well. But still broken on my main device, probably a factory reset will solve it. But I still want to know the cause of the problem.