Skip to content

Commit

Permalink
v3.0.1
Browse files Browse the repository at this point in the history
+ Fix COM port detection on Linux
  • Loading branch information
JovannMC committed Aug 20, 2024
1 parent 5793ed4 commit 2565915
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
12 changes: 9 additions & 3 deletions src/mode/com.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -124,15 +130,15 @@ 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) {
if ((btDevice.name.startsWith("HaritoraX-") || btDevice.name.startsWith("Haritora-")) && btDevice.comPort) {
foundPorts.push(btDevice.comPort);
}
}

return foundPorts;
}

Expand Down

0 comments on commit 2565915

Please sign in to comment.