Synching iPhone over USB under Ubuntu
April 30th, 2009 by alex
iPhone is not very good under Linux. It is locked down by the Apple Corp, and they tell you what you can and can not do with it. The first step in getting Linux compatibility is, naturally, setting iPhone free of all its predispositions. The process is trivial and well documented on the web (google �jailbreak�), but do not forget to back up your stuff first. If you do backup, iTunes will restore it after the iPhone has had its brains cleansed, but if you don�t backup, you will be just like me. Now, onto the fun stuff! Modding, tethering and getting all that multimedia loaded on.
One way to connect to the iPhone is through its WiFi interface. I played around with Ubuntu�s Ad-Hoc networking and I could say this � it sucks. Using both the NetworkManager and the WICD, I could get the WiFi created, connect the laptop and the iPhone to it, but I could not get either one to ping an other. Plus, iPhone�s battery was draining like a leaking toilet. So, I choose the USB route, the faster, simpler, more secure way that, coincidentally, keeps iPhone from discharging. The USB route is a less traveled one, but hopefully the following will help you navigate the obstacles.
1. First, get all the prereqs:
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
2. 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.12 /usr/lib
sudo ln -s /usr/lib/libplist.so.0.0.12 /usr/lib/libplist.so.0
sudo ln -s /usr/lib/libplist.so.0 /usr/lib/libplist.so
You might need to use different version numbers (libplist.so.0.0.xx) if you get a latter version of libplist
3. 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/
4. Get iTunnel and run it (your iPhone ssh should be turned on)
./itunnel 7777
5. Now go and change the iTunes DB version to an un-encrypted one (this no longer works if you have iPhone OS 3.0 and higher)
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.
6. Terminate the tunnel and reboot the iPhone.
7. Start the tunnel back up and mount the iPhone:
sshfs -p 7777 root@localhost:/var/mobile/Media /media/iphone/ -o workaround=rename
8. 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
9. Enjoy
Tethering:
1. For tethering try this:
ssh -D 9800 -p 7777 mobile@127.0.0.1
-D sets a SOCKS proxy.
2. If you use Opera as your browser of choice (I do, its the best! ) instruct it to use the SOCKS proxy on localhost:9800.
3. If you are using Firefox, also set its DNS in about:config set
network.proxy.socks_remote_dns=true.
Or you could go int Edit > Preferences > Advanced > Network > Connection Settings
Yeah, I know, this only works with apps that can go through a proxy. The only other way I can think of is to set up an openvpn tunnel inside of the SSH tunnel. It might be worth trying, but iPhone OS 3.0 with native teethering shall be out soon, hopefully sparing all that effort. Again, may be not.
Gotchas:
* Make sure you�ve got your FirewireGUID already setup (I.e. you�ve connected the iPhone to iTunes via USB after flushing its brain)
* Unmount gphoto2 gvfs iPhone share when it is automounted
* iTunnel does not support scp/sftp. According to the iTunnel author it supports scp, but sftp clearly did not work. SFTP works too.
* If iTunnel fails with -5 try running it again.
References:
* https://help.ubuntu.com/community/PortableDevices/iPhone
* http://matt.colyer.name/projects/iphone-linux/
Hiç yorum yok:
Yorum Gönder