Skip to content

Commit 060125f

Browse files
Debug multiple tabs connecting
1 parent 2121bc3 commit 060125f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

kernel/src/services/DeviceService.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ export class DeviceService {
1313
try {
1414
const port = await navigator.serial.requestPort();
1515
this.port = port;
16+
17+
// 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');
20+
return;
21+
}
22+
1623
this.transport = new Transport(port);
24+
25+
1726
} catch (err) {
1827
console.error('Failed to get port:', err);
1928
throw err;

0 commit comments

Comments
 (0)