mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-19 14:14:00 +00:00
wioterminal: fix check for bad Wifi connect
rpc_wifi_connect() will return 0 on successful connection, so check for that. Also, check that if passphrase is given, that it's the minimum 8 chars per WPA Wifi.
This commit is contained in:
@@ -102,6 +102,10 @@ func (r *rtl8720dn) connectToAP() error {
|
||||
return netlink.ErrMissingSSID
|
||||
}
|
||||
|
||||
if len(r.params.Passphrase) != 0 && len(r.params.Passphrase) < 8 {
|
||||
return netlink.ErrShortPassphrase
|
||||
}
|
||||
|
||||
if debugging(debugBasic) {
|
||||
fmt.Printf("Connecting to Wifi SSID '%s'...", r.params.Ssid)
|
||||
}
|
||||
@@ -109,7 +113,7 @@ func (r *rtl8720dn) connectToAP() error {
|
||||
// Start the connection process
|
||||
securityType := uint32(0x00400004)
|
||||
result := r.rpc_wifi_connect(r.params.Ssid, r.params.Passphrase, securityType, -1, 0)
|
||||
if result == -1 {
|
||||
if result != 0 {
|
||||
if debugging(debugBasic) {
|
||||
fmt.Printf("FAILED\r\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user