This fixes the problem Holger had with his Zaurus, and adds some more class declarations to the <linux/usb_cdc.h> headers. Please merge.
- Dave
This patch resolves a recent problem with the Zaurus C-860 support. A change to correct handling of Zaurii that are lying about their support for the "CDC Ethernet" class specification broke the C-860, which tells an entirely different lie (that it supports "CDC MDLM", providing access to a cell phone modem). The code expecting it to be telling a lie about CDC Ethernet support naturally misbehaved. (Sharp should straighten out its story. The 2.6 OpenZaurus kernels don't have any such issues...) The fix is just to recognize this bogus MDLM stuff and ignore it. This patch also includes the two MDLM descriptors in <linux/usb_cdc.h> although they're not currently used. Signed-off-by: David Brownell <[EMAIL PROTECTED]> --- 1.125/drivers/usb/net/usbnet.c 2005-02-11 11:59:39 -08:00 +++ edited/drivers/usb/net/usbnet.c 2005-03-04 13:42:57 -08:00 @@ -2316,11 +2316,17 @@ * For the current version of that driver, the main way that framing is * nonstandard (also from perspective of the CDC ethernet model!) is a * crc32, added to help detect when some sa1100 usb-to-memory DMA errata - * haven't been fully worked around. + * haven't been fully worked around. Also, all Zaurii use the same + * default Ethernet address. * * PXA based models use the same framing, and also can't implement * set_interface properly. * + * All known Zaurii lie about their standards conformance. Most lie by + * saying they support CDC Ethernet. Some lie and say they support CDC + * MDLM (as if for access to cell phone modems). Someone, please beat + * on Sharp for a while with a cluestick. + * *-------------------------------------------------------------------------*/ static struct sk_buff * @@ -2372,6 +2378,13 @@ }; #define ZAURUS_PXA_INFO ((unsigned long)&zaurus_pxa_info) +static const struct driver_info zaurus_pxa_mdlm_info = { + .description = "Sharp Zaurus, PXA-255 based", + .flags = FLAG_FRAMING_Z, + .check_connect = always_connected, + .tx_fixup = zaurus_tx_fixup, +}; + static const struct driver_info olympus_mxl_info = { .description = "Olympus R1000", .flags = FLAG_FRAMING_Z, @@ -3557,6 +3570,7 @@ * Same idea as above, but different framing. * * PXA-2xx based models are also lying-about-cdc. + * Some models don't even tell the same lies ... * * NOTE: OpenZaurus versions with 2.6 kernels won't use these entries, * unlike the older ones with 2.4 "embedix" kernels. @@ -3614,9 +3628,25 @@ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | USB_DEVICE_ID_MATCH_DEVICE, .idVendor = 0x04DD, + /* reported with some C860 units */ .idProduct = 0x9050, /* C-860 */ ZAURUS_MASTER_INTERFACE, .driver_info = ZAURUS_PXA_INFO, +#ifdef CONFIG_USB_ZAURUS + /* at least some (reports vary) C-860 units have very different + * lies about their standards support. + */ +}, { + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO + | USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = 0x04DD, + /* reported with some C860 units */ + .idProduct = 0x9031, /* C-860 */ + .bInterfaceClass = USB_CLASS_COMM, + .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, + .bInterfaceProtocol = USB_CDC_PROTO_NONE, + .driver_info = (unsigned long) &zaurus_pxa_mdlm_info, +#endif }, /* Olympus has some models with a Zaurus-compatible option. --- 1.1/include/linux/usb_cdc.h 2005-02-03 20:52:58 -08:00 +++ edited/include/linux/usb_cdc.h 2005-03-04 13:27:54 -08:00 @@ -6,8 +6,12 @@ * firmware based USB peripherals. */ -#define USB_CDC_SUBCLASS_ACM 2 -#define USB_CDC_SUBCLASS_ETHERNET 6 +#define USB_CDC_SUBCLASS_ACM 0x02 +#define USB_CDC_SUBCLASS_ETHERNET 0x06 +#define USB_CDC_SUBCLASS_WHCM 0x08 +#define USB_CDC_SUBCLASS_DMM 0x09 +#define USB_CDC_SUBCLASS_MDLM 0x0a +#define USB_CDC_SUBCLASS_OBEX 0x0b #define USB_CDC_PROTO_NONE 0 @@ -31,6 +35,11 @@ #define USB_CDC_UNION_TYPE 0x06 /* union_desc */ #define USB_CDC_COUNTRY_TYPE 0x07 #define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ +#define USB_CDC_WHCM_TYPE 0x11 +#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ +#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ +#define USB_CDC_DMM_TYPE 0x14 +#define USB_CDC_OBEX_TYPE 0x15 /* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ struct usb_cdc_header_desc { @@ -85,6 +94,27 @@ __le16 wMaxSegmentSize; __le16 wNumberMCFilters; __u8 bNumberPowerFilters; +} __attribute__ ((packed)); + +/* "MDLM Functional Descriptor" from CDC WMC spec 6.7.2.3 */ +struct usb_cdc_mdlm_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + __le16 bcdVersion; + __u8 bGUID[16]; +} __attribute__ ((packed)); + +/* "MDLM Detail Functional Descriptor" from CDC WMC spec 6.7.2.4 */ +struct usb_cdc_mdlm_detail_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + + /* type is associated with mdlm_desc.bGUID */ + __u8 bGuidDescriptorType; + __u8 bDetailData[]; } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/