Skip to content

Commit

Permalink
Add system firmware version to identify command
Browse files Browse the repository at this point in the history
Fixes #95
  • Loading branch information
brycekahle committed Jan 13, 2016
1 parent f67719e commit 6737e5e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions commands/SerialCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ SerialCommand.prototype = extend(BaseCommand.prototype, {

console.log();
console.log('Your device id is', chalk.bold.cyan(data));

return self.askForSystemFirmwareVersion(device, 2000)
.then(function(version) {
console.log('Your system firmware version is', chalk.bold.cyan(version));
})
.catch(function(err) {
console.log('Unable to determine system firmware version');
return when.resolve();
});
})
.catch(function (err) {
self.error(err, false);
Expand Down Expand Up @@ -752,6 +761,19 @@ SerialCommand.prototype = extend(BaseCommand.prototype, {
});
},

askForSystemFirmwareVersion: function(device, timeout) {
if (!device) {
return when.reject('askForSystemFirmwareVersion - no serial port provided');
}

return this._issueSerialCommand(device, 'v', timeout).then(function (data) {
var matches = data.match(/system firmware version:\s+([\w.]+)/);
if (matches && matches.length === 2) {
return matches[1];
}
});
},

_parsePort: function(devices, comPort) {
if (!comPort) {
//they didn't give us anything.
Expand Down

0 comments on commit 6737e5e

Please sign in to comment.