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