Mount iPhone in Linux using USB (ifuse, libiphone)

原贴地址:http://blog.zoomeren.nl/2009/03/24/mount-iphone-in-linux-using-usb-ifuse-libiphone/s

 

Finally, it’s working. Mounting the iPhone in Linux over USB. No stupid (ADHOC) wireless connection is required. It also works on non-jailbrroken iPhones. Though, the developers still say that only “developers” should use it. Of course there is still a problem accessing the Media iTunes library on the iPhone – the key Apple uses on the latest iPhone firmwares has still not been discovered. But instead of using the iPod software on the iPhone, I now use the very promissing pwnplayer which is able to play music from the iPod library on you iPhone, as well as MP’3 you copied to a directory on the iPhone. MewSeek, an application for musioc downloading,  works very well together with pwnplayer. JPG images from the iPhone Photo Camara can also be accessed.

The project  you need to mount the iPhone in Linux is called iFuse. iFuse is a module for the FUSE(Filesystem in Userspace) system. The project contains libiphone, which is used to access USB and does the lower level translations. Unfortunately, I could not find howto’s on the projects main website. But with some googling, I found the answers.

edit: iFuse is now providing DEB and RPM packages on there website now: iFuse. See /usr/share/doc/ifuse/README of their ifuse package for usage instructions.

  1. Install libiphone (as root)
    1. git clone git://github.com/MattColyer/libiphone.git
    2. ./autgen.sh
    3. ./configure
    4. make
    5. make install
  2. Install iFuse (as user)
    1. git clone git://github.com/MattColyer/ifuse.gi
    2. ./autgen.sh
    3. ./configure –prefix=/
    4. make
    5. make install
  3. Generate keys (as user)
    1. /usr/local/bin/libiphone-initconf
      (This will generate some keys required to connect with the iPhone over USB)
  4. Mount the iPhone’s root filesystem including the Media partition (as user)
    1. mkdir /mnt/iPhone (make sure you have write access to the mount mount)
    2. mount.fuse.ifuse –afc2 none /mnt/iPhone/ -s
      (The -s options seem to be related to threading/locking issues and is a workaround)
  5. Or mount the iPhone’s Media partition only (as user)
    1. mount.fuse.ifuse none /mnt/iPhone/ -s
  6. Or mount as root
    1. mount  mount none -t fuse.ifuse /mnt/iPhone
  7. Unmounting (as user)
    1. fusermount -u /mnt/iPhone
  8. Umounting (as root)
    1. umount /mnt/iPhone

I have been testing this on Ubuntu Intrepid. It would be nice to see GNOME GVFS to automount the iPhone over USB.  After some investigation of this matter I must conclude that UDEV, HAL, DBUS, GVFSD, GVFSD-backends are used to do the automounting in GNOME – which is quite complicated – I could not find any scripting-hooks (or configuration options) in GVFSD to do some BASH magic and auto mount the iPhone in GNOME.

The performance, using Nautilus to copy data from/to the iPhone is:

  • Write (computer-to-iPhone): ~750 KB/s
  • Read (iPhone-to-computer): ~2.9 MB/s

Not bad – although writing is a bit slow compared to the avg-read time. The iPhone 2.0 seems to be connected over USB 2.0 (480 mbit/s):

T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 27 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  3
P:  Vendor=05ac ProdID=1292 Rev= 0.01
S:  Manufacturer=Apple Inc.
S:  Product=iPhone

Alternatives:

  • Mounting using SSH/SFTP over ADHOC wifi connection
  • iTunnel using modified libiphone

Links:

  • http://brandy25.blogspot.com/2009/02/mount-iphone-in-linux-via-usb.html
  • https://help.ubuntu.com/community/PortableDevices/iPhone

A small script to mimic a bit the GNOME GVFS auto mounting function:

#!/bin/sh mntp=/home/johan/mnt/iPone if ! ( mount | grep $mntp ); then mkdir -p $mntp mount.fuse.ifuse -afc2 none $mntp -s notify-send -u normal "iPhone Mounted" "The iPhone is now mounted." nautilus $mntp else fusermount -u $mntp rmdir $mntp notify-send -u normal "iPhone Un-Mounted" "The iPhone is now un-mounted." fi

你可能感兴趣的:(apple,linux,user,git,iPhone,library)