Ubuntu, Virgin Mobile Internet Pre-paid (in Sydney), and the Huaweie160e

I recently bought a Virgin Mobile Broadband (Australia) PrePaid USB modem - a Huawei e160e. I activated it over the phone, and when I plugged it in to my Dell Inspiron 1525 running Ubuntu 9.10, I could see that it was connected to the network (this modem flashes a blue light every 3 seconds when connected to the mobile network). But, try as I might, I couldn't get it connected. Every time I tried, it would just disconnect.

Looking in the system logs, I'd see:
Jan  6 12:42:57 paul-laptop pppd[2846]: Plugin /usr/lib/pppd/2.4.4/nm-pppd-plugin.so loaded.
Jan  6 12:42:57 paul-laptop pppd[2846]: pppd 2.4.5 started by root, uid 0
Jan  6 12:42:57 paul-laptop pppd[2846]: Using interface ppp0
Jan  6 12:42:57 paul-laptop pppd[2846]: Connect: ppp0 <--> /dev/ttyUSB0
Jan  6 12:42:57 paul-laptop pppd[2846]: CHAP authentication succeeded
Jan  6 12:42:57 paul-laptop pppd[2846]: CHAP authentication succeeded
Jan  6 12:43:06 paul-laptop pppd[2846]: Modem hangup
Jan  6 12:43:06 paul-laptop pppd[2846]: Connection terminated.
Jan  6 12:43:07 paul-laptop pppd[2846]: Exit.

I tried out using usb_modeswitch, but I never really figured out how that is supposed to be used - and it looked to me like the system knew it was a 3G modem anyway.

Using another machine connected to the internet, I googled around and found an answer that worked.

A couple of notes from my experience:

  • This modem was not automatically detected - I had to manually start the 'Network Connections' to add the connection.

  • When selecting Australia and Virgin in the Network Connections wizard, it incorrectly set the APN to 'VirginInternet' - maybe this is for post-paid accounts, but I have a pre-pay, and the APN I use is 'VirginBroadband' - This is probably because for Virgin, there is only one plan to select (default) - how do we get more plans defined (i.e. post-paid and pre-paid)?

  • In the PPP settings, I needed to disable CHAP - doing this in Network Connections was enough, I didn't have to edit /etc/ppp/options

  • The username and password don't seem to matter

lsusb shows the device - interesting that it doesn't label it e160e, but E220 / E270 ???:
paul@paul-laptop:~$ lsusb
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E270 HSDPA/HSUPA Modem
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 05a9:2640 OmniVision Technologies, Inc. OV2640 Webcam
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Now that I have it working, this is the system log from insertion of the USB device to connecting to the network:
Jan 21 07:37:54 paul-laptop kernel: [ 1281.336164] usb 2-2: new high speed USB device using ehci_hcd and address 2
Jan 21 07:37:54 paul-laptop kernel: [ 1281.479581] usb 2-2: configuration #1 chosen from 1 choice
Jan 21 07:37:55 paul-laptop kernel: [ 1281.581686] Initializing USB Mass Storage driver...
Jan 21 07:37:55 paul-laptop kernel: [ 1281.583023] scsi5 : SCSI emulation for USB Mass Storage devices
Jan 21 07:37:55 paul-laptop kernel: [ 1281.583231] usb 2-2: USB disconnect, address 2
Jan 21 07:37:55 paul-laptop kernel: [ 1281.583324] usbcore: registered new interface driver usb-storage
Jan 21 07:37:55 paul-laptop kernel: [ 1281.583331] USB Mass Storage support registered.
Jan 21 07:38:01 paul-laptop kernel: [ 1288.144163] usb 2-2: new high speed USB device using ehci_hcd and address 3
Jan 21 07:38:01 paul-laptop kernel: [ 1288.287791] usb 2-2: configuration #1 chosen from 1 choice
Jan 21 07:38:01 paul-laptop kernel: [ 1288.305526] scsi8 : SCSI emulation for USB Mass Storage devices
Jan 21 07:38:01 paul-laptop kernel: [ 1288.320440] scsi9 : SCSI emulation for USB Mass Storage devices
Jan 21 07:38:01 paul-laptop kernel: [ 1288.392549] usbcore: registered new interface driver usbserial
Jan 21 07:38:01 paul-laptop kernel: [ 1288.392579] USB Serial support registered for generic
Jan 21 07:38:01 paul-laptop kernel: [ 1288.392646] usbcore: registered new interface driver usbserial_generic
Jan 21 07:38:01 paul-laptop kernel: [ 1288.392650] usbserial: USB Serial Driver core
Jan 21 07:38:01 paul-laptop kernel: [ 1288.406201] USB Serial support registered for GSM modem (1-port)
Jan 21 07:38:01 paul-laptop kernel: [ 1288.406282] option 2-2:1.0: GSM modem (1-port) converter detected
Jan 21 07:38:01 paul-laptop kernel: [ 1288.406451] usb 2-2: GSM modem (1-port) converter now attached to ttyUSB0
Jan 21 07:38:01 paul-laptop kernel: [ 1288.406471] option 2-2:1.1: GSM modem (1-port) converter detected
Jan 21 07:38:01 paul-laptop kernel: [ 1288.406561] usb 2-2: GSM modem (1-port) converter now attached to ttyUSB1
Jan 21 07:38:01 paul-laptop kernel: [ 1288.406600] usbcore: registered new interface driver option
Jan 21 07:38:01 paul-laptop kernel: [ 1288.406604] option: v0.7.2:USB Driver for GSM modems
Jan 21 07:38:06 paul-laptop kernel: [ 1293.315709] scsi 8:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
Jan 21 07:38:06 paul-laptop kernel: [ 1293.325975] scsi 9:0:0:0: Direct-Access     HUAWEI   MMC Storage      2.31 PQ: 0 ANSI: 2
Jan 21 07:38:06 paul-laptop kernel: [ 1293.338298] sr1: scsi-1 drive
Jan 21 07:38:06 paul-laptop kernel: [ 1293.338641] sr 8:0:0:0: Attached scsi generic sg2 type 5
Jan 21 07:38:06 paul-laptop kernel: [ 1293.338970] sd 9:0:0:0: Attached scsi generic sg3 type 0
Jan 21 07:38:06 paul-laptop kernel: [ 1293.353699] sd 9:0:0:0: [sdb] Attached SCSI removable disk
Jan 21 07:38:17 paul-laptop pppd[2933]: Plugin /usr/lib/pppd/2.4.4/nm-pppd-plugin.so loaded.
Jan 21 07:38:17 paul-laptop pppd[2933]: pppd 2.4.5 started by root, uid 0
Jan 21 07:38:17 paul-laptop pppd[2933]: Using interface ppp0
Jan 21 07:38:17 paul-laptop pppd[2933]: Connect: ppp0 <--> /dev/ttyUSB0
Jan 21 07:38:17 paul-laptop pppd[2933]: PAP authentication succeeded
Jan 21 07:38:17 paul-laptop kernel: [ 1304.425235] PPP BSD Compression module registered
Jan 21 07:38:17 paul-laptop kernel: [ 1304.431699] PPP Deflate Compression module registered
Jan 21 07:38:24 paul-laptop pppd[2933]: Could not determine remote IP address: defaulting to 10.64.64.64
...

When the system wasn't working (using CHAP and the wrong APN), you can clearly see the failure:
Jan  6 12:42:27 paul-laptop kernel: [  332.937183] usb 2-4: new high speed USB device using ehci_hcd and address 3
Jan  6 12:42:27 paul-laptop kernel: [  333.080647] usb 2-4: configuration #1 chosen from 1 choice
Jan  6 12:42:27 paul-laptop kernel: [  333.176235] Initializing USB Mass Storage driver...
Jan  6 12:42:27 paul-laptop kernel: [  333.179119] scsi5 : SCSI emulation for USB Mass Storage devices
Jan  6 12:42:27 paul-laptop kernel: [  333.179385] usbcore: registered new interface driver usb-storage
Jan  6 12:42:27 paul-laptop kernel: [  333.179392] USB Mass Storage support registered.
Jan  6 12:42:27 paul-laptop kernel: [  333.180499] usb 2-4: USB disconnect, address 3
Jan  6 12:42:34 paul-laptop kernel: [  339.752070] usb 2-4: new high speed USB device using ehci_hcd and address 4
Jan  6 12:42:34 paul-laptop kernel: [  339.905181] usb 2-4: configuration #1 chosen from 1 choice
Jan  6 12:42:34 paul-laptop kernel: [  339.921561] scsi8 : SCSI emulation for USB Mass Storage devices
Jan  6 12:42:34 paul-laptop kernel: [  339.922840] scsi9 : SCSI emulation for USB Mass Storage devices
Jan  6 12:42:34 paul-laptop kernel: [  339.948581] usbcore: registered new interface driver usbserial
Jan  6 12:42:34 paul-laptop kernel: [  339.948610] USB Serial support registered for generic
Jan  6 12:42:34 paul-laptop kernel: [  339.948706] usbcore: registered new interface driver usbserial_generic
Jan  6 12:42:34 paul-laptop kernel: [  339.948710] usbserial: USB Serial Driver core
Jan  6 12:42:34 paul-laptop kernel: [  339.970568] USB Serial support registered for GSM modem (1-port)
Jan  6 12:42:34 paul-laptop kernel: [  339.970692] option 2-4:1.0: GSM modem (1-port) converter detected
Jan  6 12:42:34 paul-laptop kernel: [  339.970862] usb 2-4: GSM modem (1-port) converter now attached to ttyUSB0
Jan  6 12:42:34 paul-laptop kernel: [  339.970881] option 2-4:1.1: GSM modem (1-port) converter detected
Jan  6 12:42:34 paul-laptop kernel: [  339.970976] usb 2-4: GSM modem (1-port) converter now attached to ttyUSB1
Jan  6 12:42:34 paul-laptop kernel: [  339.971016] usbcore: registered new interface driver option
Jan  6 12:42:34 paul-laptop kernel: [  339.971020] option: v0.7.2:USB Driver for GSM modems
Jan  6 12:42:38 paul-laptop pppd[2789]: Plugin /usr/lib/pppd/2.4.4/nm-pppd-plugin.so loaded.
Jan  6 12:42:38 paul-laptop pppd[2789]: pppd 2.4.5 started by root, uid 0
Jan  6 12:42:38 paul-laptop pppd[2789]: Using interface ppp0
Jan  6 12:42:38 paul-laptop pppd[2789]: Connect: ppp0 <--> /dev/ttyUSB0
Jan  6 12:42:38 paul-laptop pppd[2789]: CHAP authentication succeeded
Jan  6 12:42:38 paul-laptop pppd[2789]: CHAP authentication succeeded
Jan  6 12:42:38 paul-laptop kernel: [  343.964939] PPP BSD Compression module registered
Jan  6 12:42:38 paul-laptop kernel: [  344.026662] PPP Deflate Compression module registered
Jan  6 12:42:39 paul-laptop kernel: [  344.925236] scsi 9:0:0:0: Direct-Access     HUAWEI   MMC Storage      2.31 PQ: 0 ANSI: 2
Jan  6 12:42:39 paul-laptop kernel: [  344.925960] sd 9:0:0:0: Attached scsi generic sg2 type 0
Jan  6 12:42:39 paul-laptop kernel: [  344.930619] scsi 8:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
Jan  6 12:42:39 paul-laptop kernel: [  344.942337] sd 9:0:0:0: [sdb] Attached SCSI removable disk
Jan  6 12:42:39 paul-laptop kernel: [  344.957198] sr1: scsi-1 drive
Jan  6 12:42:39 paul-laptop kernel: [  344.957525] sr 8:0:0:0: Attached scsi generic sg3 type 5
Jan  6 12:42:47 paul-laptop pppd[2789]: Modem hangup
Jan  6 12:42:47 paul-laptop pppd[2789]: Connection terminated.
Jan  6 12:42:48 paul-laptop pppd[2789]: Exit.
Jan  6 12:42:57 paul-laptop pppd[2846]: Plugin /usr/lib/pppd/2.4.4/nm-pppd-plugin.so loaded.
Jan  6 12:42:57 paul-laptop pppd[2846]: pppd 2.4.5 started by root, uid 0
Jan  6 12:42:57 paul-laptop pppd[2846]: Using interface ppp0
Jan  6 12:42:57 paul-laptop pppd[2846]: Connect: ppp0 <--> /dev/ttyUSB0
Jan  6 12:42:57 paul-laptop pppd[2846]: CHAP authentication succeeded
Jan  6 12:42:57 paul-laptop pppd[2846]: CHAP authentication succeeded
Jan  6 12:43:06 paul-laptop pppd[2846]: Modem hangup
Jan  6 12:43:06 paul-laptop pppd[2846]: Connection terminated.
Jan  6 12:43:07 paul-laptop pppd[2846]: Exit.

When I tried out usb_modeswitch, I didn't really know what I was doing. I guessed that the parameters (-v and -p) would be those identified in lsusb.  But as for how to know what mode it was in or how to switch it, I don't know.
paul@paul-laptop:~$ usb_modeswitch -v 12d1 -p 1003 -H -i 1

* usb_modeswitch: tool for controlling "flip flop" mode USB devices
* Version 1.0.2 (C) Josua Dietze 2009
* Works with libusb 0.1.12 and probably other versions

Looking for default devices ...
Found default devices (1)
Accessing device 000 on bus 002 ...
Using endpoints 0x01 (out) and 0x82 (in)
Not a storage device, skipping SCSI inquiry

Device description data (identification)
-------------------------
Error: could not get description string "manufacturer"
Manufacturer:
Error: could not get description string "product"
Product:
Serial No.: not provided
-------------------------
Sending Huawei control message ...
Error: sending Huawei control message failed (error -1). Aborting.

paul@paul-laptop:~$

UPDATE:

I've been wondering how I get another 'plan' into the Network Connection wizard. If my assumption about the APN is correct (that 'VirginInternet' applies to post paid, and 'VirginBroadband' applies to pre paid) then I'd want to add a plan called 'Prepaid' with the APN 'VirginBroadband' and if possible without CHAP.

Searching around, I found mobile-broadband-provider-info which, if you browse the source you'll find there is a serviceproviders.xml file which contains all of the definitions.

Using
find / -name serviceproviders.xml

I see the file exists at
/usr/share/mobile-broadband-provider-info/serviceproviders.xml

Editing this file, I can add the following under the Virgin provider, in the Australia region (just search for Virgin):
<apn value="VirginBroadband">
<!-- username and password can be anything, but password cannot be empty -->
<username>guest</username>
<password>guest</password>
<name>Prepaid</name>
</apn>

Now, I can open Network Connections and add a connection, selecting my new pre paid plan, and all I have to do is remember to disable CHAP as an option.

I love how open this all is and how easily I could find all this out. It took only a couple of minutes, while on the train traveling home from work. Awesome.

Looking at the README file in the source lead me to the information about ServiceProviders which includes how to contribute.

Now I just need to email this info to the code maintainers so that others have an easier time connecting to Virgin. And, I still have to investigate if there is any way to disable CHAP via the config.

Popular posts from this blog

Slow, Buffering, Stuttering Udemy Video

Intellij tip - Joining multiple lines into one

Looking for IT work in Australia? JobReel.com.au!