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.
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:
You might also want to load the fuse driver manually if you get an error in the next step.
Create a mount point (in your home directory) to mount the iTouch and mount it using its ip address.
You should now be able to see the content of your itouch on mnt_itouch directory.
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.
Create a small launch script for gtkpod as follows
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:
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):
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)
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
a12b3c1a35c7ba56
$ 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)
Comments
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.
Helppp?
Are you trying the command as root? See if you get anything for lsusb -v | grep -i iSerial
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!!
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.
Thanks
Jake
Anyone?? :/