alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "thomas@devbase.at" <thomas@devbase.at>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] Coping with short replies in usbmixer
Date: Mon, 14 May 2007 11:10:25 +0200	[thread overview]
Message-ID: <s5hlkfrhita.wl%tiwai@suse.de> (raw)
In-Reply-To: <4644D1E0.2010203@devbase.at>

At Fri, 11 May 2007 22:28:16 +0200,
thomas@devbase.at wrote:
> 
> Hi,
> while trying to find out why a USB handset (Yealink P1K) frequently gets 
> muted when changing volume, I found that short USB responses cause the 
> problem.
> 
> The function get_ctl_value(..) in usbmixer.c requests the state of a 
> certain control and retries up to 10 times if an error occurs. However a 
> short USB response is not treated as an error as neither the transfer 
> flag URB_SHORT_NOT_OK is set nor is the return value of 
> snd_usb_ctl_msg(..) compared with the requested amount of data. As a 
> result the function get_ctl_value(..) might not retry the USB request 
> but returns an unpredictable result without reporting an error.
> 
> The attached patch forces the number of returned bytes to be at least 
> val_len. It was generated from kernel version 2.6.21. If there are any 
> issues with the patch please let me know. Otherwise I would be happy if 
> it could be applied to the ALSA sources.
> Regards,
> -Thomas

Thanks, the patch looks good.
Could you give a sign-off to merge to the upstream?


Takashi

> [2 usbmixer.patch <text/x-patch (7bit)>]
> diff -rup a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
> --- a/sound/usb/usbmixer.c	2007-05-11 21:58:33.000000000 +0200
> +++ b/sound/usb/usbmixer.c	2007-05-11 21:59:14.000000000 +0200
> @@ -360,7 +360,7 @@ static int get_ctl_value(struct usb_mixe
>  				    request,
>  				    USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
>  				    validx, cval->mixer->ctrlif | (cval->id << 8),
> -				    buf, val_len, 100) >= 0) {
> +				    buf, val_len, 100) >= val_len) {
>  			*value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len));
>  			return 0;
>  		}
> [3  <text/plain; us-ascii (7bit)>]
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2007-05-14  9:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-11 20:28 [PATCH] Coping with short replies in usbmixer thomas
2007-05-14  9:10 ` Takashi Iwai [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-05-14 17:54 Thomas Reitmayr
2007-05-15 10:40 ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hlkfrhita.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=thomas@devbase.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).