[alsa-devel] [PATCH v3] ALSA: snd-usb-audio: set the timeout for usb control set messages to 5000 ms
This is an other version of the patch send via git send-email. I still distinguish between set and get but as long both are 5000 ms GCC will remove it anyway. IMHO this is more easy read and there is no need to explain why we use a get timeout for set messages.
Commit message: Set the timeout for USB control set messages according to the USB 2 spec, using the macros from include/linux/usb.h. The get timout becomes 5000 ms even though it is 500 ms in the spec. This patch is required to run the Hercules RMX2 which needs a timeout of 1240 ms.
Signed-off-by: Daniel Schürmann daschuer@mixxx.org --- sound/usb/helper.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sound/usb/helper.c b/sound/usb/helper.c index c1db28f..6209024 100644 --- a/sound/usb/helper.c +++ b/sound/usb/helper.c @@ -86,14 +86,22 @@ int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request, { int err; void *buf = NULL; + int timeout;
if (size > 0) { buf = kmemdup(data, size, GFP_KERNEL); if (!buf) return -ENOMEM; } + + if (requesttype & USB_DIR_IN) + timeout = USB_CTRL_GET_TIMEOUT; + else + timeout = USB_CTRL_SET_TIMEOUT; + err = usb_control_msg(dev, pipe, request, requesttype, - value, index, buf, size, 1000); + value, index, buf, size, timeout); + if (size > 0) { memcpy(data, buf, size); kfree(buf);
On 20.04.2013 23:06, Daniel Schürmann wrote:
This is an other version of the patch send via git send-email. I still distinguish between set and get but as long both are 5000 ms GCC will remove it anyway. IMHO this is more easy read and there is no need to explain why we use a get timeout for set messages.
Commit message:
Next time, please put information that should not be part of the commit log message (such as the lines above) underneath the "---" marker. But maybe Takashi can do that when applying?
Set the timeout for USB control set messages according to the USB 2 spec, using the macros from include/linux/usb.h. The get timout becomes 5000 ms even though it is 500 ms in the spec. This patch is required to run the Hercules RMX2 which needs a timeout of 1240 ms.
Signed-off-by: Daniel Schürmann daschuer@mixxx.org
Acked-by: Daniel Mack zonque@gmail.com
sound/usb/helper.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sound/usb/helper.c b/sound/usb/helper.c index c1db28f..6209024 100644 --- a/sound/usb/helper.c +++ b/sound/usb/helper.c @@ -86,14 +86,22 @@ int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request, { int err; void *buf = NULL;
int timeout;
if (size > 0) { buf = kmemdup(data, size, GFP_KERNEL); if (!buf) return -ENOMEM; }
if (requesttype & USB_DIR_IN)
timeout = USB_CTRL_GET_TIMEOUT;
else
timeout = USB_CTRL_SET_TIMEOUT;
err = usb_control_msg(dev, pipe, request, requesttype,
value, index, buf, size, 1000);
value, index, buf, size, timeout);
- if (size > 0) { memcpy(data, buf, size); kfree(buf);
At Sat, 20 Apr 2013 23:06:17 +0200, Daniel Schürmann wrote:
This is an other version of the patch send via git send-email. I still distinguish between set and get but as long both are 5000 ms GCC will remove it anyway. IMHO this is more easy read and there is no need to explain why we use a get timeout for set messages.
Commit message: Set the timeout for USB control set messages according to the USB 2 spec, using the macros from include/linux/usb.h. The get timout becomes 5000 ms even though it is 500 ms in the spec. This patch is required to run the Hercules RMX2 which needs a timeout of 1240 ms.
Signed-off-by: Daniel Schürmann daschuer@mixxx.org
Thanks, I applied this with additional note in the commit message as Daniel (M) suggested.
Takashi
sound/usb/helper.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sound/usb/helper.c b/sound/usb/helper.c index c1db28f..6209024 100644 --- a/sound/usb/helper.c +++ b/sound/usb/helper.c @@ -86,14 +86,22 @@ int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request, { int err; void *buf = NULL;
int timeout;
if (size > 0) { buf = kmemdup(data, size, GFP_KERNEL); if (!buf) return -ENOMEM; }
if (requesttype & USB_DIR_IN)
timeout = USB_CTRL_GET_TIMEOUT;
else
timeout = USB_CTRL_SET_TIMEOUT;
err = usb_control_msg(dev, pipe, request, requesttype,
value, index, buf, size, 1000);
value, index, buf, size, timeout);
- if (size > 0) { memcpy(data, buf, size); kfree(buf);
-- 1.7.9.5
participants (3)
-
Daniel Mack
-
Daniel Schürmann
-
Takashi Iwai