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,40 +1105,49 @@ 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:
if(datalength == 2)
{ {
case FU_VOLUME_CONTROL: switch(unitID)
volsOut[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8); {
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); case FU_USBOUT:
return XUD_DoSetRequestStatus(ep0_in); volsOut[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8);
case FU_MUTE_CONTROL: updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
mutesOut[ sp.wValue & 0xff ] = buffer[0]; return XUD_DoSetRequestStatus(ep0_in);
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
return XUD_DoSetRequestStatus(ep0_in); case FU_USBIN:
volsIn[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8);
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
return XUD_DoSetRequestStatus(ep0_in);
}
} }
} break;
else if (unitID == FU_USBIN)
{ case FU_MUTE_CONTROL:
switch ((sp.wValue>>8) & 0xff)
if(datalength == 1)
{ {
case FU_VOLUME_CONTROL: switch(unitID)
volsIn[ sp.wValue & 0xff ] = buffer[0] | (((int) (signed char) buffer[1]) << 8); {
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl ); case FU_USBOUT:
return XUD_DoSetRequestStatus(ep0_in); mutesOut[ sp.wValue & 0xff ] = buffer[0];
case FU_MUTE_CONTROL: updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
mutesIn[ sp.wValue & 0xff ] = buffer[0]; return XUD_DoSetRequestStatus(ep0_in);
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
return XUD_DoSetRequestStatus(ep0_in); case FU_USBIN:
mutesIn[ sp.wValue & 0xff ] = buffer[0];
updateVol( unitID, ( sp.wValue & 0xff ), c_mix_ctl );
return XUD_DoSetRequestStatus(ep0_in);
}
} }
} break;
} }
break; break;
} }
case UAC_B_REQ_GET_CUR: case UAC_B_REQ_GET_CUR:
{ {