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
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;
}
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel