Huawei E220 USB modem

Edwin Groothuis edwin at mavetju.org
Thu Dec 13 20:52:20 PST 2007


Hello,

I'm the lucky owner of a Huawei E220 USB modem. For certain kinds
of lucky that is. I've read up various mailinglists and see that
NetBSD manages to get it working. I've done some tests on FreeBSD
(mostly adding it to usbdevs and ubsa.c) and I get it working up
to the same level of the people there: I get the disk on it as an
umass device (that was a piece of cake), and I get it recognized
but not loaded as an ucom device:

usbd reports:

    usbd: processing event queue on /dev/usb
    usbd: device-attach event at 1197602138.124080000, HUAWEI Mobile, HUAWEI Technologies:
      vndr=0x12d1 prdct=0x1003 rlse=0x0000 clss=0x0000 subclss=0x0000 prtcl=0x0000

the kernel reports:

    ucom0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2
    ucom0: Could not find interrupt in
    device_attach: ucom0 attach returned 6

Going through the code of ubsa.c, that "interrupt in" missing is
part of the information exchanged with the device. udesc_dump gives
me:

    [~] root at vaio-edwin>udesc_dump /dev/ugen0  
    Standard Device Descriptor:
      bLength            18
      bDescriptorType    01
      bcdUSB             0110
      bDeviceClass       00
      bDeviceSubClass    00
      bDeviceProtocol    00
      bMaxPacketSize     64
      idVendor           12d1
      idProduct          1003
      bcdDevice          0000
      iManufacturer      1
      iProduct           2
      iSerialNumber      0
      bNumConfigurations 1

    Configuration 0:
	    Standard Configuration Descriptor:
	      bLength             9
	      bDescriptorType     02
	      wTotalLength        32
	      bNumInterface       1
	      bConfigurationValue 1
	      iConfiguration      0
	      bmAttributes        a0 (remote-wakeup)
	      bMaxPower           250 (500 mA)

	    Standard Interface Descriptor:
	      bLength            9
	      bDescriptorType    04
	      bInterfaceNumber   0
	      bAlternateSetting  0
	      bNumEndpoints      2
	      bInterfaceClass    08
	      bInterfaceSubClass 06
	      bInterfaceProtocol 50
	      iInterface         0

	    Standard Endpoint Descriptor:
	      bLength          7
	      bDescriptorType  05
	      bEndpointAddress 83 (in)
	      bmAttributes     02 (Bulk)
	      wMaxPacketSize   64
	      bInterval        0

	    Standard Endpoint Descriptor:
	      bLength          7
	      bDescriptorType  05
	      bEndpointAddress 04 (out)
	      bmAttributes     02 (Bulk)
	      wMaxPacketSize   64
	      bInterval        0

    Codes Representing Languages by the Device:
      bLength          4
      bDescriptorType  03
      wLANGID[0]       0409

    String (index 1): HUAWEI Technologies

    String (index 2): HUAWEI Mobile

Yes, I see the bulk-in and the bulk-out, but not the interrupt-in.
In /dev/ I see an ugen0.3 and ugen0.4, which I assume it related
to the bulk-in and bulk-out. Could it be that it is reading the USB
definitions of the first USB device on the modem, which is the umass
device.


Re-reading the whole thread on netbsd-current again
(http://www.google.com/search?hl=en&domains=openbsd.org&q=huawei+e220+site%3Anetbsd.org&btnG=Search&sitesearch=)
and seeing this line:

> Indeed, it works (at least I can talk with the device). However, it
> needs to be plugged two times (keeping the 'assistant power' link
> connected):

What does this mean? What does it say? What is assistant power?
Anyway, I carefully pull out the cable from the modem itself, and
when I see it disconnecting in the usbd (but the light on the modem
is still on) I put it back in:

Dec 14 15:14:36 vaio-edwin kernel: ucom0: at uhub1 port 1 (addr 2) disconnected
Dec 14 15:14:57 vaio-edwin kernel: ucom0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2

Without the dreaded "Couldn't find interrupt in" message. I suddenly
have a /dev/cuaaU0, and minicom reports:

    OK
    ATI
    Manufacturer: huawei
    Model: E220
    Revision: 11.117.06.00.100
    IMEI: 358191018517800
    +GCAP: +CGSM,+DS,+ES
    OK

Something works! But what and where and how and who? Back to the basics:

usbd reports:

    usbd: device-attach event at 1197606165.553779000, HUAWEI Mobile, HUAWEI Technologies:
      vndr=0x12d1 prdct=0x1003 rlse=0x0000 clss=0x0000 subclss=0x0000 prtcl=0x0000
      device names: ugen0
      === match attempt: ugen0
    usbd: Found action 'USB device' for HUAWEI Mobile, HUAWEI Technologies at ugen0
    usbd: action 0: USB device
    usbd: Setting DEVNAME='ugen0'

the kernel reports:

    ugen0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2

udesc_dump tells me:

    [/home/edwin] root at vaio-edwin>udesc_dump 
    Standard Device Descriptor:
      bLength            18
      bDescriptorType    01
      bcdUSB             0110
      bDeviceClass       00
      bDeviceSubClass    00
      bDeviceProtocol    00
      bMaxPacketSize     64
      idVendor           12d1
      idProduct          1003
      bcdDevice          0000
      iManufacturer      1
      iProduct           2
      iSerialNumber      0
      bNumConfigurations 1

    Configuration 0:
	    Standard Configuration Descriptor:
	      bLength             9
	      bDescriptorType     02
	      wTotalLength        85
	      bNumInterface       3
	      bConfigurationValue 1
	      iConfiguration      0
	      bmAttributes        a0 (remote-wakeup)
	      bMaxPower           250 (500 mA)

	    Standard Interface Descriptor:
	      bLength            9
	      bDescriptorType    04
	      bInterfaceNumber   0
	      bAlternateSetting  0
	      bNumEndpoints      3
	      bInterfaceClass    ff
	      bInterfaceSubClass ff
	      bInterfaceProtocol ff
	      iInterface         3

	    Standard Endpoint Descriptor:
	      bLength          7
	      bDescriptorType  05
	      bEndpointAddress 81 (in)
	      bmAttributes     03 (Interrupt)
	      wMaxPacketSize   16
	      bInterval        128

	    Standard Endpoint Descriptor:
	      bLength          7
	      bDescriptorType  05
	      bEndpointAddress 82 (in)
	      bmAttributes     02 (Bulk)
	      wMaxPacketSize   64
	      bInterval        0

	    Standard Endpoint Descriptor:
	      bLength          7
	      bDescriptorType  05
	      bEndpointAddress 02 (out)
	      bmAttributes     02 (Bulk)
	      wMaxPacketSize   64
	      bInterval        0

	    Standard Interface Descriptor:
	      bLength            9
	      bDescriptorType    04
	      bInterfaceNumber   1
	      bAlternateSetting  0
	      bNumEndpoints      2
	      bInterfaceClass    ff
	      bInterfaceSubClass ff
	      bInterfaceProtocol ff
	      iInterface         3

	    Standard Endpoint Descriptor:
	      bLength          7
	      bDescriptorType  05
	      bEndpointAddress 85 (in)
	      bmAttributes     02 (Bulk)
	      wMaxPacketSize   64
	      bInterval        0

	    Standard Endpoint Descriptor:
	      bLength          7
	      bDescriptorType  05
	      bEndpointAddress 05 (out)
	      bmAttributes     02 (Bulk)
	      wMaxPacketSize   64
	      bInterval        0

	    Standard Interface Descriptor:
	      bLength            9
	      bDescriptorType    04
	      bInterfaceNumber   2
	      bAlternateSetting  0
	      bNumEndpoints      2
	      bInterfaceClass    08
	      bInterfaceSubClass 06
	      bInterfaceProtocol 50
	      iInterface         0

	    Standard Endpoint Descriptor:
	      bLength          7
	      bDescriptorType  05
	      bEndpointAddress 83 (in)
	      bmAttributes     02 (Bulk)
	      wMaxPacketSize   64
	      bInterval        0

	    Standard Endpoint Descriptor:
	      bLength          7
	      bDescriptorType  05
	      bEndpointAddress 04 (out)
	      bmAttributes     02 (Bulk)
	      wMaxPacketSize   64
	      bInterval        0

    Codes Representing Languages by the Device:
      bLength          4
      bDescriptorType  03
      wLANGID[0]       0409

    String (index 1): HUAWEI Technologies

    String (index 2): HUAWEI Mobile

    String (index 3): Data Interface


There is an interrupt-in! That will probably make usba.c happier.


What did I change in usbdevs:
    [/sys/dev/usb] edwin at vaio-edwin>grep -A4 -B4 E220 usbdevs 

    /* HP products */
    product HP2 C500                0x6002  PhotoSmart C500

    /* HUAWEI products */
    product HUAWEI MOBILE           0x1001  Huawei Mobile
+   product HUAWEI E220             0x1003  Huawei E220 HSDPA USB Modem

    /* IBM Corporation */
    product IBM USBCDROMDRIVE       0x4427  USB CD-ROM Drive

And in ubda.c:

    [/sys/dev/usb] edwin at vaio-edwin>grep -A4 -B4 E220 ubsa.c 
	    { USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3G },
	    /* Option GlobeTrotter 3G QUAD */
	    { USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD },
	    /* Huawei Mobile */
	    { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE },
+	    { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220 },
	    { 0, 0 }
    };

(Are people still reading this? Or did I lose you guys 200 lines ago?)

I'm now going to see if I can get ppp to work with it, that will
be more an issue for -questions if it doesn't work.

Edwin

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin at mavetju.org    |              Weblog: http://www.mavetju.org/weblog/


More information about the freebsd-usb mailing list