@em-foundation/emscope 25.4.0 → 25.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/emscope +43 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/emscope
CHANGED
|
@@ -13158,18 +13158,57 @@ async function powerOn(voltage) {
|
|
|
13158
13158
|
progress.done();
|
|
13159
13159
|
}
|
|
13160
13160
|
async function findDevices() {
|
|
13161
|
-
let
|
|
13161
|
+
let candidates = new Array();
|
|
13162
13162
|
for (const port of await import_serialport.SerialPort.list()) {
|
|
13163
13163
|
const vid = port.vendorId;
|
|
13164
13164
|
const pid = port.productId;
|
|
13165
13165
|
if (vid == "1915" && pid.toLowerCase() == "c00a") {
|
|
13166
|
-
|
|
13166
|
+
candidates.push(port.path);
|
|
13167
|
+
}
|
|
13168
|
+
}
|
|
13169
|
+
fail("no PPK2 analyzer found", candidates.length == 0);
|
|
13170
|
+
if (candidates.length == 1) return candidates;
|
|
13171
|
+
const res = new Array();
|
|
13172
|
+
for (const path of candidates) {
|
|
13173
|
+
if (await probeDataPort(path)) {
|
|
13174
|
+
res.push(path);
|
|
13167
13175
|
}
|
|
13168
13176
|
}
|
|
13169
|
-
fail("no PPK2
|
|
13170
|
-
res.sort();
|
|
13177
|
+
fail("no PPK2 data port found (tried probing all candidates)", res.length == 0);
|
|
13171
13178
|
return res;
|
|
13172
13179
|
}
|
|
13180
|
+
async function probeDataPort(path, timeoutMs = 500) {
|
|
13181
|
+
let port;
|
|
13182
|
+
try {
|
|
13183
|
+
port = new import_serialport.SerialPort({ path, baudRate: 9600, autoOpen: false });
|
|
13184
|
+
await new Promise((resolve, reject) => {
|
|
13185
|
+
port.open((err) => err ? reject(err) : resolve());
|
|
13186
|
+
});
|
|
13187
|
+
return await new Promise((resolve) => {
|
|
13188
|
+
let responded = false;
|
|
13189
|
+
const onData = () => {
|
|
13190
|
+
if (!responded) {
|
|
13191
|
+
responded = true;
|
|
13192
|
+
resolve(true);
|
|
13193
|
+
}
|
|
13194
|
+
};
|
|
13195
|
+
port.on("data", onData);
|
|
13196
|
+
port.write([25 /* GET_META_DATA */]);
|
|
13197
|
+
setTimeout(() => {
|
|
13198
|
+
if (!responded) {
|
|
13199
|
+
responded = true;
|
|
13200
|
+
resolve(false);
|
|
13201
|
+
}
|
|
13202
|
+
}, timeoutMs);
|
|
13203
|
+
});
|
|
13204
|
+
} catch {
|
|
13205
|
+
return false;
|
|
13206
|
+
} finally {
|
|
13207
|
+
if (port?.isOpen) {
|
|
13208
|
+
await new Promise((resolve) => port.close(() => resolve()));
|
|
13209
|
+
}
|
|
13210
|
+
}
|
|
13211
|
+
}
|
|
13173
13212
|
function parseMods(mods) {
|
|
13174
13213
|
mods = mods.replace("END", "").trim().toLowerCase().replace(/-nan/g, "null").replace(/\n/g, ',\n"').replace(/: /g, '": ');
|
|
13175
13214
|
let res;
|
|
@@ -13687,4 +13726,3 @@ try {
|
|
|
13687
13726
|
js-yaml/dist/js-yaml.mjs:
|
|
13688
13727
|
(*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
|
|
13689
13728
|
*/
|
|
13690
|
-
//# sourceMappingURL=emscope.map
|