novacom in Gentoo

So the screen of the Palm Pre in my house recently cracked, rendering it unusable. I dusted off my dev-embedded/palm-novacom ebuild to do a device wipe before discarding it.

What I discovered was that in the year or so that has passed since the last time I used it, it had stopped working.

The problem turned out to be a libusb compatibility problem -- installing dev-libs/libusb-0.1.12-r7 did the trick, and the phone is now wiping itself quite satisfactorily.

It's a dead technology, and I have no more devices which need it, so I'm afraid that I won't be updating the ebuild any time soon. Still, I hope that this tiny post may have been of use to someone out there.


Adobe Flash in Ubuntu - 2012 edition

Now, I don't use Ubuntu very much. I have too many bad experiences with upgrades, and I've come to loathe apt-get. Still, there are a growing number of machines in my extended family which now run Ubuntu, either because I use them occasionally myself, or because it's easier to maintain at a distance than Windows (and harder to completely break through casual web-browsing!)

What I'm finding though, is that an average daily update of an Ubuntu machine is distressingly likely to break my (non-technical) users' ability to browse the web. I use Gentoo, and so I'm used to having to do a bit of work myself for major upgrades, but Ubuntu promises more than that -- it promises to bring Linux within the grasp of the average user -- and it fails. And where if fails is usually related to the deliberate separation of packages between those which agree with hardcore Free Software ideology, and those which don't. Canonical are forced to supply some "non-free" software, just to supply an environment which can support the "non-free" internet.

Coupled with this is apt's tendency to "update" config files without user input, something which is anathema to someone used to portage. If it always worked, then that would be fine ... but nothing is that reliable.

Case-in-point is the wrestling I had to do today to get a working version of the Adobe Flash plugin onto K's laptop. Some weeks ago, websites began reporting that the installed flash version was out of date, and linking on to the Adobe site for a manual installer. I checked with apt, and it reported that adobe-flashplugin was indeed at the latest version. The library was sitting at /usr/lib/adobe-flashplugin/libflashplayer.so, and had been replaced relatively recently. Some locate-use later, I was relatively reassured that the manual installer hadn't been run at some point, and that there wasn't some other version of libflashplayer.so sitting around somewhere in a linux-version of dll-hell.

So what was happening? I ran firefox through strace, to make sure that it was loading the library, and lo and behold, it was using files in /etc/alternatives instead.

$ strace -s trace=file firefox &> log &
$ grep -i flash log 

After some man-page and googling, I found this extremely unhelpful SuperUser question, and some indications that I wasn't alone.

So now, armed with the update-alternatives command, with it's completely unhelpful -h output, I eventually got a list of the flash-related "alternatives" which the system was using.

$ update-alternatives --get-selections | grep -i flash 

That got me a list of 5 "alternatives", and one immediately caught my eye -- libgnashplayer.so. I've no idea when, but at some point the machine had been instructed to switch it's flash player from Adobe's to the GNU replacement... only it's value as a drop-in replacement is questionable at best. I've a long history with flash-on-linux (strange as it sounds, it's gotten better and better), and I'd love a working open-source implementation. But gnash just isn't there yet. In my case, the main website that K was using was Channel 4's streaming service, 4od.co.uk, which wasn't even attempting to stream video, but failing on a version-number check. More on that later.

So armed with this info, I gleefully uninstalled gnash, expecting apt- to work its magic. Nope, it turns out, it just left a broken symlink in /etc/alternatives. Ubuntu whim has renamed the package for flash any number of times, and guides were recommending:
  • flashplugin-nonfree (seems to have gone out of favour, except that flashplugin-nonfree-extrasound is still around)
  • flashplugin-installer (quite why this name, I've no idea
  • adobe-flashplugin (Probably today's nom-de-jour)

Installing flashplugin-installer ended up removing about 5 flash-related packages, and installed the same version of the flash library as adobe-flashplugin. In the end, I removed that again, and stuck with adobe-flashplugin. Quite what their naming scheme is is beyond me, but preserving both in the repository doesn't make much sense to me. Oh, and you might notice that the documentation relating to all of this is completely out of date.

Another check of update-alternatives showed only adobe libraries, and a check of 4od (thankfully) played some video. So until the next time gnash gets pulled in, and overwrites all my settings, everything's working. Fantastic. Now time to file a bug suggesting that gnash always present it's version as whatever the latest version of adobe flash happens to be.


ComicCheck - Extension checker for cbr and cbz files

Having recently moved city, I left behind all of my dead-tree copies of books and comics/manga. I'm working around it with my old-ish Sony Reader and an ipad1 I won. I did a quick write-up of using the ipad in gentoo on the new wiki, but if you've a recent version of iOS, you'll need to build from version control (ebuilds to do this are available from my overlay).

I use CloudReaders to read comics, as it's nice and fast, even for images-only PDFs. The price (free) is right too! I use it both for textbooks and for comics. The only problems that I've come across is that it gets slow on launch if there are many files for it to parse through and that there's no way to remove labels from it's dictionary (even if there are no labelled files left). I'm also stuck with a blank label, which I now can't get rid of. Aside from that, it does the job perfectly well, with good responsiveness, zooming and auto-scaling. It's actually the best software PDF/comic reader I've ever used (although the tablet form factor is a major plus for it).

There are two problems that I've encountered using it, which are only somewhat its fault;
  • It uses the archive-order for zip and rar files, not the sorted-order
  • It relies on file extension, and many cbr and cbz files have an incorrect extension. (comicbook-rar, and comicbook-zip, but you probably knew that)

Since realising that a cbr should be a cbz at the time that I try to read one, and with no way to rename the files on-the-go, I wrote a script to check comics and rename them if it detects that they're not open-able with the appropriate unarchiver. Note that it depends entirely on the stdout from app-arch/unrar and app-arch/unzip as they exist today, so it may well fail in the future. Using EXIT_CODES would be nicer, and I no longer recall why I didn't; perhaps unrar didn't feel like co-operating. The script doesn't overwrite, and has the endearing property of renaming completely broken files every time (so keep an eye out on it's output).

Since the people packing these archives don't seem to be aware that archives have internal order that isn't lexical, sometimes you get files that have the same order as whatever the directory entries happened to be, and CloudReaders doesn't sort the extracted files before rendering them. I might patch the script to re-pack the archives in future, depending on how prevalent this is.

Oh, and the usual security caveats apply (although what you're doing managing comics on your ipad on a secure server is entirely your business... see this for a security flaw in usbmuxd which would allow someone with a specially-rigged iPad to run arbitrary code)

Available to view through through google code or below.

Normal Operation:
bar.cbz  foo.cbr
# foo.cbr is really a zip, bar.cbz is really a rar 

$ comiccheck 
!cbr foo.cbr
!cbz bar.cbz

bar.cbr  foo.cbz

$ comiccheck 


# swap_type FROM TO (eg. swap_type cbr cbz)
swap_type() {
 if [ ${1,,} == cbr ] ; then
  TESTSTART="unrar l "
  TESTEND="  | grep -i 'is not'"
 elif [ ${1,,} == cbz ] ; then
  TESTSTART="unzip -l "
  TESTEND="  2>&1 | grep 'cannot find zipfile'"
  echo "I don't know that type!"

 for i in *${1,,} *${1^^} ; do 
  TEST="${TESTSTART} \"${i}\" ${TESTEND}" 
  FAILTXT=$(eval ${TEST})
  # if not zero length, echo, try as zip, mv to cbz
  if ! [ -z "$FAILTXT" ] ; then 
   echo "!${1,,}: ${i}" 
   if ! [ -e "${toname}" ] ; then 
    mv "$i" "${toname}"
    echo "${i} is not a ${1,,}, but not overwriting ${toname}"


swap_type cbr cbz
swap_type cbz cbr

As usual, comments, patches are welcome.


Overlay Update - XBMC Beta Testers needed!

Perhaps it's a little odd to be writing an overlay update without ever having written about it before, but that's where we are today. In any event, I've just updated the list of packages in my overlay, and thought that it's about time to write about it and to make a call for testers.

My Gentoo Overlay is unimaginatively entitled 'jamesbroadhead', is hosted on overlays.gentoo.org and is accessible through layman (or paludis, if that's your kind of thing). I set it up as a holding ground for ebuilds that weren't quite ready for the sunrise commit process, or which were versions of packages in portage, and so ineligible for Sunrise. I've had mixed success pushing packages to the main tree - my ebuilds for Descent (the awesome '90s game) have been gathering dust for quite a while.

Obligatory Descent screenshot

The contents of the overlay, and a bug tracker for the ebuilds in it are available on my google code page, and gitweb for the overlay is here.

So why would you add the overlay? Well, the main package I regularly bump in sunrise is media-sound/gogglesmm - a very lightweight music player. It does two things rather well - play music, and start-up incredibly fast. If you want the latest version of that, or if you are having problems with the in-sunrise version, give that a try. I've had to patch the ebuilds for the fox toolkit to push for the unmasking of the x11-libs/fox:1.7 SLOT, including getting the SLOTting to work properly, so the version in Sunrise is a little out of date until those changes go live. Please test my overlay version!

gogglesmm-0.12.6 playing CC music from thisisopenmusic.com

Another (recent) reason would be to try out the latest version of xbmc - the 11-series betas have been around for a month now, and I have a working ebuild which I'm using here, but could do with more use-cases. If you try it, please post on the Gentoo Bugzilla with your experiences. If you haven't tried xbmc before, I find it a nice package for my home media center.

Oh, and I also bumped dev-python/selenium, so if you're into web-dev testing, that might be nice. I'll push it to sunrise ... some time soon.

Converting Nokia Ovi Suite Contacts for Android - 2012 Update

Seeing as my original post on converting Nokia OVI Suite contacts continues to get loads of hits, and I had to go through the process again for a friend's phone, I thought that I'd do a quick 2012 update. This will be a summary; if you're having trouble following it, take a look at the original post, which goes into more detail.

First off - things are a little easier these days! Gmail / Google Contacts now accepts multi-VCard .vcf files. Sadly, they still don't allow multi-file import, so the many output .vcf files must still be merged.

As a result, all you need to do is perform a full backup in OVI Suite, extract all the VCards from the the .nbu with NBUExplorer, and merge the VCards into a single file. Then, upload the resultant file to Gmail.

To merge the files, here's a quick snippet which I used in Cygwin:

 $ cat *.vcf >> merged.vcf 
According to Wiki, this is the DOS equivalent (but I don't even have dosbox installed right now to test it):
 $ copy /a a.vcf + b.vcf merged.vcf 
(Yes, that's a '+'; I'm not going to read up on DOS loops for you - just use cygwin).