alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] UAC2 clock selector - fixed?
@ 2013-01-03  1:01 Louis Gorenfeld
  2013-02-03 15:31 ` Daniel Mack
  0 siblings, 1 reply; 2+ messages in thread
From: Louis Gorenfeld @ 2013-01-03  1:01 UTC (permalink / raw)
  To: alsa-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] UAC2 clock selector - fixed?
  2013-01-03  1:01 [PATCH] UAC2 clock selector - fixed? Louis Gorenfeld
@ 2013-02-03 15:31 ` Daniel Mack
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Mack @ 2013-02-03 15:31 UTC (permalink / raw)
  To: Louis Gorenfeld; +Cc: alsa-devel

On 03.01.2013 02:01, Louis Gorenfeld wrote:
> 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?

Sorry for the late reply!

> --- 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);

This seems about right. Please provide a proper patch with your
Signed-off-by line (see Documentantation/SubmittingPatches for details).

You can add my Acked-by: right away when posting.


Thanks a lot,
Daniel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-03 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-03  1:01 [PATCH] UAC2 clock selector - fixed? Louis Gorenfeld
2013-02-03 15:31 ` Daniel Mack

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).