File tree 1 file changed +5
-6
lines changed
packages/transport/src/api
1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -500,22 +500,21 @@ export class UsbApi extends AbstractApi {
500
500
return [ hidDevices , nonHidDevices ] ;
501
501
}
502
502
503
+ // old bridge narrows multiple different errors to "device was disconnected" error.
503
504
// https://github.com/trezor/trezord-go/blob/db03d99230f5b609a354e3586f1dfc0ad6da16f7/usb/libusb.go#L545
505
+ // I am not sure if this is correct so at this point we only narrow disconnected error from node-usb and webusb
504
506
private handleReadWriteError ( err : Error ) {
505
507
if (
506
508
[
507
509
// node usb
508
- // 'LIBUSB_TRANSFER_ERROR',
509
- // 'LIBUSB_ERROR_PIPE',
510
- // 'LIBUSB_ERROR_IO',
511
- // 'LIBUSB_ERROR_OTHER',
512
-
513
510
'LIBUSB_ERROR_NO_DEVICE' ,
514
511
// web usb
515
- ERRORS . INTERFACE_DATA_TRANSFER ,
516
512
'The device was disconnected.' ,
517
513
] . some ( disconnectedErr => err . message . includes ( disconnectedErr ) )
518
514
) {
515
+ // make sure that local descriptors are updated and higher layers are notified
516
+ this . enumerate ( ) ;
517
+
519
518
return this . error ( { error : ERRORS . DEVICE_DISCONNECTED_DURING_ACTION } ) ;
520
519
}
521
520
You can’t perform that action at this time.
0 commit comments