Skip to content

Commit

Permalink
Merge pull request #471 from markterrill/master
Browse files Browse the repository at this point in the history
  • Loading branch information
monkbroc committed Feb 8, 2019
2 parents 1aaa304 + ae13e65 commit 70b326b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/cli/serial.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ export default ({ commandProcessor, root }) => {

commandProcessor.createCommand(serial, 'flash', 'Flash firmware over serial using YMODEM protocol', {
params: '<binary>',
options: portOption,
options: Object.assign({
'yes': {
boolean: true,
description: 'Answer yes to all questions'
},
}, portOption),
handler: (args) => {
const SerialCommands = require('../cmd/serial');
return new SerialCommands().flashDevice(args.params.binary, args);
Expand Down
7 changes: 4 additions & 3 deletions src/cmd/flash.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FlashCommand {
if (usb) {
result = this.flashDfu({ binary, factory, force });
} else if (serial) {
result = this.flashYModem({ binary, port });
result = this.flashYModem({ binary, port, yes });
} else {
result = this.flashCloud({ device, files, target, yes });
}
Expand All @@ -40,11 +40,12 @@ class FlashCommand {
return new CloudCommands().flashDevice(device, files, { target, yes });
}

flashYModem({ binary, port }) {
flashYModem({ binary, port, yes }) {
const SerialCommands = require('../cmd/serial');
return new SerialCommands().flashDevice(binary, { port });
return new SerialCommands().flashDevice(binary, { port, yes });
}


flashDfu({ binary, factory, force }) {
let specs, destSegment, destAddress;
let flashingKnownApp = false;
Expand Down
9 changes: 7 additions & 2 deletions src/cmd/serial.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,14 @@ class SerialCommand {
]);
}

flashDevice(binary, { port }) {
flashDevice(binary, { port, yes }) {
let device;
return this._promptForListeningMode().then(() => {

return Promise.resolve().then(() => {
if (!yes) {
return this._promptForListeningMode();
}
}).then(() => {
return this.whatSerialPortDidYouMean(port, true);
}).then(_device => {
device = _device;
Expand Down

0 comments on commit 70b326b

Please sign in to comment.