Thursday 28 August 2008

Ubiquity for Firefox

Today I was introduced to a new Firefox extension called Ubiquity via the blog post from Mozilla labs. It's a completely different take on the user interface and usability of your web browser. This video explains better than I could...



It's only at version 0.1 right now and it's already amazing so I'm really looking forward to seeing new versions come out as it develops. I'm already a big fan and thoroughly recommend trying it out for something a bit different in your web browsing life!

Tuesday 26 August 2008

When is open source not open source?

I've been having a pretty major headache trying to get my SqueezeBox Duet to do media streaming ever since I bought it many months ago. The SqueezeBox is also the primary reason for buying a low power home server that I've been blogging plentifully about too. I'll save the post about my trials with the SqueezeBox itself for the day when I resolve the issue; either with a fix or by sending the darned thing back for a refund. However, it's got me thinking about some other things along the way while I've been trying to solve the various problems.

We're all familiar with open source. It can have a pretty simple definition i.e. where source code for a piece of software is made available publicly. Dealing with Slim Devices which are now a Logitech company has sparked thoughts about just how many different types of open source there are and when open source crosses the line to no longer feel like open source even if I can still download the source code.

I'm very used to working with what I think of as standard open source projects. These are the ones that generally started with one person writing something small to solve a problem they had or because they didn't like other versions of software trying to do the same thing. The more mature of these are generally run by a person or small group of individuals who control the project for the benefit of the community of users in a not-for-profit fashion. Numerous examples spring to mind, not least the Linux kernel itself, but huge amounts of different software some of which get grouped e.g. those from the Apache Foundation, KDE, Gnome, Mozilla; and those that stand alone e.g. Pidgin, X-Chat, Samba, rsync; to name just a few that pop into my head.

I think where I'm going with this post is to look at what happens when open source stops being not-for-profit and these projects tread the line between this standard type of open source project and become something else. This is where I've got to in my experience with SqueezeCenter, but clearly this isn't the first for-profit open source software. I have no idea what the first is/was but there are definitely some prominent examples out there such as MySQL. Slim Devices employ developers to write and maintain SqueezeCenter which is central (although billed as optional) to the hardware they sell. In their case, the software is free to use and completely open source, it's written in Perl. The way this model changes the community is quite interesting.

In my experience so far, instead of having lots of developers donating their time to the project to learn, fix, maintain and progress the code base, developers are paid to do this. In the case of SqueezeCenter this seems to cut down the community to just those developers paid to do so. Why would other people contribute to something for which they could be paid, or for which other people are paid? Plenty of people get paid to write code for the Linux kernel but in this and other examples there is a distributed interest for that code rather than the single point of interest of one company. In spite of the fact I don't feel compelled to contribute to SqueezeCenter directly though, I still take great comfort from knowing it's open source and I think that's where the benefit to Slim Devices comes from. If I did have a problem, I could fix it myself, maybe sending a patch or possibly maintain my own personal patch set if I got that deeply involved.

So how many types of open source are there and when does open source no longer feel like open source? A good philosophical point for debate for which I think there is no real answer. There are so many reasons for using the open source methodology that it can bring benefits in so many different ways whether you're a developer, employee, company or simply a user. Each open source project tends to have a different feel to it, in my experience so far this has generally been governed by those who run or contribute to the project. However, there are clearly some other factors that might determine what it feels like to be part of a project that releases its source code. I'm sure the reasons for these are as numerous as the benefits they bring.

Tuesday 12 August 2008

Byebye Ubuntu, Hello Fedora

My recent experiments with installing Ubuntu on my little home server came to an end this weekend. I'm working hard to debug problems with my media streamer software, SqueezeCenter. After finding tons of forum posts and various problems with installing SqueezeCenter on Hardy Heron I decided to try another approach so I'm now running Fedora 9 at home instead. Both Hardy and Fedora 9 are supposed to be supported by Slim Devices for their Squeeze-stuff. However, it appears neither of these work but I'll save that rant for another day once I've worked out what's wrong (I have my suspicions about Slim Devices testing against Perl 5.10).

I'm actually quite relieved to be back in my comfort zone with Fedora at home again. I really enjoyed the experience of playing with Ubuntu but it's just not for me for various reasons...

I've met quite a few Canonical guys in my professional role and they've all been great; helpful, very approachable and in the case of some, such as Jono Bacon very decent techies too. That's not my experience with non-Canonical Ubuntu contributors though. I found if the Ubuntu documentation (which is excellent for pretty much everything before Hardy Heron right now) failed me, then talking to the community was not a good experience. I found I was met with an abrupt RTFM attitude in most instances, where the assumption of the community is that people asking questions are dumb. Personally, I blame this on the typical Ubuntu user being non-technical where Linux is concerned so I guess the community receive lots of silly questions which must get annoying at times. All that said, I still believe Ubuntu is really important and plays an extremely valuable role in trying to bring Linux to a more mass audience.

I also found Hardy to be down level in various instances compared with the packages available in Fedora 9. The big one for me here, on my little server, is the OpenChrome drivers for the graphics chipset. Fedora have the version that supports my chipset, but when I asked about inclusion in Ubuntu there was no interest in updating the down level version in their repositories. I also enquired about the broken Via proprietary driver in Ubuntu which resulted in the Via driver being marked for removal! So rather than update the open drivers or fix the package for the proprietary drivers, the response was to remove the proprietary one and not update the open driver which left me in a position of manually maintaining my own graphics driver until the next major Ubuntu release.

I've used RPM and yum way more than I have deb and apt so I sway towards the former simply through familiarity. Having the chance to play with debs again recently has been great too, there's some nice additional touches you don't get with RPM such as the suggested packages and the ability to remove dependencies installed with a certain package, etc. Ubuntu have done a nice job of packaging this all up with Synaptic too. Aside from those few nice-to-haves I don't really see any other advantages to the Ubuntu system, yum and RPM would do exactly the same job when fronted by Synaptic but as ever in the world of open source having choice and competition is good.

Hiding root from the general user is a decent idea too, no need for that confusion in a simple desktop environment, and makes it feel a little closer to what people expect from a Windows box.

Gnome is the desktop of choice for both mainstream Ubuntu and for Fedora so I've been going with that recently instead of my usual choice of KDE. I've been really impressed with Gnome too, for a simple desktop environment it's fantastic but I know if I were to use it every day there would be some features and tools I use regularly under KDE that I would dearly miss. However, I think I've been converted for home use over to Gnome, particularly as KDE is going through turbulent times with their version 4 releases right now. Having everything written in one toolkit is really nice, you can't avoid running GTK and QT apps under KDE but at least under Gnome you have the option of not running QT and sticking with the same look and feel everywhere.

I hope I managed to stabalise on one distribution soon so SqueezeCenter actually works, I get the feeling that will likely be Fedora 8 in the short term until Slim Devices get their act together for Perl 5.10 if my current thoughts are correct. So for now at least it's goodbye to Ubuntu until the next time I give it a run somewhere.

Friday 8 August 2008

Mobile Internet over Bluetooth Part 2

Following on from configuring your mobile phone for Internet over bluetooth...

Once you have your device configured, the next thing you need is to connect over bluetooth to some machine to route your traffic for you. I have a laptop with built-in bluetooth and I'm running Redhat Enterprise Linux version 5. You need to configure and setup bluetooth, a ppp bluetooth daemon, and some simple routing to get your phone on the Internet. First off you need to pair your laptop with your phone, there's plenty of info on how to do this around the web and it's simple enough I'll assume you now have a GnuBox configured phone paired with your laptop.

First off you need to set up Internet Connection Sharing (in windows speak) or IP Masquerading (to anybody who know's what they're talking about), on Linux this is done with iptables. Insert the following rules:
  • iptables -A FORWARD -i ppp0 -j ACCEPT
  • iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
  • iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
The last rule for the postrouting chain should point to the interface on your laptop where you have an outgoing Internet connection enabled. In my case this can be either eth0 (the first Ethernet device) or wlan0 (my wireless device, could also be ath0, eth1, etc), so I insert two rules to cover both devices, even though I only show one of these above.

Enable IP forwarding:
  • echo 1 > /proc/sys/net/ipv4/ip_forward
With your bluetooth device turned on, and previously paired with your phone, now all you need to do is set up a ppp daemon listening for incoming bluetooth "serial" type connections. This can be done in a couple of easy commands, first to add the serial protocol to your bluetooth SDP server, then to set up the listening daemon:
  • sdptool add SP
  • dund -n --listen --msdun noauth 192.168.1.1:192.168.1.2 crtscts 115200 ms-dns lock
The second command will start a dun daemon on the command line that doesn't background itself so you can debug your connection if necssary. It will set up a point to point connection between your laptop and the bluetooth connecting device with IP addresses 192.168.1.1 and 192.168.1.2, you can replace these with any addresses you like. It will also ensure the connection is operating at a sensible speed and you should provide a DNS server that will be passed to the device to resolve Internet server names - you can see this from the contents of your current /etc/resolv.conf file.

Start your web browser on your phone and tell it to connect using the Bt access point you have already configured. On the command line on your laptop you should see something similar to:
    Using interface ppp0
Connect: ppp0 <--> /dev/rfcomm1
local IP address 192.168.1.1
remote IP address 192.168.1.2
This shows your phone and your laptop are now connected through a ppp serial type connection over bluetooth using the /dev/rfcomm1 device, your phone will have the IP address 192.168.1.2 and your laptop ppp0 device will have the ipaddress 192.168.1.1. Your phone should have 192.168.1.1 set as the gateway automatically by GnuBox and the DNS address will be passed when dund sets up the ppp connection as per your command line options. Once connected, you should be able to browse the web on your phone for free through your laptop!

As I said, I run Red Hat, which provides for several handy interfaces to help with the setup of Internet over bluetooth from my phone. Here are some further instructions specific, but not limited to, how I've done things on my machine so I everything happens neatly during boot and I don't need to run any commands to set up the connection...
  • You'll want your iptables rules in place when you boot, you can append rules to /etc/iptables.d/ to do this:
    • Add the following lines to a file in /etc/iptables.d/filter/FORWARD/
      • -A FORWARD -i ppp0 -j ACCEPT
      • -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
    • Add the following lines to a file in /etc/iptables.d/nat/POSTROUTING/
      • -A POSTROUTING -o eth0 -j MASQUERADE
      • -A POSTROUTING -o ath0 -j MASQUERADE
  • Use sysctl to configure IP forwarding at boot time
    • Add (or change) the following definition in /etc/sysctl.conf
      • net.ipv4.ip_forward = 1
  • Register the serial protocol at boot time for your SDP server
    • Add the following line to the start definition after SDP is started in /etc/init.d/bluetooth
      • sdptool add SP
  • Start the dund daemon at boot time with the correct configuration options
    • chkconfig dund on (to start the service at boot time)
    • Create a file called /etc/ppp/peers/dun with the following contents
      • noauth
      • 192.168.1.1:192.168.1.2
      • crtscts 115200
      • ms-dns
      • lock
    • Edit the file /etc/sysconfig/dund so you have the following configuration
      • DUNDARGS='--listen --msdun call dun'
These settings should be enough that you can connect your phone to your laptop without having to modify any settings or start any services every time you boot. Once all the services are configured and started, and your phone is paired with the laptop, you will be able to connect to the phone's Bt access point to access the Internet any time you're in range of your laptop.

Tuesday 5 August 2008

Mobile Internet over Bluetooth Part 1

I'm one of these "mobile phones are for calls and texts" types, but last year I bought a new phone, shoved in my PAYG SIM, and set about working out how I could connect it to the Internet. I have a Nokia N73 so it doesn't do wifi but I still wanted to be able to synchronise to my Google Calendar. For me this doesn't involve using the Nokia tool set as they're all Windows based. I found out it's possible to do IP over bluetooth on the N73 so I got it going that way. This is great for cheap data connection, I can maintain a PAYG SIM and get as much data as I like for free, but obviously only when I'm in bluetooth range of my laptop. That's absolutely fine for something like calendar synchronisation, which is all I need.

What's sparked off this post is I've just got a new laptop and so I looked out my notes on how to do IP over bluetooth once again and have now got it going on my new machine too. For the benefit of anyone else who might want this type of setup, here's what I did for the phone (how to set up the data connection on the laptop will be coming in Part 2)...

My N73 runs Symbian S60 version 3. This type of phone has all the required software and hardware built in to do what I want. All you need to do is alter the communications database to set yourself up a bluetooth access point and you're done. The problem here is, the mobile network operators don't want this option exposed on your phone so you have to pay them for a data connection. With a little research you can discover third party open source apps to make the necessary modifications to your database to enable these options, I found and am using one called GnuBox.

GnuBox works nicely enough, but getting it going on S60v3 can be tricky. The developer makes the app available for S60v2, hence it doesn't need to be signed in order to access the features locked down on your S60v3 phone. GnuBox requires write access to your comms DB which requires the app to be signed on S60v3, you can't download a signed version, so we're into the realms of self-signing in order to get this working on S60v3. So for S60v3 you need to get hold of a tweaked version of GnuBox, sign it for your phone, install and configure.

Grab the S60v3 version (search for gnubox_s60v3.sis) which must then be signed for your phone (since writing the instructions below, it's become possible to sign symbian apps online at symbiansigned.com):
  • sign up for an ID at http://symbiansigned.com
  • download their certificate request application
    • sadly this is a windows only app, but find yourself a windows box and install+start the app
    • Select an output file for your *.csr file (say gnubox.csr)
    • If you don't have an ACS pub ID, select No. Then select your key output filename *.key (say gnubox.key) and pick a password
    • Fill out the personal info and your IMEI number, find your IMEI by typing *#06# on your phone
    • Add all the capabilities to your certificate request, from the left box to the right
    • Log into symbiansigned.com, click the "My Symbian Signed" tab and upload your gnubox.csr file.
    • You will automatically be taken to the dev cert page. You can download your certificate file (*.cer) to your machine.
  • now you need the signsis files package to sign your app for your phone with your developer certificate
    • run the signsis program, signsis.exe -o -s -v gnubox.sis gnuboxs.sis gnubox.cer gnubox.key [ENTER]
    • This will use your certificate file and key to sign the gnubox.sis file and output gnuboxs.sis for your phone.
    • You can copy gnuboxs.sis to your phone and install it. You will get a warning about it being signed with a developer certificate!

You now have the software in place to configure Internet over bluetooth on your phone, so lets do just that:
  • On the phone go to, Tools -> Settings -> Connection -> Access points, to set up a new access point
    • Options -> New acces point -> use default settings
    • Name the access point, Bt, GnuBox uses this name internally so make sure it is called Bt case sensitive (it stands for bluetooth, duh!).
    • Change the data bearer to "Data call"
    • Set any old dial up number, say 321, this is not at important as it will be nulled by GnuBox later anyway
    • Set a username/password combination with prompt password set to No. Say abc/xyz for username/password, also not important.
    • You should be able to leave the rest of the settings, including, options -> advanced settings, alone!
  • Now start GnuBox, it's installed and located in your applications folder.
    • The phone number you just entered is printed on the screen, but the ModemBearer should still show nothing
    • Go to Options -> Install -> Create records
    • Exit GnuBox with Options -> Exit
    • Start GnuBox again, the ModemBearer should now be set (the exit of GnuBox was just a sanity check to show you this)
    • Select Install -> Set RAS login script
    • Then select 2box bluetooth -> Serial Port, which will tell GnuBox to set a point to point connection between 2 machines when you "dial" your Bt connection later

Thats it, you now have Internet over Bluetooth capability on your phone. The next step is to connect to another machine to act as your router to the Internet, but that's for my next post.

Friday 1 August 2008

What Ubuntu Thinks of a TinyTuxbox

I've been meaning to log some, I think I'll call it... Linux type stuff, to do with the TinyTuxbox for a while. Here's my attempt to look at what Ubuntu makes of this little box.

First, the CPU (from /proc/cpuinfo):
processor : 0
vendor_id : CentaurHauls
cpu family : 6
model : 13
model name : VIA Eden Processor 500MHz
stepping : 0
cpu MHz : 498.706
cache size : 128 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge cmov pat clflush acpi mmx fxsr sse sse2 tm nx up pni est tm2 xtpr rng rng_en ace ace_en ace2 ace2_en phe phe_en pmm pmm_en
bogomips : 998.77
clflush size : 64


The interestingness here comes from the fact we have a 500MHz Via Eden with 128k cache and just under 1000 bogomips which (although it shouldn't be) is often used as a trivial performance metric of a processor. Next, lets have a look at what's on the PCI bus (courtesy of lspci):
00:00.0 Host bridge: VIA Technologies, Inc. CX700 Host Bridge (rev 03)
00:00.1 Host bridge: VIA Technologies, Inc. CX700 Host Bridge
00:00.2 Host bridge: VIA Technologies, Inc. CX700 Host Bridge
00:00.3 Host bridge: VIA Technologies, Inc. CX700 Host Bridge
00:00.4 Host bridge: VIA Technologies, Inc. CX700 Host Bridge
00:00.7 Host bridge: VIA Technologies, Inc. CX700 Host Bridge
00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI Bridge
00:08.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
00:0f.0 IDE interface: VIA Technologies, Inc. CX700M2 IDE
00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 90)
00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 90)
00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 90)
00:11.0 ISA bridge: VIA Technologies, Inc. CX700 PCI to ISA Bridge
00:11.7 Host bridge: VIA Technologies, Inc. CX700 Internal Module Bus
00:13.0 PCI bridge: VIA Technologies, Inc. CX700 Host Bridge
01:00.0 VGA compatible controller: VIA Technologies, Inc. CX700M2 UniChrome PRO II Graphics (rev 03)
02:01.0 Audio device: VIA Technologies, Inc. VIA High Definition Audio Controller (rev 10)


Highlights here come from the Realtek Ethernet which is well catered for out of the box by pretty much any major Linux these days. There are also two IDE controllers, USB controllers and an audio controller that are all well supported. It's interesting that most of the PCI devices are provided by the single CX700M2 chipset which I believe is built onto the processor board for the Via Eden's. The one thing from this list that has been a pain in the back side is the graphics controller. It works out of the box both in frame buffer mode and via the open source via unichrome driver called Openchrome. However, Openchrome don't support the CX700M2 board yet (not officially anyway, the code is still in SVN according to the guys I spoke to on their IRC channel) so graphics processing was eating lots of CPU. Fortunately, I found a link to later via drivers at linux.via.com.tw than are available through the official Via driver site where they're still only supporting Ubuntu 7.04 and 7.10. Seems I'm caught in the middle for now, the Via drivers work nicely but will be a pain to maintain until the Openchrome drivers find their way into Ubuntu and I switch back over to them.

Then there's the memory. For a small box this one has a relatively generous helping of 512MB RAM, some of which is stolen by the CX700M2 for graphical shared memory. Free is currently showing 439MB total memory, 390MB used and 49MB available; swap is 100% free. That's not bad at all considering I'm running Xorg with Gnome, SSH, SqueezeCenter, 2 instances of MySQL (SqueezeCenter starts its own instance), and a Nanobroker with some Perl code to log my Current Cost data. It'll be running Apache soon too as I move towards writing some more web based Current Cost facilities.

Just in case anyone is interested, here's the list of modules currently loaded into Ubuntu's 2.6.24-19-generic kernel: drm af_packet ipv6 cpufreq_powersave cpufreq_conservative cpufreq_ondemand cpufreq_stats freq_table cpufreq_userspace sbs container sbshc video output dock battery iptable_filter ip_tables x_tables ac parport_pc lp parport loop snd_hda_intel snd_pcm_oss snd_mixer_oss snd_pcm snd_page_alloc snd_hwdep snd_seq_dummy snd_seq_oss snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer snd_seq_device snd soundcore serio_raw evdev psmouse pl2303 usbserial pcspkr button i2c_viapro i2c_core shpchp pci_hotplug via_agp agpgart ext3 jbd mbcache sg sd_mod pata_acpi pata_via ata_generic 8139cp ehci_hcd uhci_hcd libata usbcore 8139too mii scsi_mod thermal processor fan fbcon tileblit font bitblit softcursor fuse

I'll spare the full dmidecode output but from this information I can determine it has an AMI Bios version 8.14 released on 03/28/2008. The CPU is listed with, amusingly, Family "out of spec" and 128K L1 parity cache and 128K L2 ECC cache. A single soldered 512MB Dimm.

I'm still surprised at just how well it matches up to being a standard x86 box, providing all the interfaces you would expect of such a box given its size. Clearly it's never going to be the fastest or have the most memory, but it really does stack up nicely for all but the most intense home serving tasks or gaming. It certainly shows me we can fill most of our computing needs with such a small box and only 8 watts of power. Ubuntu seems no problem for it and it's reported to run Windows XP too. I'll definitely be bearing it in mind next time someone asks me to recommend a box simply for browsing the web, e-mail or a bit of word processing!

<Edit>
Memtest86+ shows the processor as a Via C3 Samuel 2 clocked at 498.7MHz, 128K L1 cache @ 2035MB/s, it doesn't detect L2 cache, and shows 447MB RAM @ 367MB/s.
</Edit>