Hacking the iPod Touch / iPhone - Part 3

Right! so you had plenty of time to purchase the touch or the iphone and Steve had enough time to cut me a check for the previous 2 articles. But since the later didn't happen, lets just concentrate on the former - but this time in combination with GNU/Linux.

Once the new line of ipods were released, it was soon obvious that third party media players, such as gtkpod/amarok/winamp, were no longer able to sync with them. Whether this was intentional or just a consequence of Apple improving things will depend on who you ask :) Fortunately though, (ipod Linux?) hackers managed to figure out a way to get syncing working again - in just a couple of days, might I add!

Unfortunately the ipod touch/iphone is another beast altogether! Neither support the USB mass storage modes and instead rely on a proprietary message passing method that is yet to be deciphered.So AFAIK, neither of the two devices can sync over USB as far as gtkpod is concerned. Hopefully someone will figure it out or we may not need it after all if as rumored, Apple adds USB mass storage using a firmware update. But rather than languishing on what may or may not happen, lets see how it can be done at the moment.

Before you begin, make sure you have a Jail broken iTouch/iPhone with OpenSSH server installed and running.

Mounting the iPod Touch

While we may not be able to mount the iTouch as a USB mass storage device, we can mount it over the network - provided it has been Jail broken. The easiest method, which I'll discuss involves mounting the device over SSH with the help of sshfs fuse driver, a user space kernel driver. Other methods you might want to look into are the Apple File Share (AFP) and Samba which are installable on the Touch.

Before you can mount over sshfs, you need to install fuse and the sshfs driver. On Ubuntu, this would go something like:

# apt-get install sshfs

You might also want to load the fuse driver manually if you get an error in the next step.

# modprobe fuse

Create a mount point (in your home directory) to mount the iTouch and mount it using its ip address.

$ mkdir ~/mnt_itouch
# sshfs -o allow_other root@<ip_of_itouch>:Media mnt_itouch

You should now be able to see the content of your itouch on mnt_itouch directory.

Compiling GTKPod

At the time of writing, you needed the svn version of libgtkpod and gtkpod in order to support the hack explained earlier w.r.t the new ipods. Hopefully by the time you read this, you might be able to use the stock version that come with your distro of choice. If not, there is a good howto. These are basically the steps involved.

$ mkdir gtkpod
$ svn co https://gtkpod.svn.sourceforge.net/svnroot/gtkpod/gtkpod/trunk gtkpod
$ svn co https://gtkpod.svn.sourceforge.net/svnroot/gtkpod/libgpod/trunk libgpod
$ mkdir ~/local
$ cd libgpod
$ ./autogen.sh --prefix=/home/<user>/local
$ make && make install
$ cd ../gtkpod
$ PKG_CONFIG_PATH=/home//local/lib/pkgconfig ./autogen.sh --prefix=/home/<user>/local
$ make && make install

Create a small launch script for gtkpod as follows

$ cd ~/local/bin
$ echo 'LD_LIBRARY_PATH=/home/<user>/local/lib /home/<user>/local/bin/gtkpod' > gtkpod.sh

New hack: Getting the Firewire GUID and setting it in libgpod

The hack for the new ipods require something called a firewire GUID to be taken (I think its used as a salt in the hash algorithm) and written so libgpod can use it. For this, you need to plug in the iTouch over USB and wait a couple of seconds for things to settle before executing:

# lsusb -v | grep -i iSerial | head -n 1 | sed -e "s/.\+3[ ]//"|cut -c1-16

$ echo 'FirewireGuid: 0xa12b3c1a35c7ba56' > ~/mnt_itouch/iTunesControl/Device/SysInfo

Now if you launch gtkpod via gtkpod.sh it should recognize your iTouch automatically (since its mounted on your home directory). Before you sync any files, it would be a good idea to select the ipod touch / iphone model from the list available on gtkpod.

There are still some issues with this method (at the time of writing):

  • Album art doesn't seem to work.

  • Only preliminary support for Photo management. I could only view and download photos. Not upload new ones.

  • Podcast playlist not supported. AFAIK this isn't quite supported with old ipods with gtkpod. But it does work with old ipods on amarok - not sure why.

  • Slow, very slow syncing large files. I think this is a result of mounting over ssh. The encryption must be stressing the iTouch processor. May be the Samba or AFS is faster here.

Another tip if you plan on using iTunes and gtkpod is to use the SwapTunes.app on the iTouch to keep two copies of the iTunes database - one for iTunes and the other for gtkpod. This way you risk less, corrupting the iTunes database.

Thats it for now. As always, do check out the comments for additional things I may find after writing this. In the next article, I'm hoping to write a little about the productivity apps as well as some other cool apps focusing once again on desktop integration (spelled GNU/Linux desktop integration). Till then, enjoy your technology! (sorry Cali)


Anonymous said…
Great Article. But i found an easier way to connect to your ipod with necessarily installing the SSH server on the iPod. Using any FTP client, just simply go to the address of your iPod with the username: root and pwd:alpine and now you can manage your iPod like an online FTP server.
geekaholic said…
I think you mean SFTP and not FTP. Yeah thats ok to transfer files but wont work with tools like GTKPod which expects a local file system. So you need to mount over sshfs or samba.
Anonymous said…
Many thanks for this guide!

Worked like a charm. A few minor tweaks were needed, so I thought I'd share in case other people are confused.

The line starting PKG_CONFIG_PATH=/home//local/lib/pkgconfig is missing a 'user' bit for people to fill in between the double forward slashes.

And the line:

lsusb -v | grep -i iSerial | head -n 1 | sed -e "s/.\+3[ ]//"|cut -c1-16

Didn't work for me as the GUID wasn't in the first line matching the grep. This might work in more cases:

lsusb -v | grep -i iSerial | egrep '[a-f0-9]{16}' | head -n 1 | sed -e "s/.\+3[ ]//"|cut -c1-16

Thanks again.
Glasser said…
I can't seem to get my iPod recognized by lsusb, so I can't get the FirewireGUID (resulting in a corrupt database).

geekaholic said…
Strange. What distro/kernel (uname -r) are you on?

Are you trying the command as root? See if you get anything for lsusb -v | grep -i iSerial
Zebedee said…
This comment has been removed by the author.
Zebedee said…
First thanks a million - you're the first to lay out the steps in a clean and WORKING way! I owe you!

But I found just a minor tweak in your instructions that was required for my case: sshfs wouldn't mount to "IP#:Media" so I had to qualify with the path on the iTouch as "IP#:/var/mobile/Media"

Took me a while to find where Apple hid that squirrel nut! (hahaha)

Everything worked well after that - if you know why "Media" wouldn't work I'd love to know. Thanks again!

For others out there: This fine gentleman has produced the first guide that actually WORKED for me! I'm using openSuSE 11, thinkpad T61, and iPod iTouch 16gb. All of the extra little programs you need to pull this off are available in the SuSE package manager provided you add PackMan to your repositories.

FYI SuSE 10.3 was a disaster - don't waste your time until you upgrade to the brand new release 11 !!! Shiny!!
Anonymous said…
Or save yourself a lot of time and shun Apple products for the incompatible garbage that they are.
Anonymous said…
I am almost there but the only choices for devices I have in GTKPod for Touch are Read Only and I get a null error on the selection of the 8GB (Black) Model A623. Mine is the iTouch Model A1213 and is nowhere in the list.

Plus when I connect the thing, my OpenSuSE 11 thinks its a camera device and only lists DigiKam or Gwenview. Yours and Dave's instructions together seemed to get the directory structure created. And I can view the SysInfo change when I run the FireWireGuid command using different IDs, but I cannot make it connect and talk.

Any thoughts? I am not above connecting it to Windows and formatting, if that will help. I was able to use my wife's Windows box to put stuff in it as she has an identical unit, but I am determined to use it with Linux, if there's any way.

Thanks again, you are good.
Jake said…
Thanks for the guide. I'm still not sure whether I want to hack my iPhone or not. Does it have any obvious drawbacks?


iphonecontracts said…
Excellent guide. I am now motivated to do it myself. Will bookmark you and check back.
Unknown said…
I know this is an old chain but has anyone gotten into an ipod 6th gen using SSHFS on a Windows 7 machine? My ipod is password locked and I cant remember it. I've reformated my laptop that I used itunes on so that's out.

Anyone?? :/

Popular posts from this blog

Track Your New Year Resolutions With ii.do

Why KDE4 (might) suck!

DIY Docker on Apple silicon M1