Hi, I'd been struggling with a UAC2 device that I couldn't set the clock on. I finally got in touch with a driver author who pointed me to some official documentation (the USB Device Class Definition for Audio Devices). Where the ALSA code always sends a 16-bit packet to control mixer settings, the docs say that the clock selector control uses layout 1 which is 8-bit. By changing the routine to send an 8-bit packet, that control now works.
This is the patch that fixes the problem for me (for ALSA 1.0.25). Is this proper?
--- a/linux-3.4/sound/usb/mixer.c 2012-05-20 15:29:13.000000000 -0700 +++ b/vanilla-3.4/sound/usb/mixer.c 2013-01-02 17:06:11.009660059 -0800 @@ -422,8 +422,13 @@ if (cval->mixer->protocol == UAC_VERSION_1) { val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; } else { /* UAC_VERSION_2 */ - /* audio class v2 controls are always 2 bytes in size */ - val_len = sizeof(__u16); + /* audio class v2 controls are often but not always 2 bytes in size */ + /* For example, the clock selector (see 5.2.5.2.1 in the Universal Serial + * Bus Device Class Definition for Audio Devices document) */ + if (cval->control == UAC2_CX_CLOCK_SELECTOR) + val_len = sizeof(__u8); + else + val_len = sizeof(__u16);
/* FIXME */ if (request != UAC_SET_CUR) {
Thanks much! Louis