If I specify an incorrect password when connecting to a WiFi network is there anyway to detect that the reason I can't connect is the incorrect password (rather than one of the many other possible reasons that one might not be able to connect).
E.g. here I add a network but deliberately specify the wrong password. If I check the status I just see that it's SCANNING
# wpa_cli add_network
Selected interface 'wlan0'
1
# wpa_cli set_network 1 ssid \"MyPlace\"
Selected interface 'wlan0'
OK
# wpa_cli set_network 1 psk \"SuperSecret\"
Selected interface 'wlan0'
OK
# wpa_cli select_network 1
Selected interface 'wlan0'
OK
# wpa_cli status
Selected interface 'wlan0'
wpa_state=SCANNING
p2p_device_address=fe:c2:de:37:93:11
address=fc:c2:de:37:93:11
If I write a script to run wpa_cli status
repeatedly after selecting the network I can see it goes through the phases:
SCANNING
ASSOCIATING
4WAY_HANDSHAKE
DISCONNECTED
SCANNING
So is there some way to discover that the association/handshake phase failed due to an incorrect password? E.g. does the disconnect event report some reason that's stored and which I can then query?