Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions bin/tessel-wifi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down