+ USB_SetDeviceDataPtr(Dev, info);
+
+ // Get the class code (and hence what command set is in use)
+ Uint8 sc = (USB_GetInterfaceClass(Dev) & 0x00FF00) >> 8;
+ switch( sc )
+ {
+ // SCSI Transparent Command Set
+ case 0x06:
+ info->BlockCount = MSC_SCSI_GetSize(Dev, &info->BlockSize);
+ // HACK! Try twice if needed
+ // Qemu Tegra2 appears to error with Sense=RESET on the first attempt
+ if( !info->BlockCount )
+ info->BlockCount = MSC_SCSI_GetSize(Dev, &info->BlockSize);
+ vt = &gMSC_SCSI_VolType;
+ break;
+ // Unknown, prepare to chuck sad
+ default:
+ Log_Error("USB MSC", "Unknown sub-class 0x%02x", sc);
+ USB_SetDeviceDataPtr(Dev, NULL);
+ free(info);
+ return ;
+ }
+
+ // Zero size indicates some form of critical error
+ if( !info->BlockCount ) {
+ Log_Error("USB MSC", "Device did not report a valid size");
+ USB_SetDeviceDataPtr(Dev, NULL);
+ free(info);
+ return ;
+ }