Resolved issue when UAC1 Set mute was being stalled due to bad data length check

This commit is contained in:
Ross Owen
2014-04-03 12:24:22 +01:00
parent 74013e076e
commit f1f247d281

View File

@@ -1105,38 +1105,47 @@ int AudioClassRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c
return result; return result;
} }
if(datalength == 2)
{
unitID = sp.wIndex >> 8; unitID = sp.wIndex >> 8;
if (unitID == FU_USBOUT)
{
switch ((sp.wValue>>8) & 0xff) switch ((sp.wValue>>8) & 0xff)
{ {
case FU_VOLUME_CONTROL: case FU_VOLUME_CONTROL:
if(datalength == 2)
{
switch(unitID)
{
case FU_USBOUT:
volsOut[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8); volsOut[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8);
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
return XUD_DoSetRequestStatus(ep0_in); return XUD_DoSetRequestStatus(ep0_in);
case FU_MUTE_CONTROL:
mutesOut[ sp.wValue & 0xff ] = buffer[0]; case FU_USBIN:
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
return XUD_DoSetRequestStatus(ep0_in);
}
}
else if (unitID == FU_USBIN)
{
switch ((sp.wValue>>8) & 0xff)
{
case FU_VOLUME_CONTROL:
volsIn[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8); volsIn[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8);
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
return XUD_DoSetRequestStatus(ep0_in); return XUD_DoSetRequestStatus(ep0_in);
}
}
break;
case FU_MUTE_CONTROL: case FU_MUTE_CONTROL:
if(datalength == 1)
{
switch(unitID)
{
case FU_USBOUT:
mutesOut[ sp.wValue & 0xff ] = buffer[0];
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
return XUD_DoSetRequestStatus(ep0_in);
case FU_USBIN:
mutesIn[ sp.wValue & 0xff ] = buffer[0]; mutesIn[ sp.wValue & 0xff ] = buffer[0];
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
return XUD_DoSetRequestStatus(ep0_in); return XUD_DoSetRequestStatus(ep0_in);
} }
} }
break;
} }
break; break;
} }