USB: Disconnect the virtual device only for TRANSFER_NO_DEVICE error

Resolve: #15565
This commit is contained in:
Florin9doi 2024-05-09 23:02:56 +03:00 committed by Elad Ashkenazi
parent c02aae417a
commit 7ac097255e

View File

@ -587,11 +587,7 @@ void usb_handler_thread::transfer_complete(struct libusb_transfer* transfer)
case LIBUSB_TRANSFER_COMPLETED: usbd_transfer->result = HC_CC_NOERR; break;
case LIBUSB_TRANSFER_TIMED_OUT: usbd_transfer->result = EHCI_CC_XACT; break;
case LIBUSB_TRANSFER_OVERFLOW: usbd_transfer->result = EHCI_CC_BABBLE; break;
case LIBUSB_TRANSFER_ERROR:
case LIBUSB_TRANSFER_CANCELLED:
case LIBUSB_TRANSFER_STALL:
case LIBUSB_TRANSFER_NO_DEVICE:
default:
usbd_transfer->result = EHCI_CC_HALTED;
if (usbd_transfer->assigned_number && handled_devices.erase(usbd_transfer->assigned_number))
{
@ -600,6 +596,12 @@ void usb_handler_thread::transfer_complete(struct libusb_transfer* transfer)
usbd_transfer->assigned_number = 0;
}
break;
case LIBUSB_TRANSFER_ERROR:
case LIBUSB_TRANSFER_CANCELLED:
case LIBUSB_TRANSFER_STALL:
default:
usbd_transfer->result = EHCI_CC_HALTED;
break;
}
usbd_transfer->count = transfer->actual_length;