1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-13 05:06:30 +04: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:
Anna Antonenko
2024-12-23 05:34:05 +04:00
committed by GitHub
parent 6d20bc7e50
commit 631d7a40dd
3 changed files with 21 additions and 10 deletions

View File

@@ -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);
}