int
process_usb_op(struct disk_op_s *op)
{
+ if (!CONFIG_USB_MSC)
+ return 0;
switch (op->command) {
case CMD_READ:
return cdb_read(op);
return -1;
// Verify right kind of device
- if (iface->bInterfaceSubClass != US_SC_SCSI
+ if ((iface->bInterfaceSubClass != US_SC_SCSI &&
+ iface->bInterfaceSubClass != US_SC_ATAPI_8070 &&
+ iface->bInterfaceSubClass != US_SC_ATAPI_8020)
|| iface->bInterfaceProtocol != US_PR_BULK) {
dprintf(1, "Unsupported MSC USB device (subclass=%02x proto=%02x)\n"
, iface->bInterfaceSubClass, iface->bInterfaceProtocol);
return -1;
}
- // Find bulk in and bulk out endpoints.
- struct usb_endpoint_descriptor *indesc = findEndPointDesc(
- iface, imax, USB_ENDPOINT_XFER_BULK, USB_DIR_IN);
- struct usb_endpoint_descriptor *outdesc = findEndPointDesc(
- iface, imax, USB_ENDPOINT_XFER_BULK, USB_DIR_OUT);
- if (!indesc || !outdesc)
- goto fail;
- struct usb_pipe *bulkin = alloc_bulk_pipe(pipe, indesc);
- struct usb_pipe *bulkout = alloc_bulk_pipe(pipe, outdesc);
- if (!bulkin || !bulkout)
- goto fail;
-
// Allocate drive structure.
char *desc = malloc_tmphigh(MAXDESCSIZE);
struct usbdrive_s *udrive_g = malloc_fseg(sizeof(*udrive_g));
}
memset(udrive_g, 0, sizeof(*udrive_g));
udrive_g->drive.type = DTYPE_USB;
- udrive_g->bulkin = bulkin;
- udrive_g->bulkout = bulkout;
+
+ // Find bulk in and bulk out endpoints.
+ struct usb_endpoint_descriptor *indesc = findEndPointDesc(
+ iface, imax, USB_ENDPOINT_XFER_BULK, USB_DIR_IN);
+ struct usb_endpoint_descriptor *outdesc = findEndPointDesc(
+ iface, imax, USB_ENDPOINT_XFER_BULK, USB_DIR_OUT);
+ if (!indesc || !outdesc)
+ goto fail;
+ udrive_g->bulkin = alloc_bulk_pipe(pipe, indesc);
+ udrive_g->bulkout = alloc_bulk_pipe(pipe, outdesc);
+ if (!udrive_g->bulkin || !udrive_g->bulkout)
+ goto fail;
// Validate drive and find block size and sector count.
struct disk_op_s dop;