diff --git a/README.md b/README.md index 6a02406..4e02cb8 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Maybe you have a SoftAP-based IoT toy, and you just need to make a thin download // Try scanning for access points: WiFiControl.scanForWiFi( function(err, response) { - if (err) console.log(error); + if (err) console.log(err); console.log(response); }); ``` diff --git a/lib/wifi-control.js b/lib/wifi-control.js index 4bb41b4..52b95a6 100644 --- a/lib/wifi-control.js +++ b/lib/wifi-control.js @@ -242,11 +242,11 @@ if (process.platform === "linux") { scanResults = execSync("nmcli -m multiline device wifi list"); networks = []; - ref = scanResults.split('*:'); + ref = scanResults.split('\nSSID:'); for (c = j = 0, len = ref.length; j < len; c = ++j) { nwk = ref[c]; - if (c === 0) { - continue; + if (c != 0) { + nwk = "SSID:" + ref[c]; } _network = {}; ref1 = nwk.split('\n');