Saturday, September 12, 2009

Prolink PHS100 in Ubuntu Jaunty (9.04)

I finally decided to get a 3G connection as a backup for my ADSL one at home. I often find myself ending up in places without readily provided Internet and wishing for a mobile solution. After doing a bit of research, I found Airtel as the best deal. If you are wondering about Airtel 3G coverage, all I have to say is that I live and usually spend my time within a 20-30 Kilometre radius from the city of Colombo. And when I go out of this zone, Internet or a Laptop or anything related to work is usually the last thing on my mind :) So getting 3G coverage in rural Sri Lanka isn't a huge priority! That, and the fact that this is a supplementary connection, which means it should cost at least 50% or less compared to the primary connection made the choice very easy.

Now for the fun part. Hating how the usual Huawei E220 modem looks, I opted for the more elegant Prolink PHS100, which can be bought with no vendor lock (let's not get started on vendors locking hardware for which I pay for). I found this great post by Laxman, which gets the modem detected in Linux perfectly. But upon dialling with wvdial, the Airtel server wouldn't give me an IP nor any sort of DNS data. I kept getting the following;

--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
--> Sending: ATM0
--> Sending: AT+CGDCONT=1,"IP","airtellive"
--> Modem initialized.

--> Sending: ATDP*99#
--> Waiting for carrier.
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Fri Sep 11 00:12:27 2009
--> Pid of pppd: 5989
--> Using interface ppp0

--> pppd: Я[06]���� ���
--> pppd: Я[06]���� ���
--> pppd: Я[06]���� ���
--> pppd: Я[06]���� ���
--> pppd: Я[06]���� ���
--> pppd: Я[06]���� ���
--> pppd: Я[06]���� ���
--> Disconnecting at Fri Sep 11 00:13:03 2009

--> The PPP daemon has died: A modem hung up the phone (exit code = 16)
--> man pppd explains pppd error codes in more detail.
--> Try again and look into /var/log/messages and the wvdial and pppd man pages for more information.

--> Auto Reconnect will be attempted in 5 seconds

Looking at my /var/log/messages I saw this, which eventually lead to hours of reading logs, googling error messages etc., etc.

Sep 11 00:11:33 clair pppd[5974]: pppd 2.4.5 started by root, uid 0
Sep 11 00:11:33 clair pppd[5974]: Using interface ppp0
Sep 11 00:11:33 clair pppd[5974]: Connect: ppp0 <--> /dev/ttyUSB2
Sep 11 00:11:33 clair pppd[5974]: CHAP authentication succeeded

Sep 11 00:11:33 clair pppd[5974]: CHAP authentication succeeded
Sep 11 00:12:03 clair pppd[5974]: IPCP: timeout sending Config-Requests
Sep 11 00:12:09 clair pppd[5974]: Connection terminated.
Sep 11 00:12:09 clair pppd[5974]: Modem hangup

Sep 11 00:12:09 clair pppd[5974]: Exit.

I tried for a while and was about to admit defeat and go for the ugly modem, which users claim to work perfectly in Linux. Then I had a Eureka moment. What if the modem remembers settings while its connected to Windows? I mean its light is always Red in Linux. But I saw it turning Blue when connected (that's what the manual says too Red -> no show / Blue -> party on). So I plugged the modem back in my Windows machine and instead of disconnecting using the Software, I just yanked it out.

Voila! Now, when its plugged to Linux the light turns Blue in seconds and wvdial completes. By the way, this is the second post from my 3G connection. The first post was an e-mail to Laxman (who was very helpful in giving further tips to try out) informing the solution. I added a comment to his original blog post as well.