From 25659152ea0d316b9d8afc2ca6a2243288e9ff64 Mon Sep 17 00:00:00 2001 From: JovannMC Date: Tue, 20 Aug 2024 12:05:59 +0300 Subject: [PATCH] v3.0.1 + Fix COM port detection on Linux --- package.json | 2 +- src/mode/com.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 0b11fc8..7669366 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "haritorax-interpreter", - "version": "3.0.0", + "version": "3.0.1", "homepage": "https://github.com/JovannMC/haritorax-interpreter", "repository": "https://github.com/JovannMC/haritorax-interpreter", "bugs": { diff --git a/src/mode/com.ts b/src/mode/com.ts index 4a14cdb..0358108 100644 --- a/src/mode/com.ts +++ b/src/mode/com.ts @@ -113,7 +113,13 @@ export default class COM extends EventEmitter { const availablePorts = ports .map((port) => { const deviceMatch = devices.find( - (deviceItem) => port.vendorId === deviceItem.vid && port.productId === deviceItem.pid + (deviceItem) => + deviceItem.vid && + deviceItem.pid && + port.vendorId && + port.productId && + port.vendorId.toLowerCase() === deviceItem.vid.toLowerCase() && + port.productId.toLowerCase() === deviceItem.pid.toLowerCase() ); return { ...port, @@ -124,7 +130,7 @@ export default class COM extends EventEmitter { let foundPorts = []; for (const port_2 of availablePorts) { - if (port_2.deviceName === device) foundPorts.push(port_2.path); + if (port_2.deviceName?.toLowerCase() === device.toLowerCase()) foundPorts.push(port_2.path); } for (const btDevice of bluetoothDevices) { @@ -132,7 +138,7 @@ export default class COM extends EventEmitter { foundPorts.push(btDevice.comPort); } } - + return foundPorts; }