Skip to content

Commit fde02e9

Browse files
committed
Add binary option
1 parent 1635395 commit fde02e9

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

ESIM_PROVISION.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@
1414
Put your files in this structure (for example)
1515

1616
```
17-
17+
/kigen-resources
18+
├── /binaries
19+
│ ├── esim-firmware-b5som.bin
20+
│ ├── esim-firmware-msom.bin
21+
├── input.json
22+
├── output.json
23+
├── lpa
1824
```
1925

2026
### Device Setup
@@ -29,3 +35,4 @@ particle.js esim provision --input /path/to/input.json --output /path/to/output.
2935
First, the device(s) are flashed. Once the download process starts on a given device, device will turn its LED into yellow. If the download passes, LED turns green. If the download failed, LED turns red.
3036

3137
### Notes and Warnings
38+
1.

src/cli/esim.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ module.exports = ({ commandProcessor, root }) => {
1313
},
1414
'output': {
1515
description: 'Provide the output json file path'
16+
},
17+
'binary': {
18+
description: 'Provide the path to the binaries'
1619
},
1720
'bulk': {
1821
description: 'Provision multiple devices'

src/cmd/esim.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const path = require('path');
1212
const _ = require('lodash');
1313

1414
// TODO: Get these from exports
15-
const PATH_TO_PASS_THROUGH_BINARIES = '/Users/keerthyamisagadda/code/kigen-resources/binaries';
1615
const PROVISIONING_PROGRESS = 1;
1716
const PROVISIONING_SUCCESS = 2;
1817
const PROVISIONING_FAILURE = 3;
@@ -30,6 +29,7 @@ module.exports = class eSimCommands extends CLICommandBase {
3029
this.inputJsonData = null;
3130
this.outputJson = null;
3231
this.downloadedProfiles = [];
32+
this.binaries = null;
3333
this.verbose = false;
3434
}
3535

@@ -277,12 +277,16 @@ module.exports = class eSimCommands extends CLICommandBase {
277277
if (!args.lpa) {
278278
throw new Error('Missing input LPA tool path');
279279
}
280+
if (!args.binary) {
281+
throw new Error('Missing folder path to binaries');
282+
}
280283
this.inputJson = args.input;
281284
const input = fs.readFileSync(this.inputJson);
282285
this.inputJsonData = JSON.parse(input);
283286

284287
this.outputJson = args.output;
285288
this.lpa = args.lpa;
289+
this.binaries = args.binary;
286290
}
287291

288292
async _flashATPassThroughFirmware(device, platform) {
@@ -300,15 +304,15 @@ module.exports = class eSimCommands extends CLICommandBase {
300304
try {
301305
// Locate the firmware binary
302306
logAndPush(`${os.EOL}Locating firmware for platform: ${platform}`);
303-
const fwBinaries = fs.readdirSync(PATH_TO_PASS_THROUGH_BINARIES);
307+
const fwBinaries = fs.readdirSync(this.binaries);
304308
const validBin = fwBinaries.find((file) => file.endsWith(`${platform}.bin`));
305309

306310
if (!validBin) {
307311
logAndPush(`No firmware binary found for platform: ${platform}`);
308312
return { success: false, output: outputLogs };
309313
}
310314

311-
const fwPath = path.join(PATH_TO_PASS_THROUGH_BINARIES, validBin);
315+
const fwPath = path.join(this.binaries, validBin);
312316
logAndPush(`${os.EOL}Found firmware: ${fwPath}`);
313317

314318
// Flash the binary

0 commit comments

Comments
 (0)