On Tuesday 03 May 2005 6:22 pm, Andrea Arcangeli wrote:
> The cellphone shows 3 modes, you have to choose between "mass storagae"
> or "modem" before you plug in the cable, then if you connect the cable
> as "modem" you can as well transform it into a usbnet while the cable is
> plugged it (after that you run ifconfig on both sides and you start
> inetd so it answers to telnet).

That seems more than a bit convoluted ... :)

So it's just like the other Motorola phone that was addressed by the
"pseudo-MDLM" support patch I sent a while back ... which IMO wasn't
quite ready for Linus' tree, it had only been used with a Motorola
phone, and ended up broking some of the more recent Zaurus models.

Instead of that patch you sent, can you try this one instead?
I've enclosed a version against a GIT snapshot of 2.6.12-rc I took
yesterday.

- Dave


> Bus 002 Device 036: ID 22b8:600c Motorola PCS A768i GSM Phone
> Device Descriptor:
> � bLength � � � � � � � �18
> � bDescriptorType � � � � 1
> � bcdUSB � � � � � � � 2.00
> � bDeviceClass � � � � � �2 Communications
> � bDeviceSubClass � � � � 2 Abstract (modem)
> � bDeviceProtocol � � � � 0 None
> � bMaxPacketSize0 � � � �16
> � idVendor � � � � � 0x22b8 Motorola PCS
> � idProduct � � � � �0x600c A768i GSM Phone
> � bcdDevice � � � � � �0.00
> � iManufacturer � � � � � 3 Motorola
> � iProduct � � � � � � � �4 Motorola USBLAN
> � iSerial � � � � � � � � 0 
> � bNumConfigurations � � �1
> � Configuration Descriptor:
> � � bLength � � � � � � � � 9
> � � bDescriptorType � � � � 2
> � � wTotalLength � � � � � 92
> � � bNumInterfaces � � � � �1
> � � bConfigurationValue � � 1
> � � iConfiguration � � � � �5 BLAN Net Cfg
> � � bmAttributes � � � � 0x80
> � � MaxPower � � � � � � �500mA
> � � Interface Descriptor:
> � � � bLength � � � � � � � � 9
> � � � bDescriptorType � � � � 4
> � � � bInterfaceNumber � � � �0
> � � � bAlternateSetting � � � 0
> � � � bNumEndpoints � � � � � 3
> � � � bInterfaceClass � � � � 2 Communications
> � � � bInterfaceSubClass � � 10 Mobile Direct Line
> � � � bInterfaceProtocol � � �0 
> � � � iInterface � � � � � � �6 Comm/Data Intf
> � � � CDC Header:
> � � � � bcdCDC � � � � � � � 1.10
> � � � CDC MDLM:
> � � � � bcdCDC � � � � � � � 1.00
> � � � � bGUID � � � � � � � �74 f0 3d bd 1e c1 44 70 a3 67 71 34 c9 f5 54 37
> � � � CDC MDLM detail:
> � � � � bGuidDescriptorType �01
> � � � � bDetailData � � � � �00 01 00
> � � � CDC Ethernet:
> � � � � iMacAddress � � � � � � � � � � �1 92935fbbc0df
> � � � � bmEthernetStatistics � �0x00000000
> � � � � wMaxSegmentSize � � � � � � � 1514
> � � � � wNumberMCFilters � � � � � �0x0000
> � � � � bNumberPowerFilters � � � � � � �0
> � � � UNRECOGNIZED: �07 24 0a 00 02 00 00
> � � � Endpoint Descriptor:
> � � � � bLength � � � � � � � � 7
> � � � � bDescriptorType � � � � 5
> � � � � bEndpointAddress � � 0x01 �EP 1 OUT
> � � � � bmAttributes � � � � � �2
> � � � � � Transfer Type � � � � � �Bulk
> � � � � � Synch Type � � � � � � � None
> � � � � � Usage Type � � � � � � � Data
> � � � � wMaxPacketSize � � 0x0040 �1x 64 bytes
> � � � � bInterval � � � � � � � 0
> � � � Endpoint Descriptor:
> � � � � bLength � � � � � � � � 7
> � � � � bDescriptorType � � � � 5
> � � � � bEndpointAddress � � 0x82 �EP 2 IN
> � � � � bmAttributes � � � � � �2
> � � � � � Transfer Type � � � � � �Bulk
> � � � � � Synch Type � � � � � � � None
> � � � � � Usage Type � � � � � � � Data
> � � � � wMaxPacketSize � � 0x0040 �1x 64 bytes
> � � � � bInterval � � � � � � � 0
> � � � Endpoint Descriptor:
> � � � � bLength � � � � � � � � 7
> � � � � bDescriptorType � � � � 5
> � � � � bEndpointAddress � � 0x83 �EP 3 IN
> � � � � bmAttributes � � � � � �3
> � � � � � Transfer Type � � � � � �Interrupt
> � � � � � Synch Type � � � � � � � None
> � � � � � Usage Type � � � � � � � Data
> � � � � wMaxPacketSize � � 0x0010 �1x 16 bytes
> � � � � bInterval � � � � � � �10
> 
Updates to the usbnet driver:

 - Remove a warning when built with Zaurus support but not CDC Ethernet;
   just moves an #ifdef to cover more code
 
 - Two tweaks to the pseudo-MDLM support:
    * correctly handle _either_ of the two GUIDs
    * ignore a padding bit that doesn't seem necessary

Signed-off-by: David Brownell <[EMAIL PROTECTED]>

--- linux-2.6/drivers/usb/net/usbnet.c	2005-05-03 13:49:38.000000000 -0700
+++ gadget-2.6/drivers/usb/net/usbnet.c	2005-05-04 18:20:22.000000000 -0700
@@ -1517,6 +1517,26 @@
 	}
 }
 
+#endif	/* NEED_GENERIC_CDC */
+
+
+#ifdef	CONFIG_USB_CDCETHER
+#define	HAVE_HARDWARE
+
+/*-------------------------------------------------------------------------
+ *
+ * Communications Device Class, Ethernet Control model
+ * 
+ * Takes two interfaces.  The DATA interface is inactive till an altsetting
+ * is selected.  Configuration data includes class descriptors.
+ *
+ * This should interop with whatever the 2.4 "CDCEther.c" driver
+ * (by Brad Hards) talked with.
+ *
+ *-------------------------------------------------------------------------*/
+
+#include <linux/ctype.h>
+
 
 static void dumpspeed (struct usbnet *dev, __le32 *speeds)
 {
@@ -1567,26 +1587,6 @@
 	}
 }
 
-#endif	/* NEED_GENERIC_CDC */
-
-
-#ifdef	CONFIG_USB_CDCETHER
-#define	HAVE_HARDWARE
-
-/*-------------------------------------------------------------------------
- *
- * Communications Device Class, Ethernet Control model
- * 
- * Takes two interfaces.  The DATA interface is inactive till an altsetting
- * is selected.  Configuration data includes class descriptors.
- *
- * This should interop with whatever the 2.4 "CDCEther.c" driver
- * (by Brad Hards) talked with.
- *
- *-------------------------------------------------------------------------*/
-
-#include <linux/ctype.h>
-
 static u8 nibble (unsigned char c)
 {
 	if (likely (isdigit (c)))
@@ -2765,7 +2765,7 @@
 			}
 			/* expect bcdVersion 1.0, ignore */
 			if (memcmp(&desc->bGUID, blan_guid, 16)
-				    || memcmp(&desc->bGUID, blan_guid, 16) ) {
+				    && memcmp(&desc->bGUID, blan_guid, 16) ) {
 				/* hey, this one might _really_ be MDLM! */
 				dev_dbg (&intf->dev, "MDLM guid\n");
 				goto bad_desc;
@@ -2797,11 +2797,13 @@
 			 *  - bPad (ignored, for PADAFTER -- BLAN-only)
 			 * bits are:
 			 *  - 0x01 -- Zaurus framing (add CRC)
-			 *  - 0x02 -- PADBEFORE
-			 *  - 0x04 -- PADAFTER
+			 *  - 0x02 -- PADBEFORE (CRC includes some padding)
+			 *  - 0x04 -- PADAFTER (some padding after CRC)
 			 *  - 0x08 -- "fermat" packet mangling (for hw bugs)
+			 * the PADBEFORE appears not to matter; we interop
+			 * with devices that use it and those that don't.
 			 */
-			if (detail->bDetailData[1] != 0x01) {
+			if ((detail->bDetailData[1] & ~02) != 0x01) {
 				/* bmDataCapabilites == 0 would be fine too,
 				 * but framing is minidriver-coupled for now.
 				 */

Reply via email to