From 261284f5e1193de0879a7ecf77c5995ce35f6527 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Wed, 5 Mar 2014 21:41:45 +1100 Subject: [PATCH] Fix incorrect error codes returned on pip config failure in the host class drivers. --- LUFA/DoxygenPages/ChangeLog.txt | 5 ++++- LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c | 4 ++-- LUFA/Drivers/USB/Class/Host/AudioClassHost.c | 4 ++-- LUFA/Drivers/USB/Class/Host/CDCClassHost.c | 6 +++--- LUFA/Drivers/USB/Class/Host/HIDClassHost.c | 4 ++-- LUFA/Drivers/USB/Class/Host/MIDIClassHost.c | 4 ++-- LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c | 4 ++-- LUFA/Drivers/USB/Class/Host/PrinterClassHost.c | 4 ++-- LUFA/Drivers/USB/Class/Host/RNDISClassHost.c | 6 +++--- LUFA/Drivers/USB/Class/Host/StillImageClassHost.c | 6 +++--- 10 files changed, 25 insertions(+), 22 deletions(-) diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt index a80a4c08a9..2fd980f465 100644 --- a/LUFA/DoxygenPages/ChangeLog.txt +++ b/LUFA/DoxygenPages/ChangeLog.txt @@ -7,7 +7,10 @@ /** \page Page_ChangeLog Project Changelog * * \section Sec_ChangeLogXXXXXX Version XXXXXX - * None + * Fixed: + * - Core: + * - Fixed device class driver pipe configuration routines returning success with a partially constructed instance + * when a pipe configuration failed (thanks to Helge Suess) * * \section Sec_ChangeLog140302 Version 140302 * New: diff --git a/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c b/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c index 57a619ff47..ac8d5dc5c7 100644 --- a/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c +++ b/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c @@ -98,10 +98,10 @@ uint8_t AOA_Host_ConfigurePipes(USB_ClassInfo_AOA_Host_t* const AOAInterfaceInfo AOAInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataINPipe, 1))) - return false; + return AOA_ENUMERROR_PipeConfigurationFailed; if (!(Pipe_ConfigurePipeTable(&AOAInterfaceInfo->Config.DataOUTPipe, 1))) - return false; + return AOA_ENUMERROR_PipeConfigurationFailed; AOAInterfaceInfo->State.IsActive = true; AOAInterfaceInfo->State.InterfaceNumber = AOAInterface->InterfaceNumber; diff --git a/LUFA/Drivers/USB/Class/Host/AudioClassHost.c b/LUFA/Drivers/USB/Class/Host/AudioClassHost.c index c437654b60..3b5bceb6a8 100644 --- a/LUFA/Drivers/USB/Class/Host/AudioClassHost.c +++ b/LUFA/Drivers/USB/Class/Host/AudioClassHost.c @@ -104,10 +104,10 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa AudioInterfaceInfo->Config.DataOUTPipe.Banks = 2; if (!(Pipe_ConfigurePipeTable(&AudioInterfaceInfo->Config.DataINPipe, 1))) - return false; + return AUDIO_ENUMERROR_PipeConfigurationFailed; if (!(Pipe_ConfigurePipeTable(&AudioInterfaceInfo->Config.DataOUTPipe, 1))) - return false; + return AUDIO_ENUMERROR_PipeConfigurationFailed; AudioInterfaceInfo->State.ControlInterfaceNumber = AudioControlInterface->InterfaceNumber; AudioInterfaceInfo->State.StreamingInterfaceNumber = AudioStreamingInterface->InterfaceNumber; diff --git a/LUFA/Drivers/USB/Class/Host/CDCClassHost.c b/LUFA/Drivers/USB/Class/Host/CDCClassHost.c index a575c1bbf6..b32a237cc9 100644 --- a/LUFA/Drivers/USB/Class/Host/CDCClassHost.c +++ b/LUFA/Drivers/USB/Class/Host/CDCClassHost.c @@ -112,13 +112,13 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo CDCInterfaceInfo->Config.NotificationPipe.Type = EP_TYPE_INTERRUPT; if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.DataINPipe, 1))) - return false; + return CDC_ENUMERROR_PipeConfigurationFailed; if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.DataOUTPipe, 1))) - return false; + return CDC_ENUMERROR_PipeConfigurationFailed; if (!(Pipe_ConfigurePipeTable(&CDCInterfaceInfo->Config.NotificationPipe, 1))) - return false; + return CDC_ENUMERROR_PipeConfigurationFailed; CDCInterfaceInfo->State.ControlInterfaceNumber = CDCControlInterface->InterfaceNumber; CDCInterfaceInfo->State.ControlLineStates.HostToDevice = (CDC_CONTROL_LINE_OUT_RTS | CDC_CONTROL_LINE_OUT_DTR); diff --git a/LUFA/Drivers/USB/Class/Host/HIDClassHost.c b/LUFA/Drivers/USB/Class/Host/HIDClassHost.c index c3375e67e3..e2b83ea286 100644 --- a/LUFA/Drivers/USB/Class/Host/HIDClassHost.c +++ b/LUFA/Drivers/USB/Class/Host/HIDClassHost.c @@ -99,7 +99,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo HIDInterfaceInfo->Config.DataINPipe.Type = EP_TYPE_INTERRUPT; if (!(Pipe_ConfigurePipeTable(&HIDInterfaceInfo->Config.DataINPipe, 1))) - return false; + return HID_ENUMERROR_PipeConfigurationFailed; if (DataOUTEndpoint) { @@ -108,7 +108,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo HIDInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_INTERRUPT; if (!(Pipe_ConfigurePipeTable(&HIDInterfaceInfo->Config.DataOUTPipe, 1))) - return false; + return HID_ENUMERROR_PipeConfigurationFailed; } HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber; diff --git a/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c b/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c index 7ec26549d5..8b898cba5d 100644 --- a/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c +++ b/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c @@ -87,10 +87,10 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI MIDIInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; if (!(Pipe_ConfigurePipeTable(&MIDIInterfaceInfo->Config.DataINPipe, 1))) - return false; + return MIDI_ENUMERROR_PipeConfigurationFailed; if (!(Pipe_ConfigurePipeTable(&MIDIInterfaceInfo->Config.DataOUTPipe, 1))) - return false; + return MIDI_ENUMERROR_PipeConfigurationFailed; MIDIInterfaceInfo->State.InterfaceNumber = MIDIInterface->InterfaceNumber; MIDIInterfaceInfo->State.IsActive = true; diff --git a/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c b/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c index d5bace70e8..ac448a55b2 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c +++ b/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c @@ -87,10 +87,10 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, MSInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; if (!(Pipe_ConfigurePipeTable(&MSInterfaceInfo->Config.DataINPipe, 1))) - return false; + return MS_ENUMERROR_PipeConfigurationFailed; if (!(Pipe_ConfigurePipeTable(&MSInterfaceInfo->Config.DataOUTPipe, 1))) - return false; + return MS_ENUMERROR_PipeConfigurationFailed; MSInterfaceInfo->State.InterfaceNumber = MassStorageInterface->InterfaceNumber; MSInterfaceInfo->State.IsActive = true; diff --git a/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c b/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c index 7eda9f605e..fd32e1c28e 100644 --- a/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c +++ b/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c @@ -87,10 +87,10 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI PRNTInterfaceInfo->Config.DataOUTPipe.Type = EP_TYPE_BULK; if (!(Pipe_ConfigurePipeTable(&PRNTInterfaceInfo->Config.DataINPipe, 1))) - return false; + return PRNT_ENUMERROR_PipeConfigurationFailed; if (!(Pipe_ConfigurePipeTable(&PRNTInterfaceInfo->Config.DataOUTPipe, 1))) - return false; + return PRNT_ENUMERROR_PipeConfigurationFailed; PRNTInterfaceInfo->State.InterfaceNumber = PrinterInterface->InterfaceNumber; PRNTInterfaceInfo->State.AlternateSetting = PrinterInterface->AlternateSetting; diff --git a/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c b/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c index 9072d3aa64..3ed51c8d9c 100644 --- a/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c +++ b/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c @@ -114,13 +114,13 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa RNDISInterfaceInfo->Config.NotificationPipe.Type = EP_TYPE_INTERRUPT; if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.DataINPipe, 1))) - return false; + return RNDIS_ENUMERROR_PipeConfigurationFailed; if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.DataOUTPipe, 1))) - return false; + return RNDIS_ENUMERROR_PipeConfigurationFailed; if (!(Pipe_ConfigurePipeTable(&RNDISInterfaceInfo->Config.NotificationPipe, 1))) - return false; + return RNDIS_ENUMERROR_PipeConfigurationFailed; RNDISInterfaceInfo->State.ControlInterfaceNumber = RNDISControlInterface->InterfaceNumber; RNDISInterfaceInfo->State.IsActive = true; diff --git a/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c b/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c index b3d74bc1ef..24a6308f5d 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c +++ b/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c @@ -100,13 +100,13 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, SIInterfaceInfo->Config.EventsPipe.Type = EP_TYPE_INTERRUPT; if (!(Pipe_ConfigurePipeTable(&SIInterfaceInfo->Config.DataINPipe, 1))) - return false; + return SI_ENUMERROR_PipeConfigurationFailed; if (!(Pipe_ConfigurePipeTable(&SIInterfaceInfo->Config.DataOUTPipe, 1))) - return false; + return SI_ENUMERROR_PipeConfigurationFailed; if (!(Pipe_ConfigurePipeTable(&SIInterfaceInfo->Config.EventsPipe, 1))) - return false; + return SI_ENUMERROR_PipeConfigurationFailed; SIInterfaceInfo->State.InterfaceNumber = StillImageInterface->InterfaceNumber; SIInterfaceInfo->State.IsActive = true;