Monday, 25 January 2010

My first linux contribution is a disaster

So I recently submitted a patch to the NetworkManager component: https://bugzilla.gnome.org/show_bug.cgi?id=607731  - but it turns out to be a duplicate because this problem was addressed in https://bugzilla.gnome.org/show_bug.cgi?id=600779 - by default Bugzilla doesn't seem to include 'resolved' defects in the search results. You have to go to advanced search and select all statuses.

So, if my patch wasn't needed, and this issue has been resolved, then why doesn't the source code in trunk have this change? Bug 600779 mentions that service providers is deprecated, but by what? Ubuntu 9.10 still uses it, because when I edited /usr/share/mobile-broadband-provider-info/serviceproviders.xml it worked fine for me.

If service providers is deprecated, then why isn't there something on the homepage? Bugzilla doesn't seem to report which source files were changed in a bug - something I quite like in JIRA. See comment #1:

VirginInternet would still be used for tethering a phone, but I've added
VirginBroadband. Thanks!


But what got changed? That would give me a clue.

Checking the version I'm running:
paul@paul-laptop:~$ dpkg -s mobile-broadband-provider-info
Package: mobile-broadband-provider-info
Status: install ok installed
Priority: extra
Section: admin
Installed-Size: 180
Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>
Architecture: all
Version: 20091009-0ubuntu1
Breaks: libmbca0
Description: database of mobile broadband service providers
Contains service provider specific settings of mobile broadband providers in
different countries.
Homepage: http://live.gnome.org/NetworkManager/MobileBroadband/ServiceProviders
Original-Maintainer: Antti Kaijanmäki (Wellark) <antti@kaijanmaki.net>

So if Ubuntu are still using it then why wouldn't there be patches and maintenance releases?

Now, searching for Ubuntu specific information turns up NetworkManager provider information which doesn't have the Virgin APN I need. So how do I fix this? Well, it says:
If you discover you need provider information from here or elsewhere, please file a bug against the mobile-broadband-provider-info package so we can improve the experience for all users to a level where all providers Just Work out of the box. https://bugs.launchpad.net/ubuntu/+source/mobile-broadband-provider-info

As today (16/01/09) bug #317860 at Launchpad cover a lot of Service Providers missing. (https://bugs.edge.launchpad.net/ubuntu/+source/mobile-broadband-provider-info/+bug/317860)

I'm was stunned to find out that this type of generic information was window manager specific (GNOME) now it looks like it is distribution specific (Ubuntu). If anyone can tell me the reasoning behind this, I'd love to know. Because right now, it looks crazy to me. Especially from a point of view that I just want to contribute something. It's kind of weird that it's even Operating System specific really, it really just should be a web service available to anyone and everyone, and the Operating Systems just update from it. Anyway... continuing the saga...

This bug report makes interesting reading. Apparently everything was fixed last year: https://bugs.launchpad.net/ubuntu/+source/mobile-broadband-provider-info/+bug/280490

It also says that the Virgin website documents the APN being VirginBroadband. But that page doesn't exist any more. I can only find one reference to APN on their site, and thats the wrong one.

So, I've updated the Ubuntu wiki to add the Virgin APN to the list of providers. I wasn't sure whether to update the Mobile Broadband Cards section with the Huawei e160e, since they've already got the 160 and 160g. But I can't find any source code - I got as far as finding this: http://packages.ubuntu.com/source/lucid/mobile-broadband-provider-info - but the trail ends there.

Anyway, I've spent way too long on this. What started out as a simple patch has only shown me how little I know about the Linux environment, packages, and how the source is maintained. Maybe over time I'll get more familiar with it all.

Saturday, 23 January 2010

Week in Review - 2010-03

Its been a good week. I got my Virgin Mobile Broadband Prepaid 3G modem working, and learnt a lot in the process, and actually contributed to the GNOME project: https://bugzilla.gnome.org/show_bug.cgi?id=607731

As part of this, I installed Pidgin so I could join the IRC channel and talk to developers, but I haven't yet figured out how to view the history for a channel - so I can see what happened while I was offline...

It does surprise me though, that the database for mobile broadband providers is specific to the window manager (GNOME) instead of being a system level thing. I'm sure there are good reasons, and it probably doesn't matter, but what do the KDE (and others) users do? Define it all over again?

Worse than that though is that Virgin don't seem to make the APN easily available. I found it by searching the web, and finding it in forums, but why isn't it in the FAQ on a Virgin site?

I didn't anticipate how much I'd enjoy having access to the internet while training it back and forth from work (1hr train ride) but I'm loving it. I'm pretty sure the documentation that came with the modem says to keep it at least 15cm away from the body, so its attached via the provided usb cable, and sits in my bag on the floor a good distance away.

I've taken to using VLC Media Player as my favourite media player - it lets me use a minimal interface (video only, no controls displayed) to minimise real estate and has an 'always on top' option. This means I can put the video in a corner of the screen and program away - it works well.

I've also been playing with Wordpress:

  • customising the  Thesis theme,

  • using a static page for the home page,

  • learning that I can turn commenting off for individual pages/posts

  • specifying excerpts so the teasers are better


Also, I've read up a bit on Joomla. I haven't installed it yet, but I've been meaning to look into CMS alternatives to Wordpress for a while. It was frustrating understanding exactly what it could do until a friend pointed me to this resource : http://www.cmsmatrix.org/matrix/cms-matrix/joomla

Thursday, 21 January 2010

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.