IPhone How To

From KnowWiki
Jump to: navigation, search

Contents

[edit] Tethering Ubuntu Lucid Lynx with iPhone OS

Thanks to the guys behind iFuse, which is now called [[1]], Linux world can now enjoy tethering, file system access, music and video synching, backup and app management! Here I will describe how to do some of this deliciousness in the latest Ubuntu 10.4 LTS

Teethering

In most cases the following shall suffice:

sudo add-apt-repository ppa:pmcenery/ppa
sudo apt-get update
sudo apt-get install gvfs ipheth-dkms ipheth-utils

Reboot to have the ipheth modules linked into the running kernel. If the above does not quite work for you or you need extra functionality follow my original suggestions.

First, make sure you have the teethering option enabled by your carrier by looking for Settings->General->Network->Internet Tethering. Chances are, though, you are a an AT&T user and do not have it. This means you have to jailbreak, if you have not done so yet. Go ahead and do it. Done? Good. Now you have two paths. Either patch up your CommCenter file with the DevTeam patch, or use the MyWi app:

The CommCenter route

Get the patch from the DevTeam. Link the iPhone filesystem at the root (for details see the latter section) Backup the /System/ Library/PrivateFrameworks/CoreTelephony.framework/Support/CommCenter Patch it up by running

bspatch CommCenter CommCenter-new CommCenter.patch

Replace the original CommCenter with CommCenter-new and reboot the device. (if you did everything via ifuse your CommCenter shall retain it’s executable attribute ‘x’. You can verify it by looking at the file from iPhone’s MobileTerminal (ls -al then chmod +x as needed). The attribute is required, otherwise you’ll have do a restore to the phone as it will not boot the next time) Now, update the mobile config by browsing from your iPhone using Safari either to “http://www.benm.at/help/help.php” or to “http://m.peacefulinsanity.com/Tether.mobileconfig”

The MyWi route

(this sucks as it requires a third party app, but it works when CommCenter fails): Get MyWi from Cydia. Get a RockID and register the app. The internet setting will now show up. In case you are wondering – the app works by injecting /Library/RockExtensions/DynamicLibraries/MyWi.dylib code into /System/Libarary/LaunchDaemons/com.apple.MobileInternetSharing.plist and modding preferences on the fly

Once you got your tethering setting figured out, you’ve got two paths again. Either get the necessary software for Ubuntu Tethering and build it yourself, or get it the easy way, via apt-get (thanks, Tom F!):

The easy path

Inhale:

sudo add-apt-repository ppa:pmcenery/ppa
sudo apt-get update
sudo apt-get install gvfs ipheth-utils

Exhale

The custom built route

Aptget the essentials:

sudo apt-get install build-essential ifuse git-core libimobiledevice-dev

Get the code:

git clone git://github.com/dgiagio/ipheth.git

Make it:

cd ipheth-pair
make
sudo make install
cd ../ipheth-driver
make
sudo insmod ipheth.ko

Now enable tethering on the phone and connect it. Run dmesg to verify that everything is ok (you’ll get a blue “tethering” header on the phone too) If/when everything works, finish it up by making the module permanent

sudo make install
sudo cp ipheth-modprobe.conf /etc/modprobe.d/
sudo depmod

Make sure that ipheth-modprobe.conf does not contain ipheth-pair (the pairing is done though a udev call)

[edit] How to mount iPhone's file system

Make sure you have ifuse: sudo apt-get install ifuse fuse-utils Create a mount folder. I suggest creating a subfolder in the /media folder, otherwise a system indexer (updatedb/beagle/nepomuk) may get a little too friendly with it.

mkdir ~/mountfolder

Mount the phone’s filesystem: If you want to mount “mobile” user folder:

ifuse /mountfolder

If you want to mount iphone’s root /:

ifuse --root /mountfolder

You need a jailbroken phone for this to work. You might also need to install afc2add app from Cydia if you got your jailbreak through Blackra1n or Spirit, not PwnageTool To unmount run:

fusermount -u ~/mountfolder

[edit] How to sync iPhone music with Amarok

sudo add-apt-repository ppa:pmcenery/ppa
sudo apt-get update
sudo apt-get install gvfs ipheth-dkms ipheth-utils

That is it. It is that easy.

[edit] How to check iPhone UUID

sudo apt-get install libimobiledevice-utils

Now you can do

[edit] How to connect iPhone with Ubuntu

Please, note that the following information is outdated and is here for reference only. There's been great advances in iPhone+Ubuntu area since I wrote this up.

  1. First, get all the prerequisites:
apt-get install build-essential cmake libglib2.0-dev libxml2-dev python-dev swig automake autoconf libtool libgnutls-dev libusb-dev libfuse-dev libglib2.0-dev libxml2-dev libreadline5-dev
  1. Then, install libplist (needed for libiphone)
      git clone git://github.com/JonathanBeck/libplist.git
      mkdir build
      cd build
      cmake ..
      make
      sudo make install
      sudo ln -s /usr/local/lib/libplist.so.0.0.11 /usr/lib
      sudo ln -s /usr/lib/libplist.so.0.0.11 /usr/lib/libplist.so.0
      sudo ln -s /usr/lib/libplist.so.0 /usr/lib/libplist.so
 
  1. Now, install libiphone
      git clone git://github.com/MattColyer/libiphone.git
      ln -s plist-folder/ swig/plist
      ./autogen.sh
      ./configure
      make
      sudo make install
      sudo ln -s /usr/local/lib/libiphone.so.0 /usr/lib/
 
  1. Get iTunnel and run it
      ./itunnel 7777
  1. Now go and change the iTunes DB version to an un-encrypted one
      ssh -p 7777 root@localhost
      cp /System/Library/Lockdown/Checkpoint.xml /System/Library/Lockdown/Checkpoint.xml.bak
      nano /System/Library/Lockdown/Checkpoint.xml
      find (^W) and change DBVersion to 2.
  1. Terminate the tunnel and reboot the iPhone.
  2. Start the tunnel back up and mount the iPhone:
      sshfs -p 7777 root@localhost:/var/mobile/Media /media/iphone/ -o workaround=rename
  1. Setup Amarok
    1. Click Settings → Configure Amarok.
    2. Choose Media Devices.Hit Add Device. Select Apple iPod Media Device for the plugin type.
    3. Point it at your mount point /media/iphone
    4. In Devices, click Connect. Once connected, click on the double arrows on the right hand side of the Connect, Disconnect, and Transfer buttons. A list of options opens up, one of which is iPod. Choose iPod → Set iPod Model → Mobile Phones → iPhone
  2. Enjoy

Tethering with SSH

  1. For tethering try this:
      ssh -D 9800 -p 7777 mobile@127.0.0.1

-D sets a SOCKS proxy.

  1. Change the Opera to use the SOCKS proxy on localhost:9800. If you are using Firefox, also set its DNS in about:config set
      network.proxy.socks_remote_dns=true.

Gotchas:

References:

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox