EP0 changed to use switch statement when handling USB_SET_INTERFACE requests
This commit is contained in:
@@ -268,9 +268,10 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
/* Over-riding USB_StandardRequests implementation */
|
||||
if(sp.bRequest == USB_SET_INTERFACE)
|
||||
{
|
||||
/* Check for audio stream from host start/stop */
|
||||
if(sp.wIndex == 1) /* Output interface */
|
||||
switch (sp.wIndex)
|
||||
{
|
||||
/* Check for audio stream from host start/stop */
|
||||
case INTERFACE_NUMBER_AUDIO_OUTPUT:
|
||||
/* Check the alt is in range */
|
||||
if(sp.wValue <= OUTPUT_FORMAT_COUNT)
|
||||
{
|
||||
@@ -301,9 +302,8 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
chkct(c_audioControl, XS1_CT_END);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(sp.wIndex == 2) /* Input interface */
|
||||
{
|
||||
break;
|
||||
case INTERFACE_NUMBER_AUDIO_INPUT:
|
||||
/* Check the alt is in range */
|
||||
if(sp.wValue <= INPUT_FORMAT_COUNT)
|
||||
{
|
||||
@@ -334,7 +334,16 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
chkct(c_audioControl, XS1_CT_END);
|
||||
}
|
||||
}
|
||||
break;
|
||||
{
|
||||
|
||||
default:
|
||||
/* Unhandled interface */
|
||||
break;
|
||||
}
|
||||
|
||||
if ((sp.wIndex == INTERFACE_NUMBER_AUDIO_OUTPUT) || (sp.wIndex == INTERFACE_NUMBER_AUDIO_INPUT))
|
||||
{
|
||||
#if (NUM_USB_CHAN_OUT > 0) && (NUM_USB_CHAN_IN > 0)
|
||||
/* Check for stream start stop on output and input audio interfaces */
|
||||
if(sp.wValue && !g_interfaceAlt[1] && !g_interfaceAlt[2])
|
||||
@@ -364,6 +373,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
UserAudioStreamStop();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} /* if(sp.bRequest == SET_INTERFACE) */
|
||||
|
||||
break; /* BMREQ_H2D_STANDARD_INT */
|
||||
|
||||
Reference in New Issue
Block a user