Skip to contentSkip to conversation

ALSA: snd-usb-audio: set the timeout for usb control set messages to 5000 ms

PATCH In review Daniel Schürmann 3 participants 3 messages Apr 20, 2013 – Apr 22, 2013 Sound

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 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.

---
 sound/usb/helper.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
sound/usb/helper.c +9 -1
index c1db28f..6209024 100644
@@ -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);
Signature · 6 lines
1.7.9.5

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Acked-by on v3 1/1
#1 lore raw
Quoted 6 lines · Daniel Schürmann

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?

Quoted 7 lines

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.

Quoted 23 lines
---
 sound/usb/helper.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
sound/usb/helper.c +4 -0
index c1db28f..6209024 100644
@@ -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;

sound/usb/helper.c int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request, · line 107

Quoted 10 lines
sound/usb/helper.c +5 -1
+	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);

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw
In reply to Daniel Schürmann

At Sat, 20 Apr 2013 23:06:17 +0200,

Quoted 6 lines · Daniel Schürmann

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.

Quoted 8 lines

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.

Thanks, I applied this with additional note in the commit message as Daniel (M) suggested.

Takashi

Quoted 35 lines
---
 sound/usb/helper.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
sound/usb/helper.c +9 -1
index c1db28f..6209024 100644
@@ -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);
Signature · 1 line
1.7.9.5

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel