1 # Maxis Wireless Broadband - Huawei E220 2 # Making it work on Linux 3 # kjteoh - All mistakes are mine 4 # 20.10.2007 5 6 The company just purchased the subscription for some of us (after 7 some persistent request from us) primarily because we are required to 8 perform work after hours and too, in most instances are required to stay 9 "connected" all the time so to speak. 10 11 There are those of us on the _alternative_os (not BSD) and there is me 12 who is on Slackware Linux. 13 14 The following is a write up on how to get it going on Linux... and it I 15 haven't mentioned it before, the wireless broadband device provided by 16 Maxis connected via USB. (I am actually writing this whilst connected 17 via the Maxis service). 18 19 There is also good write up on the Gentoo site - of 20 which much of this summary is borrowed from. See also 21 http://gentoo-wiki.com/HARDWARE_HUAWEI_E220_HSDPA_USB_MODEM . 22 23 Make sure you have these compiled in your kernel: 24 25 #zgrep -e "CONFIG_USB_SERIAL_GENERIC" -e "CONFIG_PPP" -e 26 "CONFIG_PPP_ASYNC" /proc/config.gz 27 28 or .. similarly (if your source is included or installed: 29 30 # grep -e "CONFIG_USB_SERIAL_GENERIC" -e "CONFIG_PPP" -e 31 "CONFIG_PPP_ASYNC" /usr/src/linux/.config 32 33 The Results you are looking for are printed below - if not, your kernel 34 is not compiled with these options and going further will be a waste 35 of time. 36 CONFIG_PPP=m CONFIG_PPP_MULTILINK=y 37 CONFIG_PPP_FILTER=y 38 CONFIG_PPP_ASYNC=m 39 CONFIG_PPP_SYNC_TTY=m 40 CONFIG_PPP_DEFLATE=m 41 CONFIG_PPP_BSDCOMP=m 42 CONFIG_PPP_MPPE=m 43 CONFIG_PPPOE=m 44 CONFIG_PPPOATM=m 45 CONFIG_USB_SERIAL_GENERIC=y 46 47 Next, after plugging it into the available USB ports (I don't need to 48 tell you that you will have to install the SIM and activate it with 49 Maxis right? Or do I?) do the following to ensure that it is seen by 50 the USB Drivers: 51 52 #lsusb -v | less 53 54 ... and while in less, hit the "/" key to search for "HUAWEI". 55 56 The Results you want: 57 58 Bus 1 Device 4: ID 12d1:1003 59 Device Descriptor: 60 bLength 18 61 bDescriptorType 1 62 bcdUSB 1.10 63 bDeviceClass 0 (Defined at Interface level) 64 bDeviceSubClass 0 65 bDeviceProtocol 0 66 bMaxPacketSize0 64 67 idVendor 0x12d1 <--- NOTE 68 idProduct 0x1003 <--- NOTE 69 bcdDevice 0.00 70 iManufacturer 1 HUAWEI Technologies <--- NOTE 71 iProduct 2 HUAWEI Mobile <--- NOTE 72 iSerial 0 73 74 --- cut here --- 75 76 They typical #lsusb will show someting like: 77 Bus 5 Device 1: ID 0000:0000 78 Bus 4 Device 1: ID 0000:0000 79 Bus 3 Device 1: ID 0000:0000 80 Bus 2 Device 2: ID 046d:c016 Logitech, Inc. M-UV69a Optical Wheel Mouse 81 Bus 2 Device 1: ID 0000:0000 82 Bus 1 Device 5: ID 12d1:1003 <--- NOTE 83 Bus 1 Device 1: ID 0000:0000 84 85 If your Linux Distro is truly ready to accept the device, lsmod | grep -i 86 "usb" will show something like: 87 88 # lsmod | grep -i "usb" 89 usb_storage 79040 0 90 usbhid 34272 0 91 usbserial 28264 3 option <--- NOTE 92 93 Otherwise, continue reading as you may have to either load up the required 94 kernle modules by hand or have it automated in /etc/udev/rules.d . 95 96 To load up the usbserial modules by hand: 97 #modprobe usbserial vendor=0x12d1 product=0x1003 98 99 To have it load up by udev: 100 # touch /etc/udev/rules.d/50-huawei.rules 101 102 and include the following in 50-huawei.rules 103 SUBSYSTEM=="usb", SYSFS{idProduct}=="1003", SYSFS{idVendor}=="12d1", RUN+="/sbin/modprobe usbserial vendor=0x12d1 product=0x1003" SUBSYSTEM=="usb", SYSFS{idProduct}=="1003", SYSFS{idVendor}=="12d1", RUN+="/sbin/modprobe ppp_generic" 106 107 #/sbin/udevcontrol reload_rules 108 109 Unplug the USB device and replug it accordingly. What you've done 110 here is customized the rules for the product (the USB device) and have 111 provided instructions to udev to run xxx when the kernel detects the 112 device 12d1:1003 . 113 114 Right about now do # grep usb /var/log/messages 115 116 Oct 20 08:05:53 zeus kernel: 117 xxx: usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB0 118 xxx: usbserial_generic 1-1.1:1.1: GSM modem (1-port) converter detected 119 xxx: usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB1 120 xxx: usbserial_generic 1-1.1:1.2: GSM modem (1-port) converter detected 121 xxx: usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB2 122 123 This thing to look for is ttyUSB0, ttyUSB1 and ttyUSB2. 124 125 This indicates that the USB device is "ready" and that the linux usb 126 drivers have performed all that is required to get it going. Do # 127 ls -l /dev/ttyUSB* and the symlinks will appear. If you do _not_ see 128 ttyUSB1 and ttyUSB2, you will required a little more hacking. 129 130 ### MORE HACKING ### 131 Reason is, the E220 is "duel mode" and can operate 132 as a virtual cdrom device usually detected as /dev/srX if I am not 133 mistaken, and you can actually mount it with # mount /dev/srX /mnt/cdrom 134 or whatever. The Windows Autorun.exe is located there and perform all 135 kinds of nonesense. Since we ... err, Linux users are not interested 136 in any autorun.exe, we'd have to disable it. 137 138 Download huaweiAktBbo.c from 139 http://www.kanoistika.sk/bobovsky/archiv/umts/ and compile it with: 140 # gcc huaweiAktBbo.c -lusb -o huaweiAktBbo 141 142 followed by: 143 # mv huaweiAktBbo /usr/local/sbin/ 144 145 Now, add the following to /etc/udev/rules.d/50-huawei.rules and 146 make it look like that: 147 SUBSYSTEM=="usb", SYSFS{idProduct}=="1003", SYSFS{idVendor}=="12d1", RUN+="/sbin/modprobe usbserial vendor=0x12d1 product=0x1003" SUBSYSTEM=="usb", SYSFS{idProduct}=="1003", SYSFS{idVendor}=="12d1", RUN+="/sbin/modprobe ppp_generic" SUBSYSTEM=="usb", SYSFS{idProduct}=="1003", SYSFS{idVendor}=="12d1", RUN+="/bin/sleep 10" SUBSYSTEM=="usb", SYSFS{idProduct}=="1003",SYSFS{idVendor}=="12d1", RUN+="/usr/local/sbin/huaweiAktBbo" 155 156 Note the last two line printed immediately above. 157 158 Replug the modem again and if that does not work quick enough for you, 159 fire it up by hand with /usr/local/sbin/huaweiAktBbo . 160 161 What /usr/local/sbin/huaweiAktBbo eventually does is switching off 162 the virtual cdrom mode for the E220 and in turn making it completely 163 modem mode. 164 165 Check and see if /dev/ttyUSB0-2 is up now with # ls -l /dev/ttyUSB* 166 and/or # grep usb /var/log/messages . 167 168 If you have performed the steps correctly, it _should_ be up. 169 170 ### PPP Setup ### 171 Next you will require the ppp-2.4.x package installed 172 (it usually is anyway). 173 174 # mkdir /etc/ppp/peers # vi /etc/ppp/peers/e220 175 176 and insert the following: /dev/ttyUSB0 460800 crtscts modem noauth usepeerdns defaultroute noipdefault debug nobsdcomp novj user "maxis" password "wap" connect '/usr/sbin/chat -f /etc/ppp/peers/chat-E220-nopin || /usr/sbin/chat -f /etc/ppp/peers/chat-E220-pin ' 192 193 Next is to create /etc/ppp/peers/chat-E220-noping and chat-E220-pin 194 195 # vi /etc/ppp/peers/chat-E220-nopin 196 197 and insert the following: ABORT BUSY ABORT ERROR ABORT 'NO CARRIER' REPORT CONNECT TIMEOUT 10 "" "ATZ" OK AT+CGDCONT=1,"ip","maxisbb" OK "ATE1V1&D2&C1S0=0+IFC=2,2" OK "ATE1" TIMEOUT 60 "" "ATD*99#" CONNECT \c 211 212 and... 213 214 # vi /etc/ppp/peers/chat-E220-pin 215 216 and insert the following: ABORT BUSY ABORT ERROR ABORT 'NO CARRIER' REPORT CONNECT TIMEOUT 10 "" "ATZ" OK "AT+CPIN=XXX" OK AT+CGDCONT=1,"ip","maxisbb" OK "ATE1V1&D2&C1S0=0+IFC=2,2" OK "ATE1" TIMEOUT 60 "" "ATD*99#" CONNECT \c 231 232 NOTE: where XXX is your pin. In first time setups, usually 0123 - 233 unless you have changed it. 234 235 Next is to get the "pon" and "poff" scripts to do the work for you. 236 237 # cp /usr/doc/ppp-2.4.4/scripts/pon /usr/local/sbin 238 # cp /usr/doc/ppp-2.4.4/scripts/poff /usr/local/sbin 239 # cp /usr/doc/ppp-2.4.4/scripts/pon.1 /usr/local/man/man1 240 241 # chmod 0755 /usr/local/sbin/pon 242 # chmod 0755 /usr/local/sbin/poff 243 244 Now that we have made sure of the following: 245 246 1. /dev/ttyUSB0 - 2 exist 247 248 2. # lsmod | grep -i usb show: 249 usbserial 28264 3 option 250 251 3. # grep -i usb /var/log/messages show: xxx: usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB0 xxx: usbserial_generic 1-1.1:1.1: GSM modem (1-port) converter detected xxx: usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB1 xxx: usbserial_generic 1-1.1:1.2: GSM modem (1-port) converter detected xxx: usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB2 261 262 We are ready to fireup pppd and chat and attempt connection:- 263 264 # /usr/local/sbin/pon e220 265 266 ... and thats it. 267 268 #/sbin/ifconfig shows :- 269 ppp0 Link encap:Point-to-Point Protocol 270 inet addr:121.120.201.170 P-t-P:10.64.64.64 271 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST 272 MTU:1500 Metric:1 RX packets:7121 errors:0 dropped:0 273 overruns:0 frame:0 TX packets:11408 errors:0 dropped:0 274 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:1233855 275 (1.1 MiB) TX bytes:930266 (908.4 KiB) 276 277 and if /etc/resolv.conf does not reveal a proper DNS server, you can 278 use ours at:- 279 280 nameserver 203.115.225.25 nameserver 203.115.225.24 281 282 If ppp/chat does not fire up as expected, # tail /var/log/syslog for 283 further trouble shooting. 284 285 PS: if you have gotten this far, download comgt.0.32.tgz . Its a nice 286 program. 287 288 kjteoh - good luck 289 For an update ... See http://oozie.fm.interia.pl/pro/huawei-e220/ 290 ... its helpful. 291 Update: For anyone who's reading, apart from internet connectivity via 292 /dev/ttyUSB0, I've used gnokii (http://www.gnokii.org) for Text Message 293 simultaneous via /dev/ttyUSB1