<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>/home/shakir &#187; hsdpa</title>
	<atom:link href="http://www.mohdshakir.net/tag/hsdpa/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mohdshakir.net</link>
	<description>My Piece Of The Web</description>
	<lastBuildDate>Fri, 16 Jul 2010 15:45:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Huawei E220 in Gutsy Gibbon (Kubuntu)</title>
		<link>http://www.mohdshakir.net/2007/12/05/huawei-e220-in-gutsy-gibbon-kubuntu</link>
		<comments>http://www.mohdshakir.net/2007/12/05/huawei-e220-in-gutsy-gibbon-kubuntu#comments</comments>
		<pubDate>Wed, 05 Dec 2007 06:48:47 +0000</pubDate>
		<dc:creator>shakir</dc:creator>
				<category><![CDATA[Information Insemination]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[gutsy]]></category>
		<category><![CDATA[hsdpa]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.mohdshakir.net/2007/12/05/huawei-e220-in-gutsy-gibbon-kubuntu</guid>
		<description><![CDATA[I received a package earlier today, and was very happy to find out that it&#8217;s the Huawei E220 that I ordered few days ago. This Huawei E220 is a 3G card that supports speed of up to 3.6 Mbps, using HSDPA technology, and it makes me can&#8217;t wait to have it work with Gutsy Gibbon. [...]]]></description>
			<content:encoded><![CDATA[<p>I received a package earlier today, and was very happy to find out that it&#8217;s the <em>Huawei E220</em> that I ordered few days ago. <!-- google_ad_section_start -->This Huawei E220 is a 3G card that supports speed of up to 3.6 Mbps, using <em>HSDPA</em> technology, <!-- google_ad_section_end -->and it makes me can&#8217;t wait to have it work with <em>Gutsy Gibbon</em>. After struggling for quite some time, I found out that the answer to my problem was just these two lines of command:</p>
<pre>sudo modprobe -r uhci_hcd
sudo modprobe uhci_hcd
</pre>
<p>If that short version of my solution doesn&#8217;t help, please read ahead&#8230;</p>
<p>I&#8217;ve been trying to get this modem to work with <a href="https://wiki.ubuntu.com/GutsyGibbon">Gutsy Gibbon</a>, but the online howtos that I found on the net doesnt reliably work for me. </p>
<p>Weird enough for me initially as sometime I can just use <font face="Courier New">wvdial</font> (more on this afterward) and get connected, while most of the time I got various errors about the modem. With these non-reproducible errors and successes, I do some trial and error while looking at the kernel logs, and came up with this one final observation;</p>
<pre><font size="3" color="#808080">shakir@herugrim ~ $ uname -r&nbsp; # just to show the kernel I'm using, as your mileage may vary
2.6.22-14-generic
</font></pre>
<p>
At one shell I run this to see kernel messages;</p>
<pre><font size="3" color="#808080">sudo tail -f&nbsp; /var/log/messages</font></pre>
<p>and got this messages upon plugging in my <font face="Courier New">Huawei E220</font> to the USB port;</p>
<pre><font size="3" color="#808080">usb 3-1: new full speed USB device using uhci_hcd and address 5
usb 3-1: configuration #1 chosen from 1 choice
usbcore: registered new interface driver libusual
usbcore: registered new interface driver usbserial
/build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
/build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c: USB Serial Driver core
/build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c: USB Serial support registered for GSM modem (1-port)
option 3-1:1.0: GSM modem (1-port) converter detected
usb 3-1: GSM modem (1-port) converter now attached to ttyUSB0
</font></pre>
<p>Nice, it has detected my <font face="Courier New">Huawei E220</font> as GSM modem, and attach it to /dev/ttyUSB0. Let&#8217;s create a wvdial configuration to connect to the telco <font face="Courier New">(Celcom</font> in my case). My<font face="Courier New"> /etc/wvdial.conf </font>looks like this;</p>
<pre><font size="3" color="#808080">[Dialer Celcom3G]
Phone = *99***1#
Modem = /dev/ttyUSB0
Username = user
Password = pass
ISDN = 0
New PPPD = yes
Baud = 1843200
Init2 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &#038;C1 &#038;D2 +FCLASS=0
Modem Type = Analog Modem
</font></pre>
<p>
So let&#8217;s just connect;</p>
<pre><font size="3" color="#808080">shakir@herugrim ~ $ sudo wvdial Celcom3G
WvDial<*1>: WvDial: Internet dialer version 1.56
WvModem<*1>: Cannot get information for serial port.
WvDial<*1>: Initializing modem.
WvDial<*1>: Sending: ATZ
WvDial<*1>: Sending: ATQ0
WvDial<*1>: Re-Sending: ATZ
WvDial<Err>: Modem not responding.
</font></pre>
<p>
Ouch, an error. The modem has been detected, what could go wrong? After some time, and no success with the available tutorials, I finally got this working, as the problem was related to the USB drivers. What I did was to reload the <font face="Courier New">uhci_hcd</font> module</p>
<pre><font size="3" color="#808080">shakir@herugrim ~ $ sudo modprobe -r uhci_hcd</font></pre>
<p>
Lets take a look at what the kernel says about this;</p>
<pre><font size="3" color="#808080">[..snipped..]
Dec  4 22:45:24 herugrim kernel: [ 1343.504000] usb 3-1: USB disconnect, address 6
Dec  4 22:45:24 herugrim kernel: [ 1343.504000] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
Dec  4 22:45:24 herugrim kernel: [ 1343.504000] option 3-1:1.0: device disconnected
[..snipped..]
</font></pre>
<p>
and then lets load the module back again</p>
<pre><font size="3" color="#808080">shakir@herugrim ~ $ sudo modprobe uhci_hcd</font></pre>
<p>
and see what happens;</p>
<pre><font size="3" color="#808080">USB Universal Host Controller Interface driver v3.0
ACPI: PCI Interrupt 0000:00:1a.0[A
uhci_hcd 0000:00:1a.0: UHCI Host Controller
[..snipped..]
usb 3-1: new full speed USB device using uhci_hcd and address 2
usb 3-1: configuration #1 chosen from 1 choice
option 3-1:1.0: GSM modem (1-port) converter detected
usb 3-1: GSM modem (1-port) converter now attached to ttyUSB0
option 3-1:1.1: GSM modem (1-port) converter detected
usb 3-1: GSM modem (1-port) converter now attached to ttyUSB1
option 3-1:1.2: GSM modem (1-port) converter detected
usb 3-1: GSM modem (1-port) converter now attached to ttyUSB2
[..snipped..]
</font></pre>
<p>
Last time the GSM modem was attached to just <font face="Courier New">/dev/ttyUSB0</font>, but now it&#8217;s also attached to <font face="Courier New">/dev/ttyUSB1</font> and <font face="Courier New">/dev/ttyUSB2</font>. And I guess it&#8217;s time to connect using <font face="Courier New">wvdial</font>;</p>
<pre><font size="3" color="#808080">WvDial<*1>: WvDial: Internet dialer version 1.56
WvModem<*1>: Cannot get information for serial port.
WvDial<*1>: Initializing modem.
WvDial<*1>: Sending: ATZ
WvDial Modem<*1>: ATZ
WvDial Modem<*1>: OK
WvDial<*1>: Sending: ATZ
WvDial Modem<*1>: ATZ
WvDial Modem<*1>: OK
WvDial<*1>: Sending: ATQ0 V1 E1 S0=0 &#038;C1 &#038;D2 +FCLASS=0
WvDial Modem<*1>: ATQ0 V1 E1 S0=0 &#038;C1 &#038;D2 +FCLASS=0
WvDial Modem<*1>: OK
WvDial<*1>: Modem initialized.
WvDial<*1>: Sending: ATDT*99***1#
WvDial<*1>: Waiting for carrier.
WvDial Modem<*1>: ATDT*99***1#
WvDial Modem<*1>: CONNECT
WvDial<*1>: Carrier detected.  Waiting for prompt.
WvDial<Notice>: Don't know what to do!  Starting pppd and hoping for the best.
WvDial<Notice>: Starting pppd at Tue Dec  4 22:49:25 2007
WvDial<Notice>: Pid of pppd: 6433
WvDial<*1>: Using interface ppp0
WvDial<*1>: local  IP address 10.188.15.175
WvDial<*1>: remote IP address 10.64.64.64
WvDial<*1>: primary   DNS address 202.188.0.133
WvDial<*1>: secondary DNS address 202.188.1.5
</font></pre>
<p>
It works, yeay <img src='http://www.mohdshakir.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  As usual, lets create a script for this;</p>
<pre lang="bash" line="1">
#!/bin/bash

sudo modprobe -r uhci_hcd
sudo modprobe uhci_hcd

echo "Waiting kernel to detect modem device"

# Wait till the kernel recognizes our E220
while true; do

        # Read log
        tail -n 20 /var/log/messages  > access.history
        sleep 1
        tail -n 20 /var/log/messages  > access.current

        LOG=`diff access.history access.current | grep ">" | tr -d ">"`

        # Check if it is detected
        if [[ "$LOG" =~ "converter now attached to ttyUSB1" ]]; then
                echo "Modem device detected, dialing..."
                # If it is, get out of the loop immedietly
                break
        fi
done

rm access.history access.current

# Start dialing
sudo wvdial Celcom3G
</pre>
<p><i>p/s: The script is now maintained <a href="http://www.mohdshakir.net/scripts/bash/huawei-e220-dialer">here</a>. Please go there to see the latest updates and discussions</i></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mohdshakir.net/2007/12/05/huawei-e220-in-gutsy-gibbon-kubuntu/feed</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
	</channel>
</rss>
