usb_block_drv: don't select alternate interface setting

Selecting an alternate interface setting, even if it is the same as the
current one, apparently makes the INQUIRY command fail with USB devices
like 'SanDisk Ultra Fit' (0781:5583) and 'Corsair Flash Voyager'
(1b1c:1a03) when the USB block driver is restarted.

Fixes #2860
This commit is contained in:
Christian Prochaska 2018-06-11 15:09:29 +02:00 committed by Christian Helmuth
parent 347d82bdc6
commit d1524ba0b8

View File

@ -381,32 +381,26 @@ struct Usb::Block_driver : Usb::Completion,
ISUBCLASS_SCSI = 6, ISUBCLASS_SCSI = 6,
IPROTO_BULK_ONLY = 80 IPROTO_BULK_ONLY = 80
}; };
try {
Alternate_interface &alt_iface = iface.alternate_interface(0);
iface.set_alternate_interface(alt_iface);
if (alt_iface.iclass != ICLASS_MASS_STORAGE Alternate_interface &alt_iface = iface.current();
|| alt_iface.isubclass != ISUBCLASS_SCSI
|| alt_iface.iprotocol != IPROTO_BULK_ONLY) {
Genode::error("No mass storage SCSI bulk-only device");
return false;
}
for (int i = 0; i < alt_iface.num_endpoints; i++) { if (alt_iface.iclass != ICLASS_MASS_STORAGE
Endpoint ep = alt_iface.endpoint(i); || alt_iface.isubclass != ISUBCLASS_SCSI
if (!ep.is_bulk()) || alt_iface.iprotocol != IPROTO_BULK_ONLY) {
continue; Genode::error("No mass storage SCSI bulk-only device");
if (ep.address & Usb::ENDPOINT_IN)
ep_in = i;
else
ep_out = i;
}
} catch (Usb::Session::Interface_not_found) {
Genode::error("Interface not found");
return false; return false;
} }
for (int i = 0; i < alt_iface.num_endpoints; i++) {
Endpoint ep = alt_iface.endpoint(i);
if (!ep.bulk())
continue;
if (ep.address & Usb::ENDPOINT_IN)
ep_in = i;
else
ep_out = i;
}
try { try {
/* /*