Skip to content

Commit c538706

Browse files
committed
Remove using serial monitor
1 parent 25c8d54 commit c538706

File tree

3 files changed

+12
-41
lines changed

3 files changed

+12
-41
lines changed

src/cmd/esim.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ const GET_AT_COMMAND_STATUS = 4;
2121

2222

2323
module.exports = class eSimCommands extends CLICommandBase {
24-
constructor() { // TODO: Bring ui class
25-
super();
26-
spinnerMixin(this);
24+
constructor() { // TODO: Bring ui class
25+
super();
26+
spinnerMixin(this);
2727
this.serial = new SerialCommand();
2828
this.lpa = null;
2929
this.inputJson = null;
3030
this.inputJsonData = null;
3131
this.outputJson = null;
3232
this.downloadedProfiles = [];
3333
this.verbose = false;
34-
}
34+
}
3535

36-
async provisionCommand(args) {
36+
async provisionCommand(args) {
3737
this.verbose = true;
3838
this._validateArgs(args);
3939

@@ -46,7 +46,7 @@ module.exports = class eSimCommands extends CLICommandBase {
4646
throw new Error(errorMessage);
4747
}
4848
await this.doProvision(devices[0], { verbose: true });
49-
}
49+
}
5050

5151
async bulkProvisionCommand(args) {
5252
this._validateArgs(args);
@@ -72,9 +72,7 @@ module.exports = class eSimCommands extends CLICommandBase {
7272
const platform = platformForId(device.specs.productId).name;
7373
const port = device.port;
7474

75-
if (verbose) {
76-
console.log(`${os.EOL}Provisioning device ${device.deviceId} with platform ${platform}`);
77-
}
75+
provisionOutputLogs.push(`${os.EOL}Provisioning device ${device.deviceId} with platform ${platform}`);
7876

7977
// Flash firmware and retrieve EID
8078
const flashResp = await this._flashATPassThroughFirmware(device, platform, port);
@@ -106,7 +104,6 @@ module.exports = class eSimCommands extends CLICommandBase {
106104
}
107105
const eid = eidResp.eid;
108106
provisionOutputLogs.push(`EID: ${eid}`);
109-
console.log('EID : ', eid);
110107

111108
const matchingEsim = this.inputJsonData.provisioning_data.find(item => item.esim_id === eid);
112109
const iccidFromJson = matchingEsim.profiles.map((profile) => profile.iccid);
@@ -348,7 +345,7 @@ module.exports = class eSimCommands extends CLICommandBase {
348345
}
349346
} catch (error) {
350347
// Ignore
351-
console.log('[dbg] error: ', error);
348+
logAndPush(`Error during AT-OK check: ${error.message}`);
352349
}
353350

354351
if (!atOkReceived) {
@@ -497,8 +494,8 @@ module.exports = class eSimCommands extends CLICommandBase {
497494
console.log('[dbg] result: ', result);
498495
const timeTaken = ((Date.now() - startTime) / 1000).toFixed(2);
499496

500-
logAndPush(result.stdout);
501497
if (result.stdout.includes('Profile successfully downloaded')) {
498+
// logAndPush(result.stdout);
502499
logAndPush(`\n\tProfile ${provider} successfully downloaded in ${timeTaken} sec`);
503500
downloadedProfiles.push({
504501
status: "success",
@@ -508,6 +505,7 @@ module.exports = class eSimCommands extends CLICommandBase {
508505
});
509506
} else {
510507
logAndPush(`\n\tProfile download failed for ${provider}`);
508+
logAndPush(result.stdout);
511509
overallSuccess = false;
512510
downloadedProfiles.push({
513511
status: "failed",

src/cmd/serial.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,7 @@ module.exports = class SerialCommand extends CLICommandBase {
249249
this.ui.stdout.write('Polling for available serial device...');
250250
}
251251

252-
return this.whatSerialPortDidYouMean(port, true).then(handlePortFn).then(() => ({
253-
stop: async () => {
254-
if (serialPort && serialPort.isOpen) {
255-
await serialPort.close();
256-
}
257-
}
258-
}));
252+
return this.whatSerialPortDidYouMean(port, true).then(handlePortFn);
259253
}
260254

261255
/**

src/cmd/usb-util.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -558,26 +558,6 @@ async function handleUsbError(err){
558558
throw err;
559559
}
560560

561-
async function getUsbSystemPathsForMac() {
562-
const platform = os.platform();
563-
if (platform !== 'darwin') {
564-
throw new Error('getUsbSystemPathsForMac() is only supported on macOS');
565-
}
566-
567-
const { stdout } = await execa('ls', ['/dev']);
568-
569-
let paths = [];
570-
stdout.split('\n').forEach((path) => {
571-
paths.push(path);
572-
});
573-
574-
//filter out tty.usbmodem*
575-
const modemPaths = paths.filter((path) => path.includes('tty.usbmodem'));
576-
const updatedModemPaths = modemPaths.map((path) => '/dev/' + path);
577-
578-
return updatedModemPaths;
579-
}
580-
581561
module.exports = {
582562
openUsbDevice,
583563
openUsbDeviceById,
@@ -593,6 +573,5 @@ module.exports = {
593573
forEachUsbDevice,
594574
openUsbDevices,
595575
executeWithUsbDevice,
596-
waitForDeviceToRespond,
597-
getUsbSystemPathsForMac
576+
waitForDeviceToRespond
598577
};

0 commit comments

Comments
 (0)