break;\r
}\r
\r
+ puts_P(PSTR("Still Image Device Enumerated.\r\n"));\r
+\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
case HOST_STATE_Configured:\r
- puts_P(PSTR("Still Image Device Enumerated.\r\n"));\r
- \r
- USB_HostState = HOST_STATE_Ready;\r
- break;\r
- case HOST_STATE_Ready:\r
/* Indicate device busy via the status LEDs */\r
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);\r
\r
uint8_t* DeviceInfoPos = DeviceInfo;\r
\r
/* Skip over the data before the unicode device information strings */\r
- DeviceInfoPos += 8; // Skip to VendorExtensionDesc String\r
- DeviceInfoPos += ((*DeviceInfoPos << 1) + 1); // Skip over VendorExtensionDesc String\r
- DeviceInfoPos += 2; // Skip over FunctionalMode\r
- DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over OperationCode Array\r
- DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over EventCode Array\r
- DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over DevicePropCode Array\r
- DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over ObjectFormatCode Array\r
- DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over ObjectFormatCode Array\r
+ DeviceInfoPos += 8; // Skip to VendorExtensionDesc String\r
+ DeviceInfoPos += (1 + UNICODE_STRING_LENGTH(*DeviceInfoPos)); // Skip over VendorExtensionDesc String\r
+ DeviceInfoPos += 2; // Skip over FunctionalMode\r
+ DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over OperationCode Array\r
+ DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over EventCode Array\r
+ DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over DevicePropCode Array\r
+ DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over ObjectFormatCode Array\r
+ DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over ObjectFormatCode Array\r
\r
/* Extract and convert the Manufacturer Unicode string to ASCII and print it through the USART */\r
char Manufacturer[*DeviceInfoPos];\r
UnicodeToASCII(DeviceInfoPos, Manufacturer);\r
printf_P(PSTR(" Manufacturer: %s\r\n"), Manufacturer);\r
\r
- DeviceInfoPos += ((*DeviceInfoPos << 1) + 1); // Skip over Manufacturer String\r
+ DeviceInfoPos += 1 + UNICODE_STRING_LENGTH(*DeviceInfoPos); // Skip over Manufacturer String\r
\r
/* Extract and convert the Model Unicode string to ASCII and print it through the USART */\r
char Model[*DeviceInfoPos];\r
UnicodeToASCII(DeviceInfoPos, Model);\r
printf_P(PSTR(" Model: %s\r\n"), Model);\r
\r
- DeviceInfoPos += ((*DeviceInfoPos << 1) + 1); // Skip over Model String\r
+ DeviceInfoPos += 1 + UNICODE_STRING_LENGTH(*DeviceInfoPos); // Skip over Model String\r
\r
/* Extract and convert the Device Version Unicode string to ASCII and print it through the USART */\r
char DeviceVersion[*DeviceInfoPos];\r
/* Indicate device no longer busy */\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
\r
- /* Wait until USB device disconnected */\r
- while (USB_IsConnected);\r
- \r
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
}\r
}\r
/* Loop through the entire unicode string */\r
while (CharactersRemaining--)\r
{\r
- /* Load in the next unicode character (only the lower byte, only Unicode coded ASCII supported) */\r
+ /* Load in the next unicode character (only the lower byte, as only Unicode coded ASCII is supported) */\r
*(Buffer++) = *UnicodeString;\r
\r
/* Jump to the next unicode character */\r