2014-02-15

Cyanogenmod 11 (KitKat) on a Samsung Galaxy S2 i9100

Getting an Android phone running CM with root and a sim unlock still seems to be an exercise in trawling out-of-date forum posts and downloading a variety of tools, kernels and ClockworkMod builds until you hit on a good combination and can actually get into CWM. After that, installs for me have always been really simple.

So; here's the magic combination that worked for me today; resulting in an unlocked Cyanogenmod Kitkat install. Generally, I was following the Cyanogenmod guide for the device, but relied on various forum posts and some articles on ibtimes.co.uk to get there in the end.

  • ODIN v.3.0.7. 
    • Heimdall repeatedly failed for me, and guides suggesting ODIN v.1.8.5 are out of date. 
  • GT-I9100_JB_ClockworkMod-Recovery_6.0.2.9.tar 
    • Installed under 'PDA' in ODIN, above. 
    • This build of CWM can't actually install Kitkat, resulting in "set_metadata_recursive: some changes failed" caused by a change in the image format since JellyBean. Some info here. Still, you need it to bootstrap the CWM upgrade below.
    • Unfortunately, this seems to have broken mass storage support on the device, which made getting the next few zip files onto the SD card a little tricky for me. If this happens to you, install the Android dev tools, and use `adb push`. 
  • CWM-KitKatCompatible-i9100.zip, 
    • This contains a build of CWM 6.0.4.5, which can actually install Kitkat. 
    • Install this from its zip in CWM, then reboot. Check the version of CWM at the top to make sure that it succeeded.
  • UPDATE-SuperSU-v1.25.zip
    • installed via zip from CWM 
  • cm-11-20140215-NIGHTLY-i9100.zip
  • gapps-kk-20140105-signed.zip
  • Galaxy S2 SIM Unlock
    • from the Play Store after you've rebooted into CM


As a final note, I did install the jeboo_kernel_i9100_v1-2a.tar early in the process, which may have helped me get into ClockworkMod later on. I'm not 100% on whether it's necessary or not.


2012-10-27

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.

2012-03-30

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.

2012-03-12

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:
$ls 
bar.cbz  foo.cbr
# foo.cbr is really a zip, bar.cbz is really a rar 

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

$ls 
bar.cbr  foo.cbz

$ comiccheck 
$

#!/bin/bash

# swap_type FROM TO (eg. swap_type cbr cbz)
swap_type() {
 FAILTXT=""
 BIFS=${IFS}
 IFS=""
 
 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'"
 else
  echo "I don't know that type!"
  return
 fi

 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}" 
   toname="${i/%$1/${2,,}}"
   if ! [ -e "${toname}" ] ; then 
    mv "$i" "${toname}"
   else
    echo "${i} is not a ${1,,}, but not overwriting ${toname}"
   fi
  fi

  FAILTXT=""
 done
 
 IFS=${BIFS}
}

swap_type cbr cbz
swap_type cbz cbr

As usual, comments, patches are welcome.

2012-01-27

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).

2011-09-25

The 7th Guest (DOS) in Windows XP

Having recently received a copy of The 7th Guest from a relative cleaning out their attic, I've finally found time to give it a try. Now back in the day, this game had a serious reputation as being absolutely terrifying, so I've no idea what to expect. It's funny how the era of FMV completely ran out of steam. Was it the sheer cost of filming? The materials costs (I remember playing Wing Commander IV on 6 CDs, which seemed like madness at the time). Lack of interest? In any event, it's a little ironic that now that we're approaching photo-realistic in-game rendering, we seem to be going back to cinema-styles as a means of story-telling for games.

So my initial problem is going to be getting it to run in Windows XP. I have a copy of Windows 7 on my desktop, but my trusty laptop still runs WinXP (it has a Vista licence on the back, but lets not go there ... ). Looks as though it's fully supported by DOSBox, which is helpful; an abortive attempt to run the installer using cmd.exe got me errors due to having too many partitions, and my CD drive not being D:. For convenience, I've ripped the CDs to .isos, since I've no interest in carrying them around.

It's kind of funny going back to 1993-era BBSes (mirrors, obviously) looking for patches, seeing FILE_ID.DIZ and the like. There are a few guides to getting this game to work in WinXP, but I wanted to chip in my own experience.

It looks as though the game was patched a few times, and there are three initial "graphics" patches, and other "version" patches. First off, the graphics patches, distributed separately as: T7GF3A.zip, T7GF3B.zipand later combined into T7GFIX3.zip.

Perhaps T7GFA and B were released separately, but I don't have those details. What's important though is to figure out what's actually required for a fully-patched install of the game.

Conclusion: You do not need T7GF3A.zip or T7GF3B.zip, which some other sites seem to think should be installed before the T7GFIX3 contents. The only major difference is save.z, but this is probably also in the 1.30 patcher. You should still install the contents of T7GFIX3.zip.

To do the comparison yourself, do the following (but it's not necessary)
$ for i in T7GFIX3 T7GF3A T7GF3B ; do 
  mkdir -p $i ; cd $i ; unzip ../$i ; cd .. ; 
done
You might notice that both T7GF3A.zip and T7GF3B.zip contain versions of INSTALL.EXE and V.EXE, but a quick Simple File Verification with your tool of choice will tell you that they're the same.
$ cksfv T7GF3*/INSTALL.EXE T7GF3*/V.EXE
; Generated by cksfv v1.3.14 on 2011-09-25 at 12:49.16
; Project web site: http://www.iki.fi/shd/foss/cksfv/
;
;        23473  14:19.44 1993-08-10 T7GF3A/V.EXE
;        23473  14:19.44 1993-08-10 T7GF3B/V.EXE
;        43704  18:55.52 1993-07-23 T7GF3A/INSTALL.EXE
;        43704  18:55.52 1993-07-23 T7GF3B/INSTALL.EXE
T7GF3A/V.EXE 8E727A9E
T7GF3B/V.EXE 8E727A9E
T7GF3A/INSTALL.EXE 4033D8EE
T7GF3B/INSTALL.EXE 4033D8EE
Now let's see if there's any difference between the combined patches and the released combined version.
$ diff -r T7GF3combo T7GFIX3
Only in T7GF3combo/: README.TXT
Only in T7GF3combo/: READTHIS.NOW
Only in T7GF3combo/: SAVE.Z
Only in T7GF3combo/: T7G.BAT
Only in T7GF3combo/: T7GDEMO.BAT
Only in T7GFIX3/: T7GFIX3.TXT
Files T7GF3combo//V.EXE and T7GFIX3//V.EXE differ
So lets take a look at the differences. README.TXT is a copy of the original Readme which shipped with the game, and READTHIS.NOW is an advert for the BBS which must have hosted the files at some point. (If you haven't seen the excellent BBS: The Documentary, then go and get hold of a copy and learn something new about internet history. I'll put a copy of the BBS advert at the bottom of this post.

T7GFIX3.TXT announces a new version of V.EXE which "only requires 450K of memory". We'll bear this in mind later.

So that leaves the batch files, which contain:
$ cat T7GF3combo/T7G.BAT
@v !
$ cat T7GF3combo/T7GDEMO.BAT
@v @

So they both call v.exe, one passing arguments, the other dropping them(? I'm not going to spend any time looking up what they actually do, I have no interest in learning Dos / Batch )
On to SAVE.Z, which only exists in the separate version of the patching. I don't know what its function is. I know that later patches enable "Open House" mode, which allows access to all the puzzles but without the Adventure aspect of the game. Perhaps this is an early release of this, that they left out of the combined patch(?) Here are the contents:
$ hexedit T7GF3combo/SAVE.Z # for lack of a better tool
$ # (copy and paste the contents ...)
00000000   11 12 1F 22  24 15 14 10  17 11 1D 15  F4 00 00 00  00 00 00 00  00 00 00 00  ..."$........
... which doesn't mean much to me.
This leaves two versions of V.EXE, on top of the one installed direct from the CD. For reference, I'll include the output of my VERSION.BAT which, if it does what it claims, is a pretty nifty idea that many other games could have done with (I may also update the article with details of the post-patch install's version of v.exe).
$ cmd
C:\Games\7thguest> version
WELCOME TO THE 7TH GUEST
European Version 1.2
C:\Games\7thguest> exit
$ cksfv /cygdrive/c/Games/7thguest/V.EXE T7GF3combo/V.EXE T7GFIX3/V.EXE
; Generated by cksfv v1.3.14 on 2011-09-25 at 14:15.27
; Project web site: http://www.iki.fi/shd/foss/cksfv/
;
;        21473  16:55.28 1993-05-20 /cygdrive/c/Games/7thguest/V.EXE
;        23473  12:45.34 2011-09-25 T7GF3combo/V.EXE
;        23425  14:44.28 1993-07-21 T7GFIX3/V.EXE
/cygdrive/c/Games/7thguest/V.EXE C7D27409
T7GF3combo/V.EXE 8E727A9E
T7GFIX3/V.EXE 6FD2868B
$ ls -la  /cygdrive/c/Games/7thguest/V.EXE T7GF3A/V.EXE T7GF3B/V.EXE T7GFIX3/V.EXE
-rwxrwxrwx 1 broadhej None 21473 May 20  1993 /cygdrive/c/Games/7thguest/V.EXE
-rw-r--r-- 1 broadhej None 23473 Aug 10  1993 T7GF3A/V.EXE
-rw-r--r-- 1 broadhej None 23473 Aug 10  1993 T7GF3B/V.EXE
-rw-r--r-- 1 broadhej None 23425 Jul 21  1993 T7GFIX3/V.EXE
So the separately packaged patch actually has a different binary, with the combined patch having the newer version.
So there we have it -- the only effective difference between installing the separate patches first, and then the later release is that you end up with Save.z. I don't know what it does, but I'm willing to guess that it's Open House mode which the later 1.30 patch will install anyway.

Here's the ad for the BBS.
$ cat T7GF3combo/READTHIS.NOW
   ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
   º P-80 Has been online full      ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
   º      time since HALLOWEEN      º  !!! P-80 SYSTEMS !!! º
   º      ---------1980--------     º       ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
   º      _____________________     º       º If you would like to order   º
   º      110 Baud Through 57,600   º       º THE HACKER CHRONICLES CD or  º
   º      U.S. Robotics Courrier    ÌÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍ» you would like to  º
   º      Multiline HST/Dual/V.all  º Data:50000+Filesº Join the P-80 BBS! º
   º                                º                 º                    º
   º      24 Hrs US. Eastern Time   º  Fun For All    º Call:              º
   º      All Files=Virus Prescan   º  All For Fun.   º 304-744-2253 BBS   º
   ÈÍÍËÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ                 º                    º
      º Call today º  * * * * * * * * * * * * * * * * º                    º
      º and take a º  Multi Laser Disk system with a  ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍͼ
      º trip with  º  combined logical storage of overº We are one of  º
      º   out a    º  15,000 Megabytes (15 Gigabytes) º the first ten  º
      º  suitcase  ÈÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍͼ BBS's in the   º
      º                      º             º U.S. to go online. ^*^    º
      º Fax on Dial-Back!    º             º Sysop: Scan Man    \_/    º
      ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ             ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ