Skip to content

Commit 3c62a5a

Browse files
dbg
1 parent 967083d commit 3c62a5a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

kernel/src/services/DeviceService.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ export class DeviceService {
1515
this.port = port;
1616

1717
// Check if the port is open by another application (or ourselves in another tab)
18-
if (this.port.readable && this.port.writable) {
19-
console.log('Port is already open, skipping request');
18+
19+
// Perform a quick open and close of port to check if it's already open
20+
if (this.port.readable || this.port.writable) {
21+
console.log('[requestPort]: Port is already open, skipping request');
2022
return;
2123
}
2224
else {
23-
console.log('Port is not open, requesting transport for port');
25+
console.log('[requestPort]: Port is not open, requesting port');
2426
}
25-
2627
this.transport = new Transport(port);
2728

28-
2929
} catch (err) {
30-
console.error('Failed to get port:', err);
30+
console.error('[requestPort]: Failed to get port:', err);
3131
throw err;
3232
}
3333
}

0 commit comments

Comments
 (0)