USB audio: Fix function of Selector Unit control

* restore function of Selector Unit that was previously disabled;
* fix Selector Unit input pin names "Unknwon" case.
This commit is contained in:
Siarzhuk Zharski 2013-07-17 07:12:00 +02:00
parent a8066fe34a
commit 353a4e04d1
2 changed files with 20 additions and 5 deletions

View File

@ -472,7 +472,7 @@ FeatureUnit::Name()
{
// first check if source of this FU is an input terminal
_AudioControl* control = fInterface->Find(fSourceID);
while (control != 0) {
while (control != NULL) {
if (control->SubType() != USB_AUDIO_AC_INPUT_TERMINAL)
break;
@ -486,7 +486,7 @@ FeatureUnit::Name()
// check if output of this FU is connected to output terminal
control = fInterface->FindOutputTerminal(fID);
while (control != 0) {
while (control != NULL) {
if (control->SubType() != USB_AUDIO_AC_OUTPUT_TERMINAL)
break;
@ -498,6 +498,13 @@ FeatureUnit::Name()
return control->Name();
}
// otherwise get the generic name of this FU's source
control = fInterface->Find(fSourceID);
if (control != NULL && control->Name() != NULL
&& strlen(control->Name()) > 0)
return control->Name();
// I have no more ideas, have you one?
return "Unknown";
}
@ -1103,7 +1110,7 @@ AudioControlInterface::_HarvestRecordFeatureUnits(_AudioControl* rootControl,
switch(rootControl->SubType()) {
case USB_AUDIO_AC_OUTPUT_TERMINAL:
// _HarvestRecordFeatureUnits(Find(rootControl->SourceID()), Map);
_HarvestRecordFeatureUnits(Find(rootControl->SourceID()), Map);
break;
case USB_AUDIO_AC_SELECTOR_UNIT:
@ -1517,7 +1524,7 @@ AudioControlInterface::GetMix(multi_mix_value_info* Info)
Info->values[i].enable);
break;
case 0: // Selector Unit
Info->values[i].mux = data;
Info->values[i].mux = data - 1;
TRACE(MIX, "Selector control %d; is %d.\n",
ID_FROM_CTLID(Info->values[i].id),
Info->values[i].mux);
@ -1564,7 +1571,7 @@ AudioControlInterface::SetMix(multi_mix_value_info* Info)
Info->values[i].enable);
break;
case 0: // Selector Unit
data = Info->values[i].mux;
data = Info->values[i].mux + 1;
length = 1;
TRACE(MIX, "Selector Control %d about to set to %d.\n",
ID_FROM_CTLID(Info->values[i].id),

View File

@ -122,6 +122,8 @@ public:
MixerUnit(AudioControlInterface* interface,
usb_audiocontrol_header_descriptor* Header);
virtual ~MixerUnit();
virtual const char* Name() { return "Mixer"; }
protected:
Vector<uint8> fInputPins;
@ -138,6 +140,7 @@ public:
virtual AudioChannelCluster*
OutCluster();
virtual const char* Name() { return "Selector"; }
// protected:
Vector<uint8> fInputPins;
@ -167,6 +170,7 @@ public:
usb_audiocontrol_header_descriptor* Header);
virtual ~EffectUnit();
virtual const char* Name() { return "Effect"; }
protected:
/* uint16 fProcessType;
Vector<uint8> fInputPins;
@ -181,6 +185,8 @@ public:
usb_audiocontrol_header_descriptor* Header);
virtual ~ProcessingUnit();
virtual const char* Name() { return "Processing"; }
protected:
uint16 fProcessType;
Vector<uint8> fInputPins;
@ -195,6 +201,8 @@ public:
usb_audiocontrol_header_descriptor* Header);
virtual ~ExtensionUnit();
virtual const char* Name() { return "Extension"; }
protected:
uint16 fExtensionCode;
Vector<uint8> fInputPins;