aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/ClassDriver/MassStorageHost
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-08-26 08:20:55 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-08-26 08:20:55 +0000
commit559ca2ba046e47faa54f0845339f0385a5cfbb26 (patch)
tree774fb6a1eb6edcbeb20fea8b09136ecfebe0363d /Demos/Host/ClassDriver/MassStorageHost
parenta765f717273728139966f97c634ccffe52d218df (diff)
downloadlufa-559ca2ba046e47faa54f0845339f0385a5cfbb26.tar.gz
lufa-559ca2ba046e47faa54f0845339f0385a5cfbb26.tar.bz2
lufa-559ca2ba046e47faa54f0845339f0385a5cfbb26.zip
Added MS_Host_TestUnitReady() and MS_Host_ReadDeviceCapacity() to the host mode Mass Storage Class driver.
Diffstat (limited to 'Demos/Host/ClassDriver/MassStorageHost')
-rw-r--r--Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
index d9fe47d3b..57aba4599 100644
--- a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
+++ b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
@@ -150,11 +150,16 @@ int main(void)
printf("Vendor \"%.8s\", Product \"%.16s\"\r\n", InquiryData.VendorID, InquiryData.ProductID);
printf("Waiting until ready...\r\n");
- bool DeviceReady;
- do
+ for (;;)
{
- if (MS_Host_TestUnitReady(&FlashDisk_MS_Interface, 0, &DeviceReady))
+ uint8_t ErrorCode = MS_Host_TestUnitReady(&FlashDisk_MS_Interface, 0);
+
+ if (!(ErrorCode))
+ break;
+
+ /* Check if an error other than a logical command error (device busy) received */
+ if (ErrorCode != MS_ERROR_LOGICAL_CMD_FAILED)
{
printf("Error waiting for device to be ready.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -162,7 +167,6 @@ int main(void)
break;
}
}
- while (!(DeviceReady));
printf("Retrieving Capacity... ");