Re: CDC-ACM driver: acm_set_control should be optional

Joris van Rantwijk <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
According to the USB CDC class specification, line state control
is an optional feature for ACM devices. However, the cdc-acm driver
bails out when acm_set_control() fails while opening the device.

The proposed patch changes that behaviour: Failure of acm_set_control
is now only considered an error if the device is advertising the line
control feature in its capability mask.

Signed-off-by: Joris van Rantwijk <[email protected]>


diff -ur -U5 linux-2.6.19.2-orig/drivers/usb/class/cdc-acm.c linux-2.6.19.2/drivers/usb/class/cdc-acm.c
--- linux-2.6.19.2-orig/drivers/usb/class/cdc-acm.c	2007-01-10 20:10:37.000000000 +0100
+++ linux-2.6.19.2/drivers/usb/class/cdc-acm.c	2007-02-01 21:07:36.000000000 +0100
@@ -465,11 +465,12 @@
 	if (usb_submit_urb(acm->ctrlurb, GFP_KERNEL)) {
 		dbg("usb_submit_urb(ctrl irq) failed");
 		goto bail_out;
 	}
 
-	if (0 > acm_set_control(acm, acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS))
+	if (0 > acm_set_control(acm, acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS) &&
+	    (acm->ctrl_caps & ACM_CTRL_CAP_LINE))
 		goto full_bailout;
 
 	INIT_LIST_HEAD(&acm->spare_read_urbs);
 	INIT_LIST_HEAD(&acm->spare_read_bufs);
 	INIT_LIST_HEAD(&acm->filled_read_bufs);
diff -ur -U5 linux-2.6.19.2-orig/drivers/usb/class/cdc-acm.h linux-2.6.19.2/drivers/usb/class/cdc-acm.h
--- linux-2.6.19.2-orig/drivers/usb/class/cdc-acm.h	2007-01-10 20:10:37.000000000 +0100
+++ linux-2.6.19.2/drivers/usb/class/cdc-acm.h	2007-02-01 21:06:24.000000000 +0100
@@ -45,10 +45,13 @@
 
 #define ACM_CTRL_FRAMING	0x10
 #define ACM_CTRL_PARITY		0x20
 #define ACM_CTRL_OVERRUN	0x40
 
+#define ACM_CTRL_CAP_LINE	0x02
+#define ACM_CTRL_CAP_BRK	0x04
+
 /*
  * Internal driver structures.
  */
 
 /*

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.