speedtch speedtch.c,1.81,1.82

Duncan Sands duncan at infradead.org
Wed Jul 11 08:36:26 EDT 2007


Update of /home/cvs/speedtch
In directory phoenix.infradead.org:/tmp/cvs-serv9858

Modified Files:
	speedtch.c 
Log Message:
Make DEFAULT_DL_512_FIRST be the default.  If the user asked for isoc
transfer but didn't get it, output an informational message saying so.
Wrap some lines, though this is still not conformant with the kernel
style.


Index: speedtch.c
===================================================================
RCS file: /home/cvs/speedtch/speedtch.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- speedtch.c	26 Oct 2006 12:53:03 -0000	1.81
+++ speedtch.c	11 Jul 2007 12:36:23 -0000	1.82
@@ -69,7 +69,7 @@
 
 #define DEFAULT_BULK_ALTSETTING	1
 #define DEFAULT_ISOC_ALTSETTING	3
-#define DEFAULT_DL_512_FIRST	0
+#define DEFAULT_DL_512_FIRST	1
 #define DEFAULT_ENABLE_ISOC	0
 #define DEFAULT_SW_BUFFERING	0
 
@@ -761,14 +761,15 @@
 	int ifnum = intf->altsetting->desc.bInterfaceNumber;
 	int num_interfaces = usb_dev->actconfig->desc.bNumInterfaces;
 	int i, ret;
-	int use_isoc;
+	int use_isoc, wanted_isoc;
 
 	usb_dbg(usbatm, "%s entered\n", __func__);
 
 	/* sanity checks */
 
 	if (usb_dev->descriptor.bDeviceClass != USB_CLASS_VENDOR_SPEC) {
-		usb_err(usbatm, "%s: wrong device class %d\n", __func__, usb_dev->descriptor.bDeviceClass);
+		usb_err(usbatm, "%s: wrong device class %d\n", __func__,
+			usb_dev->descriptor.bDeviceClass);
 		return -ENODEV;
 	}
 
@@ -786,7 +787,8 @@
 			ret = usb_driver_claim_interface(&speedtch_usb_driver, cur_intf, usbatm);
 
 			if (ret < 0) {
-				usb_err(usbatm, "%s: failed to claim interface %2d (%d)!\n", __func__, i, ret);
+				usb_err(usbatm, "%s: failed to claim interface %2d (%d)!\n",
+					__func__, i, ret);
 				speedtch_release_interfaces(usb_dev, i);
 				return ret;
 			}
@@ -809,17 +811,21 @@
 	instance->params.ModemMode = ModemMode;
 	memcpy(instance->params.ModemOption, DEFAULT_MODEM_OPTION, MODEM_OPTION_LENGTH);
 	memcpy(instance->params.ModemOption, ModemOption, num_ModemOption);
-	use_isoc = enable_isoc;
+	wanted_isoc = use_isoc = enable_isoc;
 
 	if (instance->params.altsetting)
-		if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->params.altsetting)) < 0) {
-			usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, instance->params.altsetting, ret);
+		if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA,
+					     instance->params.altsetting)) < 0) {
+			usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__,
+				instance->params.altsetting, ret);
 			instance->params.altsetting = 0; /* fall back to default */
 		}
 
 	if (!instance->params.altsetting && use_isoc)
-		if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_ISOC_ALTSETTING)) < 0) {
-			usb_dbg(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_ISOC_ALTSETTING, ret);
+		if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA,
+					     DEFAULT_ISOC_ALTSETTING)) < 0) {
+			usb_dbg(usbatm, "%s: setting interface to %2d failed (%d)!\n",
+				__func__, DEFAULT_ISOC_ALTSETTING, ret);
 			use_isoc = 0; /* fall back to bulk */
 		}
 
@@ -831,27 +837,36 @@
 		use_isoc = 0; /* fall back to bulk if endpoint not found */
 
 		for (i=0; i<desc->desc.bNumEndpoints; i++) {
-			const struct usb_endpoint_descriptor *endpoint_desc = &desc->endpoint[i].desc;
+			const struct usb_endpoint_descriptor *endpoint_desc =
+			  &desc->endpoint[i].desc;
 
 			if ((endpoint_desc->bEndpointAddress == target_address)) {
-				use_isoc = (endpoint_desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
-					USB_ENDPOINT_XFER_ISOC;
+				use_isoc = (endpoint_desc->bmAttributes &
+					    USB_ENDPOINT_XFERTYPE_MASK) ==
+				  USB_ENDPOINT_XFER_ISOC;
 				break;
 			}
 		}
 
 		if (!use_isoc)
-			usb_info(usbatm, "isochronous transfer not supported - using bulk\n");
+			usb_dbg(usbatm, "%s: isochronous endpoint not found\n", __func__);
 	}
 
 	if (!use_isoc && !instance->params.altsetting)
-		if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_BULK_ALTSETTING)) < 0) {
-			usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_BULK_ALTSETTING, ret);
+		if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA,
+					     DEFAULT_BULK_ALTSETTING)) < 0) {
+			usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__,
+				DEFAULT_BULK_ALTSETTING, ret);
 			goto fail_free;
 		}
 
 	if (!instance->params.altsetting)
-		instance->params.altsetting = use_isoc ? DEFAULT_ISOC_ALTSETTING : DEFAULT_BULK_ALTSETTING;
+		instance->params.altsetting = use_isoc ? DEFAULT_ISOC_ALTSETTING :
+		  DEFAULT_BULK_ALTSETTING;
+
+	if (wanted_isoc && !use_isoc)
+		usb_info(usbatm, "%s: failed to activate isochronous transfer - using bulk\n",
+			 __func__);
 
 	usbatm->flags |= (use_isoc ? UDSL_USE_ISOC : 0);
 
@@ -883,7 +898,8 @@
 
 	usbatm->flags |= (ret == SIZE_7 ? UDSL_SKIP_HEAVY_INIT : 0);
 
-	usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, usbatm->flags & UDSL_SKIP_HEAVY_INIT ? "already" : "not");
+	usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, usbatm->flags &
+		UDSL_SKIP_HEAVY_INIT ? "already" : "not");
 
 	if (!(usbatm->flags & UDSL_SKIP_HEAVY_INIT))
 		if ((ret = usb_reset_device(usb_dev)) < 0) {
@@ -891,7 +907,7 @@
 			goto fail_free;
 		}
 
-        usbatm->driver_data = instance;
+	usbatm->driver_data = instance;
 
 	return 0;
 




More information about the Usbatm-commits mailing list