speedtch speedtch.c,1.66,1.67
Duncan Sands
duncan at infradead.org
Fri Sep 30 04:52:06 EDT 2005
- Previous message: speedtch cxacru.c, 1.35, 1.36 speedtch.c, 1.65, 1.66 usbatm.c, 1.48,
1.49 usbatm.h, 1.20, 1.21 xusbatm.c, 1.13, 1.14
- Next message: speedtch usbatm.c,1.49,1.50 usbatm.h,1.21,1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/speedtch
In directory phoenix.infradead.org:/tmp/cvs-serv20314
Modified Files:
speedtch.c
Log Message:
We need to check for isochronous endpoints in the data interface (interface
1), rather than the interface being probed - they are usually different.
Also, fall back to bulk if the putative isochronous endpoint is not found
at all.
Index: speedtch.c
===================================================================
RCS file: /home/cvs/speedtch/speedtch.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- speedtch.c 26 Sep 2005 20:19:41 -0000 1.66
+++ speedtch.c 30 Sep 2005 08:52:03 -0000 1.67
@@ -100,6 +100,7 @@
"Enable software buffering (default: "
__MODULE_STRING(DEFAULT_SW_BUFFERING) ")");
+#define INTERFACE_DATA 1
#define ENDPOINT_INT 0x81
#define ENDPOINT_BULK_DATA 0x07
#define ENDPOINT_ISOC_DATA 0x07
@@ -284,7 +285,7 @@
because we're in our own kernel thread anyway. */
msleep_interruptible(1000);
- if ((ret = usb_set_interface(usb_dev, 1, instance->altsetting)) < 0) {
+ if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) {
usb_err(usbatm, "%s: setting interface to %d failed (%d)!\n", __func__, instance->altsetting, ret);
goto out_free;
}
@@ -504,7 +505,7 @@
default:
atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
- atm_info(usbatm, "Unknown line state %02x\n", status);
+ atm_info(usbatm, "unknown line state %02x\n", status);
break;
}
@@ -698,7 +699,7 @@
int *need_heavy_init, int *use_isoc)
{
struct usb_device *usb_dev = interface_to_usbdev(intf);
- struct usb_interface *cur_intf;
+ struct usb_interface *cur_intf, *data_intf;
struct speedtch_instance_data *instance;
int ifnum = intf->altsetting->desc.bInterfaceNumber;
int num_interfaces = usb_dev->actconfig->desc.bNumInterfaces;
@@ -706,8 +707,15 @@
usb_dbg(usbatm, "%s entered\n", __func__);
+ /* sanity checks */
+
if (usb_dev->descriptor.bDeviceClass != USB_CLASS_VENDOR_SPEC) {
- usb_dbg(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;
+ }
+
+ if (!(data_intf = usb_ifnum_to_if(usb_dev, INTERFACE_DATA))) {
+ usb_err(usbatm, "%s: data interface not found!\n", __func__);
return -ENODEV;
}
@@ -742,22 +750,24 @@
*use_isoc = enable_isoc;
if (instance->altsetting)
- if ((ret = usb_set_interface(usb_dev, 1, instance->altsetting)) < 0) {
+ if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) {
usb_err(usbatm, "%s: setting interface to %d failed (%d)!\n", __func__, instance->altsetting, ret);
instance->altsetting = 0; /* fall back to default */
}
if (!instance->altsetting && *use_isoc)
- if ((ret = usb_set_interface(usb_dev, 1, DEFAULT_ISOC_ALTSETTING)) < 0) {
+ if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_ISOC_ALTSETTING)) < 0) {
usb_dbg(usbatm, "%s: usb_set_interface %d failed (%d)!\n", __func__, DEFAULT_ISOC_ALTSETTING, ret);
*use_isoc = 0; /* fall back to bulk */
}
if (*use_isoc) {
- const struct usb_host_interface *desc = intf->cur_altsetting;
+ const struct usb_host_interface *desc = data_intf->cur_altsetting;
const __u8 target_address = USB_DIR_IN | usbatm->driver->isoc_in;
int i;
+ *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;
@@ -769,11 +779,11 @@
}
if (!*use_isoc)
- usb_info(usbatm, "%s: isochronous transfer not supported - using bulk instead!\n", __func__);
+ usb_info(usbatm, "isochronous transfer not supported - using bulk\n");
}
if (!*use_isoc && !instance->altsetting)
- if ((ret = usb_set_interface(usb_dev, 1, DEFAULT_BULK_ALTSETTING)) < 0) {
+ if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_BULK_ALTSETTING)) < 0) {
usb_err(usbatm, "%s: setting interface to %d failed (%d)!\n", __func__, DEFAULT_BULK_ALTSETTING, ret);
goto fail_free;
}
- Previous message: speedtch cxacru.c, 1.35, 1.36 speedtch.c, 1.65, 1.66 usbatm.c, 1.48,
1.49 usbatm.h, 1.20, 1.21 xusbatm.c, 1.13, 1.14
- Next message: speedtch usbatm.c,1.49,1.50 usbatm.h,1.21,1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Usbatm-commits
mailing list