Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #168 #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions bin/tessel-wifi.js
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
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