From e57e08c67237cf73d28afac7f672ec1e74ec308d Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Mon, 28 Sep 2009 15:56:27 +0000 Subject: [PATCH] Fixed PrinterHost demo returning invalid Device ID data when the attached device does not have a device ID (thanks to Andrei Krainev). --- Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c | 8 +++++++- LUFA/Drivers/USB/Class/Host/MassStorage.h | 2 +- LUFA/ManPages/ChangeLog.txt | 10 ++++++++++ LUFA/ManPages/FutureChanges.txt | 4 ++-- LUFA/ManPages/MigrationInformation.txt | 2 ++ 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c index 7ed8898e38..c75b7f910d 100644 --- a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c +++ b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c @@ -77,7 +77,7 @@ uint8_t Printer_SendData(void* PrinterCommands, uint16_t CommandSize) uint8_t Printer_GetDeviceID(char* DeviceIDString, uint16_t BufferSize) { uint8_t ErrorCode = HOST_SENDCONTROL_Successful; - uint16_t DeviceIDStringLength; + uint16_t DeviceIDStringLength = 0; USB_ControlRequest = (USB_Request_Header_t) { @@ -92,6 +92,12 @@ uint8_t Printer_GetDeviceID(char* DeviceIDString, uint16_t BufferSize) if ((ErrorCode = USB_Host_SendControlRequest(&DeviceIDStringLength)) != HOST_SENDCONTROL_Successful) return ErrorCode; + + if (!(DeviceIDStringLength)) + { + DeviceIDString[0] = 0x00; + return HOST_SENDCONTROL_Successful; + } DeviceIDStringLength = SwapEndian_16(DeviceIDStringLength); diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.h b/LUFA/Drivers/USB/Class/Host/MassStorage.h index a65a352c1c..8abe5734a0 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.h +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.h @@ -97,7 +97,7 @@ */ typedef struct { - uint8_t ReponseCode; + uint8_t ResponseCode; uint8_t SegmentNumber; diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 18b609080d..9ef7302ca5 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -9,6 +9,16 @@ * \section Sec_ChangeLogXXXXXX Version XXXXXX * * New: + * + * Changed: + * + * Fixed: + * - Fixed PrinterHost demo returning invalid Device ID data when the attached device does not have a + * device ID (thanks to Andrei Krainev) + * + * \section Sec_ChangeLog090924 Version 090924 + * + * New: * - Added new host mode class drivers and matching demos to the library for rapid application development * - Added flag to the HID report parser to indicate if a device has multiple reports * - Added new EVENT_USB_Device_StartOfFrame() event, controlled by the new USB_Device_EnableSOFEvents() and diff --git a/LUFA/ManPages/FutureChanges.txt b/LUFA/ManPages/FutureChanges.txt index c5f6fe22ab..6024a3a303 100644 --- a/LUFA/ManPages/FutureChanges.txt +++ b/LUFA/ManPages/FutureChanges.txt @@ -12,10 +12,10 @@ * or post your suggestion as an enhancement request to the project bug tracker. * * Targeted for This Release (SVN Development Only): - * - N/A + * - Add hub support to match Atmel's stack + * - Add ability to get number of bytes not written with pipe/endpoint write routines after an error * * Targeted for Future Releases: - * - Add hub support to match Atmel's stack * - Add standardized descriptor names to device and host class driver structures * - Remake AVRStudio project files * - Add detailed overviews of how each demo works diff --git a/LUFA/ManPages/MigrationInformation.txt b/LUFA/ManPages/MigrationInformation.txt index 0070a34acd..081bd96252 100644 --- a/LUFA/ManPages/MigrationInformation.txt +++ b/LUFA/ManPages/MigrationInformation.txt @@ -12,6 +12,8 @@ * * \section Sec_MigrationXXXXXX Migrating from 090810 to XXXXXX * + * \section Sec_Migration090924 Migrating from 090810 to 090924 + * * Non-USB Library Components * - The ADC_Off() function has been renamed to \ref ADC_ShutDown() to be consistent with the rest of the library. * - The \ref SPI_Init() routine's parameters have changed, so that the clock polarity and data sampling modes can be set. See