Huawei E 220 on Freebsd

June 15, 2008 / by mustakim

other refer if this method fail: http://www.tnpi.biz/computing/freebsd/crystalfontz.shtml

I tested on FreeBSD 7, 6.3 and DesktopBSD 1.6 and one of them (FreeBSD 7) still fail. I think, the configuration of Huawei E220 on BSD is depend on your luck as I has made to Microdia webcam which everybody knows Microdia is not one of Linux's supported webcam

For certain degrees of lucky that is: Getting it to work has been an interesting challenge.

The E220 is by default (FreeBSD 6.3-BETA) recognized as an umass(4) (USB Mass Storage Device) device. That's true, there is a memory disk in it. It is recognized as /dev/cd0 and you can mount it with mount_cd9660 /dev/cd0 /mnt, giving you 10 megabytes of space.

But that is not what you bought the E220 for. You want to use it as a modem. You need to change a couple things in your kernel to get it all working. First, add a line to /sys/dev/usb/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 to /sys/dev/usb/usba.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 } };


Second, you have to disable the umass(4) device from your kernel configuration and rebuild a new kernel. Will this break things? Most likely, specially when you have USB disks and sticks. But you will load it as a module, which will undo the damage you just did to it. In your /boot/loader.conf, add the following lines:




ubsa_load="YES" umass_load="YES"


ubsa(4) is the USB support for Belkin serial adapter. That sounds more like a modem. Next, reboot the machine and see if all modules are loaded correctly:




    # kldstat
    Id Refs Address    Size     Name
     1   20 0xc0400000 72e17c   kernel
     2    1 0xc0b2f000 e6a4     if_iwi.ko
     3    3 0xc0b3e000 2f9c     firmware.ko
     4    1 0xc0b41000 6cdc     ugen.ko
     5    1 0xc0b48000 75b4     umass.ko
     6    1 0xc0b50000 7958     ng_ubt.ko
     7    2 0xc0b58000 cb78     netgraph.ko
     8    1 0xc0b65000 2ef0     ubsa.ko
     9    2 0xc0b68000 4374     ucom.ko
    10    1 0xc0b6d000 5c304    acpi.ko
    11    1 0xc4868000 30000    iwi_bss.ko


Next, plugin your E220 and see what happens:




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


Something is wrong. But a little bit of finger skill will resolve it. At the USB modem side of the USB cable (not the computer side!), carefully pull the cable from the modem and when you see this on your screen, plug it back in:




ucom0: at uhub1 port 1 (addr 2) disconnected ucom0: HUAWEI Technologies HUAWEI Mobile, rev 1.10/0.00, addr 2


It's loaded! If it doesn't work at the first go, try it a couple of times more. Once you are without the dreaded "Couldn't find interrupt in" message you are a happy person.

Check /dev/cuaaU0, it exists! If you have comms/minicom installed, you can do this:




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



And if you dial out, you will end up with a whooping 7.2Mbps connection;




OK
    ATDT *90#
    CONNECT 7200000


Now it is time to train ppp(1). Add this to your /etc/ppp/ppp.conf:




    three:
    set device /dev/cuaU0
    set speed 57600
    set phone *99\#
    set authname
    set authkey
    set ifaddr 10.0.0.1/0 10.0.0.2/0 0.0.0.0 0.0.0.0
    set vj slotcomp off
    add default HISADDR


And dial:




$ ppp three
    ppp> dial
    Ppp>
    PPp>







p/s:That's not good, there should be three capital P's... Going through the PPP log, you will see that the IPCP layer doesn't get initialized properly. Why? No idea. How to resolve it? Put your USB modem in a windows machine, run it once there and put it back into your FreeBSD machine. Why? No idea.


Dial again:




$ ppp three
    ppp> dial
    Ppp>
    PPp>
    PPP>

    $ ifconfig tun0
    tun0: flags=8051 mtu 1500
        inet 119.11.32.164 --> 10.0.0.2 netmask 0xffffffff
        Opened by PID 22997

    $ ping www.freebsd.org
    PING www.freebsd.org (69.147.83.33): 56 data bytes
    64 bytes from 69.147.83.33: icmp_seq=0 ttl=48 time=477.662 ms
    64 bytes from 69.147.83.33: icmp_seq=1 ttl=51 time=416.606 ms
    ^C
    --- www.freebsd.org ping statistics ---
    3 packets transmitted, 2 packets received, 33% packet loss
    round-trip min/avg/max/stddev = 416.606/447.134/477.662/30.528 ms


Your console and /var/log/messages will be spammed with "kernel: ucom0: usba_request: STALLED" messages for some reason.
#####################################################################################
This one does do the full trick:
- It adds a function usbd_set_feature, which does do the trick to
put the right feature set in action.
- It adds a quirk called UQ_FEATURE2.
- It adds the implementation of the quirk in usbd_probe_and_attach
when the device isn't found at the end of the function.
Download patch-1.diff
1. http://www.freebsd.org/cgi/query-pr.cgi?prp=118686-1-diff&n=/patch-1.diff

2. http://people.freebsd.org/~erwin/e220-usb.diff

CVS log for src/sys/dev/usb/uhmodem.c

1. http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/dev/usb/uhmodem.c?rev=1.5.2.2&content-type=text/plain

4 comments on Huawei E 220 on Freebsd

  • Anonymous said 3 months ago

    Hi, sounds like you know a whole bunch! I have a Hisense ACP1607 FWP CDMA device. When installed it will detect a Qualcomm 3197 modem. When attempting to dial a connection the dial up networking the modem will pick up the phone but will not dial, if the connection is set to dial the CDMA standard (#777) then the phone will dial. Any ideas?

  • mustakim said 3 months ago

    I never use the hardware that you use and I also have no idea about it. Have you tried this?  *99#

  • Anonymous said 2 months ago

    it's also can to sendsms by using smstools thru huawei E220 ??

  • mustakim said 2 months ago

    BSD have no software to using smstools. You can use gnu/linux such as Fedora 9 (This distro is Linux Torvald's favourite) and Opensuse 11 and DVD version and try VMC- betavine software. It is easy than Ubuntu unless you use kubuntu. If you use cd version, you need my installer he220rc3, find it at http://huaweie220.blogspot.com

Add a comment

To add comments without entering your email and image verification, you must be logged in. Login or Join Blogster

  • Type the words in the box below the image.

Email this blog post to a friend

To email posts to friends, you must be logged in. Login or Join Blogster

Friends

View All