File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments