diff --git a/bin/tessel-wifi.js b/bin/tessel-wifi.js index 7e5dcfd..d6ea5ee 100755 --- a/bin/tessel-wifi.js +++ b/bin/tessel-wifi.js @@ -38,7 +38,6 @@ var argv = require("nomnom") }) .option('security', { abbr: 's', - default: 'wpa2', help: '[Tessel] Security type of the network, one of (wpa2|wpa|wep). Omit for unsecured networks.' }) .option('timeout', { @@ -112,7 +111,16 @@ common.controller({stop: false}, function (err, client) { pass = new Buffer(String(pass)); } - var security = new Buffer((String(argv.security) || (pass ? 'wpa2' : 'unsecure')).toLowerCase()); + var security; + if (argv.security) { + security = new Buffer(String(argv.security).toLowerCase()); + } + else if (pass.length) { + security = new Buffer(String('wpa2')); + } + else { + security = new Buffer(0); + } client.configureWifi(ssid, pass, security, { timeout: argv.timeout diff --git a/src/commands.js b/src/commands.js index 0938f9a..5cb676c 100644 --- a/src/commands.js +++ b/src/commands.js @@ -277,7 +277,7 @@ prototype.configureWifi = function (ssid, pass, security, opts, next) { self.checkWifi(true); function start () { - logs.info('Connecting to "%s" with %s security...', ssid, security); + logs.info('Connecting to "%s" with %s security...', ssid, security.length ? security : "no"); (function timeoutloop () { var checkInterval = null; var acquiring = false;