From: "thomas@devbase.at" <thomas@devbase.at>
To: alsa-devel@alsa-project.org
Subject: [PATCH] Coping with short replies in usbmixer
Date: Fri, 11 May 2007 22:28:16 +0200 [thread overview]
Message-ID: <4644D1E0.2010203@devbase.at> (raw)
[-- Attachment #1: Type: text/plain, Size: 912 bytes --]
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
[-- Attachment #2: usbmixer.patch --]
[-- Type: text/x-patch, Size: 556 bytes --]
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;
}
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next reply other threads:[~2007-05-11 20:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-11 20:28 thomas [this message]
2007-05-14 9:10 ` [PATCH] Coping with short replies in usbmixer Takashi Iwai
-- 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=4644D1E0.2010203@devbase.at \
--to=thomas@devbase.at \
--cc=alsa-devel@alsa-project.org \
/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).