mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-01-03 10:48:47 +03:00
[FL-3940] Work around incorrect serial port handling by the OS (#4040)
* fix: js sdk flipper detection * chore: bump ver Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
6d20bc7e50
commit
631d7a40dd
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@flipperdevices/fz-sdk",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"description": "Type declarations and documentation for native JS modules available on Flipper Zero",
|
||||
"keywords": [
|
||||
"flipper",
|
||||
|
@ -8,13 +8,6 @@ importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
prompts:
|
||||
specifier: ^2.4.2
|
||||
version: 2.4.2
|
||||
serialport:
|
||||
specifier: ^12.0.0
|
||||
version: 12.0.0
|
||||
devDependencies:
|
||||
esbuild:
|
||||
specifier: ^0.24.0
|
||||
version: 0.24.0
|
||||
@ -24,6 +17,12 @@ importers:
|
||||
json5:
|
||||
specifier: ^2.2.3
|
||||
version: 2.2.3
|
||||
prompts:
|
||||
specifier: ^2.4.2
|
||||
version: 2.4.2
|
||||
serialport:
|
||||
specifier: ^12.0.0
|
||||
version: 12.0.0
|
||||
typedoc:
|
||||
specifier: ^0.26.10
|
||||
version: 0.26.10(typescript@5.6.3)
|
||||
|
@ -85,9 +85,21 @@ async function build(config) {
|
||||
|
||||
async function upload(config) {
|
||||
const appFile = fs.readFileSync(config.input, "utf8");
|
||||
const flippers = (await SerialPort.list()).filter(x => x.serialNumber?.startsWith("flip_"));
|
||||
const serialPorts = await SerialPort.list();
|
||||
|
||||
if (!flippers) {
|
||||
let flippers = serialPorts
|
||||
.filter(x => x.serialNumber?.startsWith("flip_"))
|
||||
.map(x => ({ path: x.path, name: x.serialNumber.replace("flip_", "") }));
|
||||
|
||||
if (!flippers.length) {
|
||||
// some Windows installations don't report the serial number correctly;
|
||||
// filter by STM VCP VID:PID instead
|
||||
flippers = serialPorts
|
||||
.filter(x => x?.vendorId === "0483" && x?.productId === "5740")
|
||||
.map(x => ({ path: x.path, name: x.path }));
|
||||
}
|
||||
|
||||
if (!flippers.length) {
|
||||
console.error("No Flippers found");
|
||||
process.exit(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user