Socket
Socket
Sign inDemoInstall

thsq-device-flasher

Package Overview
Dependencies
72
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.9 to 1.0.10

2

package.json
{
"name": "thsq-device-flasher",
"version": "1.0.9",
"version": "1.0.10",
"author": "Thingsquare <support@thingsquare.com>",

@@ -5,0 +5,0 @@ "description": "Thingsquare device flash utility",

@@ -345,2 +345,3 @@ #!/usr/bin/env node

console.info('options, optional: -f <frontend> -b <backend> -s <autoshare users, comma separated> -p <platform> -P <picture> -n <device name prefix> -t <flasher tool: srfprog or uniflash> -T <uniflash DSLite path>');
console.info('options, optional: -d <write device conf to nvstorage flasher entry>');
console.info('options, flags: -v (verbose command output), -e (add eui to device name)')

@@ -446,3 +447,2 @@ console.info('example: node thsq-device-flasher.js -f b72af87d-42d7-4f09-bf8c-b9f721a3e6ef -b developer.thingsquare.com -u 1d2ab1d2ab -s example@example.com,example2@example.com app.bin');

var COMMAND_TEST;
var COMMAND_SCAN;
var COMMAND_ERASE;

@@ -453,4 +453,3 @@ var COMMAND_READMAC;

if (flashtool === 'srfprog') {
COMMAND_SCAN = 'srfprog -t lsidx(0) -ls auto';
COMMAND_ERASE = 'srfprog -t lsidx(0) -e forced --reset normal; srfprog -t lsidx(0) -e forced --reset normal';
COMMAND_ERASE = 'srfprog -t lsidx(0) -e forced --reset normal || srfprog -t lsidx(0) -e forced --reset normal';
COMMAND_READMAC = 'srfprog -t lsidx(0) -r macpri';

@@ -461,3 +460,2 @@ COMMAND_PROGRAM = 'srfprog -t lsidx(0) --program -a 0x000000 --verify --file %FILENAME% --reset normal';

COMMAND_TEST = UNIFLASH_PATH + ' help';
COMMAND_SCAN;
COMMAND_ERASE = UNIFLASH_PATH + ' cc13xx-cc26xx-mass-erase -d XDS110';

@@ -631,2 +629,13 @@ COMMAND_READMAC = UNIFLASH_PATH + ' flash --config="' + get_ccs_ccxml(getFilesizeInBytes(binfile)) + '" -a ReadPriIeee';

if (options.d) {
/* user-provided device configuration via -d option
* available at device via d.flasher persistent d-variable or nvstorage */
key = 'flasher';
val = options.d;
hex += append(key, val);
if (options.v) {
console.log('\nWriting nvstorage flasher entry: ', options.d);
}
}
/* nvstorage version and null terminator */

@@ -738,20 +747,2 @@ key = '*v'; /* *v */

/*---------------------------------------------------------------------------*/
function scan() {
try {
var results = systemSync(COMMAND_SCAN);
var arr = results.split('Chip: ');
if (arr[1]) {
var chip = arr[1].split('\n')[0];
if (chip === 'Unknown') {
warn('Enumeration error, please disconnect and reconnect USB cable\n');
return;
}
progress('Found connected device, chip ' + chip);
return chip.trim();
}
} catch (err) {
warn('Enumeration error, please disconnect and reconnect USB cable\n');
}
}
/*---------------------------------------------------------------------------*/
function flashtooltest() {

@@ -852,3 +843,3 @@ try {

/*---------------------------------------------------------------------------*/
function flashconnecteddevice(device, skiperase) {
function flashconnecteddevice(device, skiperase, eui) {
if (skiperase !== true) {

@@ -866,12 +857,14 @@ process.stdout.write('\t\tErasing... ');

process.stdout.write('\t\tReading EUI... ');
var eui = readmac();
if (eui) {
process.stdout.write('\r\t\tReading EUI... ' + eui.toString('hex') + '\n');
} else {
process.stdout.write('\r\t\tReading EUI... error\n');
erroroutput('Read EUI failed');
return;
if(!eui) {
process.stdout.write('\t\tReading EUI... ');
eui = readmac();
if (eui) {
process.stdout.write('\r\t\tReading EUI... ' + eui.toString('hex') + '\n');
} else {
process.stdout.write('\r\t\tReading EUI... error\n');
erroroutput('Read EUI failed');
return;
}
eui = eui.toString('hex');
}
eui = eui.toString('hex');

@@ -1159,3 +1152,2 @@ process.stdout.write('\t\tPatching binfile... ');

process.stdout.write('\r\t\tErasing... done\n');
scan();
var eui = readmac();

@@ -1246,3 +1238,3 @@

} else {
var ok = flashconnecteddevice(matchingdevice, true);
var ok = flashconnecteddevice(matchingdevice, true, eui);
if (ok) {

@@ -1388,4 +1380,17 @@ output('Device ' + devicename(matchingdevice) + ' was reflashed: device id ' + matchingdevice.id);

if (!matching || matching.length === 0) {
erroroutput("Could not match device");
process.exit(3);
erroroutput("Could not match device, creating new unbonded");
createnewdevice(undefined, function(device, auth) {
var ok = flashconnecteddevice(device);
if (ok) {
claim(auth, function() {
/* New device created, flashed, and claimed */
output('Device was created, flashed, and claimed: auth code ' + auth + ', device id ' + device.id);
process.exit(0);
});
} else {
erroroutput('Device flashing failed, please retry');
process.exit(1);
}
});
return;
}

@@ -1402,3 +1407,3 @@

}
var ok = flashconnecteddevice(matchingdevice, true);
var ok = flashconnecteddevice(matchingdevice, true, eui);
if (ok) {

@@ -1405,0 +1410,0 @@ output('Device ' + devicename(matchingdevice) + ' was reflashed: device id ' + matchingdevice.id);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc