[alsa-devel] [PATCH v2 08/10] ALSA: usb-audio: conditional interface altsetting

Clemens Ladisch clemens at ladisch.de
Thu Aug 22 09:01:04 CEST 2013

Eldad Zack wrote:
> This patch moves all of the alternate setting operations for pcm
> ops to one function which checks if we can do so.

> +static int get_cur_altset_idx(struct usb_device *dev, int ifnum)
> +{
> +	...
> +	return altsd->bAlternateSetting;

Please note that there are two methods to identify alternate settings:
the number, which is the value in bAlternateSetting, and the index,
which is the index in the descriptor array.  There might be some wording
in the USB spec that these two values must be the same, but in reality,
[insert standard rant about firmware writers], and bAlternateSetting
must be treated as a random ID value.

In struct audioformat, both values are stored in the altsetting and
altset_idx fields; struct usb_substream has only altset_idx.

As far as I can see, you code always uses the name altset_idx for the


More information about the Alsa-devel mailing list