2015-03-14 7:10 GMT+01:00 Raymond Yau superquad.vortex2@gmail.com:
> >> > > > >> > > > amixer: Control hw:2 element read error: Invalid argument > >> > > > usb 1-1.3: 10:0: cannot get min/max values for control 3
(id 10)
> >> > > > usb 1-1.3: 2:1: cannot get freq at ep 0x1 > > numid=5,iface=MIXER,name='PCM Volume' ;
type=INTEGER,access=rw------,values=2,min=0,max=1,step=0 amixer: Control hw:2 element read error: Invalid argument
> > numid=6,iface=MIXER,name='PCM Volume',index=1 ;
type=INTEGER,access=rw------,values=1,min=0,max=1,step=0 amixer: Control hw:2 element read error: Invalid argument
> > numid=7,iface=MIXER,name='PCM Volume',index=2 ;
type=INTEGER,access=rw------,values=1,min=0,max=1,step=0 amixer: Control hw:2 element read error: Invalid argument
> > numid=8,iface=MIXER,name='PCM Volume',index=3 ;
type=INTEGER,access=rw------,values=1,min=0,max=1,step=0 amixer: Control hw:2 element read error: Invalid argument
> > numid=9,iface=MIXER,name='PCM Volume',index=4 ;
type=INTEGER,access=rw------,values=1,min=0,max=1,step=0 amixer: Control hw:2 element read error: Invalid argument
>
In case this can be of any useful info, in the form of unknown controls
reported by the lsusb output, manufacturer software in other OS has controls for:
- dolby surround activation (off and on).
- microphone input volume (which works fine now) in snd_usb_audio
- microphone input "compression" (supposedly to keep input within
certain non distorting levels)
- input noise reduction (off and on too)
- micro retro feedback volume
- equalizer.
You need to find out the terminals of two inputs if you want to know the function of this mixer unit
bUnitID 10 bNrInPins 2 baSourceID( 0) 9 baSourceID( 1) 1
There are debug output in the system log when you compiled the driver with debug option
usb_audio_dbg(state->chip, "[%d] MU [%s] ch = %d, val = %d/%d\n", cval->head.id, kctl->id.name, cval->channels, cval->min, cval->max);
Is the suffix "Volume" correct since it may be just a mute switch ?
3.13.4 Mixer Unit The Mixer Unit (MU) transforms a number of logical input channels into a number of logical output channels. The input channels are grouped into one or more audio channel clusters. Each cluster enters the Mixer Unit through an Input Pin. The logical output channels are grouped into one audio channel cluster and leave the Mixer Unit through a single Output Pin. Every input channel can virtually be mixed into all of the output channels. If n is the total number of input ixer channels and m is the number of output channels, then there is a two-dimensional array (n · m) of M Controls in the Mixer Unit.
Not all of these Controls have to be physically implemented. Some Controls can have a fixed setting and be non-programmable.
The Mixer Unit Descriptor reports which Controls are programmable in the bmControls bitmap field. Using this model, a permanent connection can be implemente d by reporting the Control as non-programmable in the bmControls bitmap and by returning a nnection can be implemented by Control setting of 0 dB when requested. Likewise, a missing (muting) co reporting the Control as non-programmable in the bmControls bitmap and by returning a Control setting of –∞ dB. A Mixer Unit MUST respond to the appropriate Get Request to allow the Host to retrieve the actual settings on each of the (n · m) Mixer Controls.
4.7.2.6 Mixer Unit Descriptor
The bmMixerControls field stores the bit array row after row where the MSb of the first byte corresponds to the connection between input channel 1 and output channel 1. If (n · m) is not an integer multiple of 8, the bit array is padded with zeros until an integer number of bytes is occupied.
The number of bytes used to store the bit array, N, can be calculated as follows: IF ((n * m) MOD 8) <> 0 THEN N = ((n * m) DIV 8) + 1 ELSE N = ((n * m) DIV 8)
The bmControls field contains a set of bit pairs, indicating which Controls are present and what their capabilities are. If a Control is present, it must be Host readable. If a certain Control is not present then the bit pair must be set to 0b00. If a Control is present but read-only, the bit pair must be set to 0b01. If a Control is also Host programmable, the bit pair must be set to 0b11. The value 0b10 is not allowed.
For uac2
At location 11 + p + N
D1..0: Cluster Control D3..2: Underflow Control D5..4: Overflow Control D7..6: Reserved. Must be set to 0.
static void build_mixer_unit_ctl(struct mixer_build *state, struct uac_mixer_unit_descriptor *desc, int in_pin, int in_ch, int unitid, struct usb_audio_term *iterm) { struct usb_mixer_elem_info *cval; unsigned int num_outs = uac_mixer_unit_bNrChannels(desc); unsigned int i, len; struct snd_kcontrol *kctl; const struct usbmix_name_map *map;
map = find_map(state, unitid, 0); if (check_ignored_ctl(map)) return;
cval = kzalloc(sizeof(*cval), GFP_KERNEL); if (!cval) return;
snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid); cval->control = in_ch + 1; /* based on 1 */ cval->val_type = USB_MIXER_S16; for (i = 0; i < num_outs; i++) { __u8 *c = uac_mixer_unit_bmControls(desc, state->mixer->protocol);
if (check_matrix_bitmap(c, in_ch, i, num_outs)) { cval->cmask |= (1 << i); cval->channels++; } }
/* get min/max values */ get_min_max(cval, 0);
kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval); if (!kctl) { usb_audio_err(state->chip, "cannot malloc kcontrol\n"); kfree(cval); return; } kctl->private_free = snd_usb_mixer_elem_free;
len = check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name)); if (!len) len = get_term_name(state, iterm, kctl->id.name, sizeof(kctl->id.name), 0); if (!len) len = sprintf(kctl->id.name, "Mixer Source %d", in_ch + 1); append_ctl_name(kctl, " Volume");
usb_audio_dbg(state->chip, "[%d] MU [%s] ch = %d, val = %d/%d\n", cval->head.id, kctl->id.name, cval->channels, cval->min, cval->max); snd_usb_mixer_add_control(&cval->head, kctl); }
Hello,
The device has 3 inputs as you will see in the picture I attach.
Two analog inputs and 1 digital:
* Analog micro * Analog headphones * USB input <-- This is how the headphones are plugged to have dolby surround enabled and some of illuminations settings (the headphones can have multiple illumination colors, I mention this as means to be able to identify possible unknown switches the device may have).
--
I also tried with your mixer.c modifications and definetly my knowledge right now is not enough to get it to compile correctly, even under 4.0rc3 kernel, dumps many errors: In file included from include/linux/usb.h:18:0, from sound/usb/mixer.c:50: sound/usb/mixer.c: In function ‘build_mixer_unit_ctl’: sound/usb/mixer.c:1536:61: error: ‘ich’ undeclared (first use in this function) usb_audio_info(state->chip, " bmControls [%d,%d] : %x\n", ich, och, *c); ^ include/linux/device.h:1107:58: note: in definition of macro ‘dev_info’ #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) ^ sound/usb/mixer.c:1536:3: note: in expansion of macro ‘usb_audio_info’ usb_audio_info(state->chip, " bmControls [%d,%d] : %x\n", ich, och, *c); ^ sound/usb/mixer.c:1536:61: note: each undeclared identifier is reported only once for each function it appears in usb_audio_info(state->chip, " bmControls [%d,%d] : %x\n", ich, och, *c); ^ include/linux/device.h:1107:58: note: in definition of macro ‘dev_info’ #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) ^ sound/usb/mixer.c:1536:3: note: in expansion of macro ‘usb_audio_info’ usb_audio_info(state->chip, " bmControls [%d,%d] : %x\n", ich, och, *c); ^ sound/usb/mixer.c:1536:66: error: ‘och’ undeclared (first use in this function) usb_audio_info(state->chip, " bmControls [%d,%d] : %x\n", ich, och, *c); ^ include/linux/device.h:1107:58: note: in definition of macro ‘dev_info’ #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) ^ sound/usb/mixer.c:1536:3: note: in expansion of macro ‘usb_audio_info’ usb_audio_info(state->chip, " bmControls [%d,%d] : %x\n", ich, och, *c); ^ sound/usb/mixer.c: In function ‘parse_audio_mixer_unit’: sound/usb/mixer.c:1616:6: error: ‘ich_has_control’ undeclared (first use in this function) ich_has_control = 0; ^ sound/usb/mixer.c:1619:8: error: ‘ich_has_controls’ undeclared (first use in this function) if (ich_has_controls) ^ sound/usb/mixer.c: At top level: sound/usb/mixer.c:1623:2: error: expected identifier or ‘(’ before ‘}’ token } ^ sound/usb/mixer.c:1624:2: error: expected identifier or ‘(’ before ‘return’ return 0; ^ sound/usb/mixer.c:1625:1: error: expected identifier or ‘(’ before ‘}’ token } ^ sound/usb/mixer.c: In function ‘parse_audio_mixer_unit’: sound/usb/mixer.c:1622:3: warning: control reaches end of non-void function [-Wreturn-type] } ^
Should you need anything else I'll try my best.