s32 USBStorage_MountLUN(usbstorage_handle *dev, u8 lun) { s32 retval; if(lun >= dev->max_lun) return IPC_EINVAL; usleep(50); retval = __usbstorage_clearerrors(dev, lun); if (retval<0) { usb_log("Error __usbstorage_clearerrors: %i. Reset & retry again.\n",retval); USBStorage_Reset(dev); retval = __usbstorage_clearerrors(dev, lun); if (retval<0) usb_log("Error __usbstorage_clearerrors(2): %i.\n",retval); //return retval; } else usb_log("__usbstorage_clearerrors Ok\n"); retval = USBStorage_Inquiry(dev, lun); usb_log("USBStorage_Inquiry: %i\n", retval); retval = USBStorage_ReadCapacity(dev, lun, &dev->sector_size[lun], NULL); usb_log("USBStorage_ReadCapacity: %i sector size: %i\n", retval,dev->sector_size[lun]); return retval; }
s32 USBStorage_MountLUN(struct ehci_hcd * ehci, usbstorage_handle *dev, u8 lun) { s32 retval; int f = handshake_mode; if (lun >= dev->max_lun) return -EINVAL; usb_timeout = 1000 * 1000; handshake_mode = 1; retval = __usbstorage_start_stop(dev, lun, 1); #ifdef MEM_PRINT s_printf(" start_stop cmd ret %i\n", retval); #endif if (retval < 0) goto ret; retval = __usbstorage_clearerrors(ehci, dev, lun); if (retval < 0) goto ret; usb_timeout = 1000 * 1000; retval = USBStorage_Inquiry(ehci, dev, lun); #ifdef MEM_PRINT s_printf(" Inquiry ret %i\n", retval); #endif if (retval < 0) goto ret; retval = USBStorage_ReadCapacity(ehci, dev, lun, &dev->sector_size[lun], &dev->n_sector[lun]); #ifdef MEM_PRINT s_printf(" ReadCapacity ret %i\n", retval); #endif ret: handshake_mode = f; return retval; }
s32 USBStorage_MountLUN(usbstorage_handle *dev, u8 lun) { s32 retval; if(lun >= dev->max_lun) return -EINVAL; retval = __usbstorage_clearerrors(dev, lun); if(retval < 0) return retval; retval = USBStorage_Inquiry(dev, lun); retval = USBStorage_ReadCapacity(dev, lun, &dev->sector_size[lun], &dev->n_sector[lun]); return retval; }