X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/0bf5064aec5ac43ba2b25d44528bebb27db2f117..21a012a018221fd1e55b8b054d09d7900ed9fd79:/LUFA/Drivers/USB/Class/Host/Audio.c diff --git a/LUFA/Drivers/USB/Class/Host/Audio.c b/LUFA/Drivers/USB/Class/Host/Audio.c index 0da1eb664..1d590e841 100644 --- a/LUFA/Drivers/USB/Class/Host/Audio.c +++ b/LUFA/Drivers/USB/Class/Host/Audio.c @@ -51,18 +51,19 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) return AUDIO_ENUMERROR_InvalidConfigDescriptor; - while (!(DataINEndpoint) || !(DataOUTEndpoint)) + while ((AudioInterfaceInfo->Config.DataINPipeNumber && !(DataINEndpoint)) || + (AudioInterfaceInfo->Config.DataOUTPipeNumber && !(DataOUTEndpoint))) { if (!(AudioControlInterface) || USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_NextAudioInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_Audio_Host_NextAudioInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { if (!(AudioControlInterface) || USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_Audio_Host_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found) { if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_Audio_Host_NextAudioControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return AUDIO_ENUMERROR_NoCompatibleInterfaceFound; } @@ -70,13 +71,16 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa AudioControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - DComp_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found) + DCOMP_Audio_Host_NextAudioStreamInterface) != DESCRIPTOR_SEARCH_COMP_Found) { return AUDIO_ENUMERROR_NoCompatibleInterfaceFound; } } AudioStreamingInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t); + + DataINEndpoint = NULL; + DataOUTEndpoint = NULL; continue; } @@ -102,7 +106,7 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa Size = DataINEndpoint->EndpointSize; EndpointAddress = DataINEndpoint->EndpointAddress; Token = PIPE_TOKEN_IN; - Type = EP_TYPE_BULK; + Type = EP_TYPE_ISOCHRONOUS; DoubleBanked = true; AudioInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize; @@ -137,7 +141,7 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa return AUDIO_ENUMERROR_NoError; } -static uint8_t DComp_NextAudioControlInterface(void* CurrentDescriptor) +static uint8_t DCOMP_Audio_Host_NextAudioControlInterface(void* CurrentDescriptor) { USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); @@ -156,7 +160,7 @@ static uint8_t DComp_NextAudioControlInterface(void* CurrentDescriptor) return DESCRIPTOR_SEARCH_NotFound; } -static uint8_t DComp_NextAudioStreamInterface(void* CurrentDescriptor) +static uint8_t DCOMP_Audio_Host_NextAudioStreamInterface(void* CurrentDescriptor) { USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); @@ -175,7 +179,7 @@ static uint8_t DComp_NextAudioStreamInterface(void* CurrentDescriptor) return DESCRIPTOR_SEARCH_NotFound; } -static uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor) +static uint8_t DCOMP_Audio_Host_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor) { USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); @@ -195,7 +199,7 @@ static uint8_t DComp_NextAudioInterfaceDataEndpoint(void* CurrentDescriptor) } uint8_t Audio_Host_StartStopStreaming(USB_ClassInfo_Audio_Host_t* const AudioInterfaceInfo, - bool EnableStreaming) + const bool EnableStreaming) { if (!(AudioInterfaceInfo->State.IsActive)) return HOST_SENDCONTROL_DeviceDisconnected; @@ -208,16 +212,19 @@ uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInte const uint8_t DataPipeIndex, const uint8_t EndpointProperty, const uint8_t EndpointControl, - uint16_t const DataLength, - uint8_t* Data) + const uint16_t DataLength, + void* const Data) { + if (!(AudioInterfaceInfo->State.IsActive)) + return HOST_SENDCONTROL_DeviceDisconnected; + uint8_t RequestType; uint8_t EndpointAddress; - + if (EndpointProperty & 0x80) - RequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE); + RequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT); else - RequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE); + RequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT); Pipe_SelectPipe(DataPipeIndex); EndpointAddress = Pipe_GetBoundEndpointAddress(); @@ -233,7 +240,7 @@ uint8_t Audio_GetSetEndpointProperty(USB_ClassInfo_Audio_Host_t* const AudioInte Pipe_SelectPipe(PIPE_CONTROLPIPE); - return USB_Host_SendControlRequest(Data); + return USB_Host_SendControlRequest(Data); } #endif