aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-09-30 23:23:05 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-09-30 23:23:05 +0000
commita1e453e9001f7e69bde671e6dd4ebe65fa1400d0 (patch)
tree57e31f268fb752c67a9bde3948fced64d0d33d98 /LUFA/Drivers/USB
parent86367574e6cad81f93149d1b0a0424572af0517b (diff)
downloadlufa-a1e453e9001f7e69bde671e6dd4ebe65fa1400d0.tar.gz
lufa-a1e453e9001f7e69bde671e6dd4ebe65fa1400d0.tar.bz2
lufa-a1e453e9001f7e69bde671e6dd4ebe65fa1400d0.zip
Make Host mode Class drivers only set the class driver instance's state values once a compatible interface has been found within the device.
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r--LUFA/Drivers/USB/Class/Host/CDC.c23
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.c46
-rw-r--r--LUFA/Drivers/USB/Class/Host/MIDI.c26
-rw-r--r--LUFA/Drivers/USB/Class/Host/MassStorage.c26
-rw-r--r--LUFA/Drivers/USB/Class/Host/Printer.c34
-rw-r--r--LUFA/Drivers/USB/Class/Host/RNDIS.c25
-rw-r--r--LUFA/Drivers/USB/Class/Host/StillImage.c32
7 files changed, 74 insertions, 138 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c
index 79c207ea8..93a5895fc 100644
--- a/LUFA/Drivers/USB/Class/Host/CDC.c
+++ b/LUFA/Drivers/USB/Class/Host/CDC.c
@@ -40,27 +40,20 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
uint16_t ConfigDescriptorSize,
void* ConfigDescriptorData)
{
- USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
- USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
- USB_Descriptor_Endpoint_t* NotificationEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* NotificationEndpoint = NULL;
+ USB_Descriptor_Interface_t* CDCControlInterface = NULL;
memset(&CDCInterfaceInfo->State, 0x00, sizeof(CDCInterfaceInfo->State));
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return CDC_ENUMERROR_InvalidConfigDescriptor;
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- DCOMP_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
- {
- return CDC_ENUMERROR_NoCompatibleInterfaceFound;
- }
-
- CDCInterfaceInfo->State.ControlInterfaceNumber = DESCRIPTOR_PCAST(ConfigDescriptorData,
- USB_Descriptor_Interface_t)->InterfaceNumber;
-
while (!(DataINEndpoint) || !(DataOUTEndpoint) || !(NotificationEndpoint))
{
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
+ if (!(CDCControlInterface) ||
+ USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_CDC_Host_NextCDCInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
if (NotificationEndpoint)
@@ -82,8 +75,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
return CDC_ENUMERROR_NoCompatibleInterfaceFound;
}
- CDCInterfaceInfo->State.ControlInterfaceNumber = DESCRIPTOR_PCAST(ConfigDescriptorData,
- USB_Descriptor_Interface_t)->InterfaceNumber;
+ CDCControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
NotificationEndpoint = NULL;
}
@@ -135,6 +127,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
}
}
+ CDCInterfaceInfo->State.ControlInterfaceNumber = CDCControlInterface->InterfaceNumber;
CDCInterfaceInfo->State.ControlLineStates.HostToDevice = (CDC_CONTROL_LINE_OUT_RTS | CDC_CONTROL_LINE_OUT_DTR);
CDCInterfaceInfo->State.ControlLineStates.DeviceToHost = (CDC_CONTROL_LINE_IN_DCD | CDC_CONTROL_LINE_IN_DSR);
CDCInterfaceInfo->State.IsActive = true;
diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c
index b0593f0f4..9dfc00a12 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.c
+++ b/LUFA/Drivers/USB/Class/Host/HID.c
@@ -40,43 +40,20 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
uint16_t ConfigDescriptorSize,
void* ConfigDescriptorData)
{
- USB_Descriptor_Interface_t* CurrentHIDInterface;
-
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
+ USB_Descriptor_Interface_t* HIDInterface = NULL;
+ USB_HID_Descriptor_HID_t* HIDDescriptor = NULL;
memset(&HIDInterfaceInfo->State, 0x00, sizeof(HIDInterfaceInfo->State));
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return HID_ENUMERROR_InvalidConfigDescriptor;
-
- do
- {
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- DCOMP_HID_Host_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found)
- {
- return HID_ENUMERROR_NoCompatibleInterfaceFound;
- }
-
- CurrentHIDInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
- } while (HIDInterfaceInfo->Config.HIDInterfaceProtocol &&
- (CurrentHIDInterface->Protocol != HIDInterfaceInfo->Config.HIDInterfaceProtocol));
-
- HIDInterfaceInfo->State.InterfaceNumber = CurrentHIDInterface->InterfaceNumber;
- HIDInterfaceInfo->State.SupportsBootProtocol = (CurrentHIDInterface->SubClass != HID_BOOTP_NonBootProtocol);
-
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- DCOMP_HID_Host_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
- {
- return HID_ENUMERROR_NoCompatibleInterfaceFound;
- }
-
- HIDInterfaceInfo->State.HIDReportSize = DESCRIPTOR_PCAST(ConfigDescriptorData,
- USB_HID_Descriptor_HID_t)->HIDReportLength;
while (!(DataINEndpoint) || !(DataOUTEndpoint))
{
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
+ if (!(HIDInterface) ||
+ USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_HID_Host_NextHIDInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
if (DataINEndpoint || DataOUTEndpoint)
@@ -90,21 +67,17 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
return HID_ENUMERROR_NoCompatibleInterfaceFound;
}
- CurrentHIDInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
+ HIDInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
} while (HIDInterfaceInfo->Config.HIDInterfaceProtocol &&
- (CurrentHIDInterface->Protocol != HIDInterfaceInfo->Config.HIDInterfaceProtocol));
+ (HIDInterface->Protocol != HIDInterfaceInfo->Config.HIDInterfaceProtocol));
- HIDInterfaceInfo->State.InterfaceNumber = CurrentHIDInterface->InterfaceNumber;
- HIDInterfaceInfo->State.SupportsBootProtocol = (CurrentHIDInterface->SubClass != HID_BOOTP_NonBootProtocol);
-
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_HID_Host_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
{
return HID_ENUMERROR_NoCompatibleInterfaceFound;
}
- HIDInterfaceInfo->State.HIDReportSize = DESCRIPTOR_PCAST(ConfigDescriptorData,
- USB_HID_Descriptor_HID_t)->HIDReportLength;
+ HIDDescriptor = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_HID_Descriptor_HID_t);
DataINEndpoint = NULL;
DataOUTEndpoint = NULL;
@@ -143,7 +116,10 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
}
}
- HIDInterfaceInfo->State.LargestReportSize = 8;
+ HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber;
+ HIDInterfaceInfo->State.HIDReportSize = HIDDescriptor->HIDReportLength;
+ HIDInterfaceInfo->State.SupportsBootProtocol = (HIDInterface->SubClass != HID_BOOTP_NonBootProtocol);
+ HIDInterfaceInfo->State.LargestReportSize = 8;
HIDInterfaceInfo->State.IsActive = true;
return HID_ENUMERROR_NoError;
diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.c b/LUFA/Drivers/USB/Class/Host/MIDI.c
index 6f34933fb..ed958c174 100644
--- a/LUFA/Drivers/USB/Class/Host/MIDI.c
+++ b/LUFA/Drivers/USB/Class/Host/MIDI.c
@@ -40,38 +40,31 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
uint16_t ConfigDescriptorSize,
void* ConfigDescriptorData)
{
- USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
- USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
+ USB_Descriptor_Interface_t* MIDIInterface = NULL;
memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State));
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return MIDI_ENUMERROR_InvalidConfigDescriptor;
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- DCOMP_MIDI_Host_NextMIDIStreamingInterface) != DESCRIPTOR_SEARCH_COMP_Found)
- {
- return MIDI_ENUMERROR_NoCompatibleInterfaceFound;
- }
-
- MIDIInterfaceInfo->State.InterfaceNumber = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t)->InterfaceNumber;
-
while (!(DataINEndpoint) || !(DataOUTEndpoint))
{
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
+ if (!(MIDIInterface) ||
+ USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
- DataINEndpoint = NULL;
- DataOUTEndpoint = NULL;
-
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_MIDI_Host_NextMIDIStreamingInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
return MIDI_ENUMERROR_NoCompatibleInterfaceFound;
}
- MIDIInterfaceInfo->State.InterfaceNumber = DESCRIPTOR_PCAST(ConfigDescriptorData,
- USB_Descriptor_Interface_t)->InterfaceNumber;
+ MIDIInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
+
+ DataINEndpoint = NULL;
+ DataOUTEndpoint = NULL;
continue;
}
@@ -104,6 +97,7 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
}
}
+ MIDIInterfaceInfo->State.InterfaceNumber = MIDIInterface->InterfaceNumber;
MIDIInterfaceInfo->State.IsActive = true;
return MIDI_ENUMERROR_NoError;
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c
index 104a358ce..6a8247989 100644
--- a/LUFA/Drivers/USB/Class/Host/MassStorage.c
+++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c
@@ -40,38 +40,31 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
uint16_t ConfigDescriptorSize,
void* ConfigDescriptorData)
{
- USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
- USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
+ USB_Descriptor_Interface_t* MassStorageInterface = NULL;
memset(&MSInterfaceInfo->State, 0x00, sizeof(MSInterfaceInfo->State));
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return MS_ENUMERROR_InvalidConfigDescriptor;
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- DCOMP_MS_Host_NextMSInterface) != DESCRIPTOR_SEARCH_COMP_Found)
- {
- return MS_ENUMERROR_NoCompatibleInterfaceFound;
- }
-
- MSInterfaceInfo->State.InterfaceNumber = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t)->InterfaceNumber;
-
while (!(DataINEndpoint) || !(DataOUTEndpoint))
{
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
+ if (!(MassStorageInterface) ||
+ USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_MS_Host_NextMSInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
- DataINEndpoint = NULL;
- DataOUTEndpoint = NULL;
-
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_MS_Host_NextMSInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
return MS_ENUMERROR_NoCompatibleInterfaceFound;
}
- MSInterfaceInfo->State.InterfaceNumber = DESCRIPTOR_PCAST(ConfigDescriptorData,
- USB_Descriptor_Interface_t)->InterfaceNumber;
+ MassStorageInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
+
+ DataINEndpoint = NULL;
+ DataOUTEndpoint = NULL;
continue;
}
@@ -104,6 +97,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
}
}
+ MSInterfaceInfo->State.InterfaceNumber = MassStorageInterface->InterfaceNumber;
MSInterfaceInfo->State.IsActive = true;
return MS_ENUMERROR_NoError;
diff --git a/LUFA/Drivers/USB/Class/Host/Printer.c b/LUFA/Drivers/USB/Class/Host/Printer.c
index 6b16228d5..773b9b463 100644
--- a/LUFA/Drivers/USB/Class/Host/Printer.c
+++ b/LUFA/Drivers/USB/Class/Host/Printer.c
@@ -40,43 +40,31 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
uint16_t ConfigDescriptorSize,
void* DeviceConfigDescriptor)
{
- USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
- USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
+ USB_Descriptor_Interface_t* PrinterInterface = NULL;
memset(&PRNTInterfaceInfo->State, 0x00, sizeof(PRNTInterfaceInfo->State));
if (DESCRIPTOR_TYPE(DeviceConfigDescriptor) != DTYPE_Configuration)
return PRNT_ENUMERROR_InvalidConfigDescriptor;
-
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor,
- DCOMP_PRNT_Host_NextPRNTInterface) != DESCRIPTOR_SEARCH_COMP_Found)
- {
- return PRNT_ENUMERROR_NoCompatibleInterfaceFound;
- }
-
- PRNTInterfaceInfo->State.InterfaceNumber = DESCRIPTOR_PCAST(DeviceConfigDescriptor,
- USB_Descriptor_Interface_t)->InterfaceNumber;
- PRNTInterfaceInfo->State.AlternateSetting = DESCRIPTOR_PCAST(DeviceConfigDescriptor,
- USB_Descriptor_Interface_t)->AlternateSetting;
-
+
while (!(DataINEndpoint) || !(DataOUTEndpoint))
{
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor,
+ if (!(PrinterInterface) ||
+ USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor,
DCOMP_PRNT_Host_NextPRNTInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
- DataINEndpoint = NULL;
- DataOUTEndpoint = NULL;
-
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor,
DCOMP_PRNT_Host_NextPRNTInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
return PRNT_ENUMERROR_NoCompatibleInterfaceFound;
}
- PRNTInterfaceInfo->State.InterfaceNumber = DESCRIPTOR_PCAST(DeviceConfigDescriptor,
- USB_Descriptor_Interface_t)->InterfaceNumber;
- PRNTInterfaceInfo->State.AlternateSetting = DESCRIPTOR_PCAST(DeviceConfigDescriptor,
- USB_Descriptor_Interface_t)->AlternateSetting;
+ PrinterInterface = DESCRIPTOR_PCAST(DeviceConfigDescriptor, USB_Descriptor_Interface_t);
+
+ DataINEndpoint = NULL;
+ DataOUTEndpoint = NULL;
continue;
}
@@ -109,6 +97,8 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
}
}
+ PRNTInterfaceInfo->State.InterfaceNumber = PrinterInterface->InterfaceNumber;
+ PRNTInterfaceInfo->State.AlternateSetting = PrinterInterface->AlternateSetting;
PRNTInterfaceInfo->State.IsActive = true;
return PRNT_ENUMERROR_NoError;
diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.c b/LUFA/Drivers/USB/Class/Host/RNDIS.c
index f6dcba12b..09fac7ab5 100644
--- a/LUFA/Drivers/USB/Class/Host/RNDIS.c
+++ b/LUFA/Drivers/USB/Class/Host/RNDIS.c
@@ -40,27 +40,22 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
uint16_t ConfigDescriptorSize,
void* ConfigDescriptorData)
{
- USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
- USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
- USB_Descriptor_Endpoint_t* NotificationEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* NotificationEndpoint = NULL;
+ USB_Descriptor_Interface_t* RNDISControlInterface = NULL;
memset(&RNDISInterfaceInfo->State, 0x00, sizeof(RNDISInterfaceInfo->State));
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return RNDIS_ENUMERROR_InvalidConfigDescriptor;
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- DCOMP_RNDIS_Host_NextRNDISControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)
- {
- return RNDIS_ENUMERROR_NoCompatibleInterfaceFound;
- }
-
- RNDISInterfaceInfo->State.ControlInterfaceNumber = DESCRIPTOR_PCAST(ConfigDescriptorData,
- USB_Descriptor_Interface_t)->InterfaceNumber;
+ RNDISControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
while (!(DataINEndpoint) || !(DataOUTEndpoint) || !(NotificationEndpoint))
{
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
+ if (!(RNDISControlInterface) ||
+ USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
if (NotificationEndpoint)
@@ -81,9 +76,8 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
{
return RNDIS_ENUMERROR_NoCompatibleInterfaceFound;
}
-
- RNDISInterfaceInfo->State.ControlInterfaceNumber = DESCRIPTOR_PCAST(ConfigDescriptorData,
- USB_Descriptor_Interface_t)->InterfaceNumber;
+
+ RNDISControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
NotificationEndpoint = NULL;
}
@@ -135,6 +129,7 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
}
}
+ RNDISInterfaceInfo->State.ControlInterfaceNumber = RNDISControlInterface->InterfaceNumber;
RNDISInterfaceInfo->State.IsActive = true;
return RNDIS_ENUMERROR_NoError;
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c
index 744444d59..0f4cac081 100644
--- a/LUFA/Drivers/USB/Class/Host/StillImage.c
+++ b/LUFA/Drivers/USB/Class/Host/StillImage.c
@@ -40,41 +40,33 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
uint16_t ConfigDescriptorSize,
void* ConfigDescriptorData)
{
- USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
- USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
- USB_Descriptor_Endpoint_t* EventsEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
+ USB_Descriptor_Endpoint_t* EventsEndpoint = NULL;
+ USB_Descriptor_Interface_t* StillImageInterface = NULL;
memset(&SIInterfaceInfo->State, 0x00, sizeof(SIInterfaceInfo->State));
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return SI_ENUMERROR_InvalidConfigDescriptor;
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
- DCOMP_SI_Host_NextSIInterface) != DESCRIPTOR_SEARCH_COMP_Found)
- {
- return SI_ENUMERROR_NoCompatibleInterfaceFound;
- }
-
- SIInterfaceInfo->State.InterfaceNumber = DESCRIPTOR_PCAST(ConfigDescriptorData,
- USB_Descriptor_Interface_t)->InterfaceNumber;
-
while (!(DataINEndpoint) || !(DataOUTEndpoint))
{
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
+ if (!(StillImageInterface) ||
+ USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_SI_Host_NextSIInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
- DataINEndpoint = NULL;
- DataOUTEndpoint = NULL;
- EventsEndpoint = NULL;
-
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_SI_Host_NextSIInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
return SI_ENUMERROR_NoCompatibleInterfaceFound;
}
- SIInterfaceInfo->State.InterfaceNumber = DESCRIPTOR_PCAST(ConfigDescriptorData,
- USB_Descriptor_Interface_t)->InterfaceNumber;
+ StillImageInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
+
+ DataINEndpoint = NULL;
+ DataOUTEndpoint = NULL;
+ EventsEndpoint = NULL;
continue;
}
@@ -123,7 +115,9 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
}
}
+ SIInterfaceInfo->State.InterfaceNumber = StillImageInterface->InterfaceNumber;
SIInterfaceInfo->State.IsActive = true;
+
return SI_ENUMERROR_NoError;
}