Restoring iPhone USB access under iTunes 9

Like many jailbreak iPhone users, I prefer to SSH to my iPhone 3G via the USB cable instead of over my wifi network. Since upgrading to iPhone OS 3.1.2 and iTunes 9.0.2 (Specifically 9.0.2.25), however, I’ve discovered that the tool I used, iphone_tunnel.exe, no longer works. Instead, every time I try to connect with Putty or WinSCP, the error message iphone_tunnel gives me is:

new connection !
AMDeviceNotificationSubscribe = 0
iPhone attached !
AMDeviceConnect = 0
AMDeviceIsPaired = 1
AMDeviceValidatePairing = 0
AMDeviceStartSession = 0
MobileDevice: _send_message: Could not encode message as XML
AMDeviceStartService = 0
AFCConnectionOpen = 0

My initial search results lead me to downgrade the “Apple Mobile Device Support” component to the version used in iTunes 8.2.1.6, but this did not work. After a lot more searching, I discovered a slightly different tool, itunnel, which I originally discounted as just another name for iphone_tunnel. It is actually a modified version of iphone_tunnel, presumably for iTunes 9 compatibility. It works fine on my iPhone 3G, and I imagine the same would go for the iPhone 3GS.

You can download it from MediaFire (623.55 KiB).

  • an update:

    winSCP spits out “software caused connection to abort”

    and then reconnects, sometimes saying “unexpected server disconnect” or w/e

  • i DL the new one for itunes 9, i ran in compatibility, and it opened and ran to the blank screen. it just wont connect to com.apple.afc. ive tried default settings (alpine and root) and ive tried what i remember them as (double checked on terminal.app), but it gives me an error like this:

    new connection !
    AMDeviceNotificationSubscribe = 0
    iPhone attached !
    AMDeviceConnect = 0
    AMDeviceIsPaired = 1
    AMDeviceValidatePairing = 0
    AMDeviceStartSession = 0
    MobileDevice: _connect_to_port: Could not connect to USB mux port 28612 for devi
    ce 3: Unknown error
    MobileDevice: AMDeviceStartServiceWithOptions: Could not connect to “com.apple.
    afc” service on port 50287.
    AMDeviceStartService = -402653083, handle = 4201663
    AFCConnectionOpen = 0

  • Thanx it works!
    IPhone 3G 3.1.3 Spirit jailbroken
    Itunes 9.0.2.25

  • Hey Everyone,

    As a follow-up the spirit JB has been an endless unlock for my iPhone. I’ve never been happier with a mobile device and the apps from cydia/sbs are awesome. I’m happy to help anyone who is stuck with the Win7 compat issue or the xp SP3 ssh problem. Give me a shout via e-mail or stop by my site and post in the forums

    SIDE NOTE: DO NOT UPGRADE TO THE 4.0 OS IF YOU HAVE NOT JB’D AND BACKED UP YOUR SHSH FILES… It’s a PITA to unrom the 4.0 from what I’ve read.

    -Notes with Spirit JB:
    -Backgrounding is available :D
    -multitasking
    -flash video
    -streaming media
    -tethering

    That’s some of the biggest highlights of the new JB… So easy even a blackberry user could do it ( XD )

  • Thought I’d help some people out as it me a while to get this working.

    I’m running Windows 7 with iTunes 9.

    I’ve found that the standard itunnel.exe wont work with itunes ver 9.

    The site below has a link for two itunnel versions, one for itunes 8 and one for itunes 9.

    http://developerinstincts.blogspot.com/2009/12/ssh-to-iphone-via-usb.html

    I also had to set itunnel.exe to run in XP compatablilty mode.

    “Open the folder where you extracted the zip contents. Find the file itunnel.exe and RIGHT click it. Choose properties, click the compatibility tab (second tab at top), check the “Run this program…” box and leave the default for Windows XP SP3. Click ok.”

    After this, all working fine!

    Hope this helps…

  • @dotslash
    hi i receive:
    AMDeviceStartService= 0, handle = 636
    how can i start OpenSSH on iphone ? i just installed it

  • this updated exe worked on windows 7 x64. i was having troubles with my old itunnel.exe. placed the new updated one in and it worked after changing compatibility. another issue i had was my old runtunnel.cmd file was trying to run on port 5900. i was getting the could not connect to “com.apple.afc” error. once i changed it to 22, it worked.

  • Hey I found a solution for Win 7 users. Open the folder where you extracted the zip contents. Find the file itunnel.exe and RIGHT click it. Choose properties, click the compatibility tab (second tab at top), check the “Run this program…” box and leave the default for Windows XP SP3. Click ok. You should now be back at your folder containing the files. Right click the ‘Runtunnel.cmd’ file and choose Run as administrator (may not be required but assuming so since it’s manipulating the network stack). This will open a window which appears to be a blank empty command window. At this point open putty or winscp and connect to localhost on port 22. You will then see data fill into the empty command window as such:

    new connection !
    AMDeviceNotificationSubscribe = 0
    iPhone attached !
    AMDeviceConnect = 0
    AMDeviceIsPaired = 1
    AMDeviceValidatePairing = 0
    AMDeviceStartSession = 0

    If you receive this message or similar:
    MobileDevice: _connect_to_port: Could not connect to USB mux port 15296 for devi
    ce 2: Unknown error
    MobileDevice: AMDeviceStartServiceWithOptions: Could not connect to “com.apple.
    afc” service on port 49211.
    AMDeviceStartService = -402653083, handle = 4201663
    AFCConnectionOpen = 0
    You need to start the OpenSSH daemon on the iphone…

    Otherwise it should prompt you to accept the SSH key and you will be able to proceed. Hope this helps. And all of you 3.1.3 sufferers… I hope you know about the Spirit JB ;)

  • One last thing, a better command shell would be:

    cmd /c iTunnel.exe 22 22

    It opens cmd and runs iTunnel.exe and once iTunnel is closed(via whatever means) it closes.

  • Wait, never mind. It doesn’t close if you put it in compatibility mode.

  • Set itunnel.exe to Vista Sp1 Compability mode, then you can use putty atleast:D

  • Im using win7, so im still stuck.
    But thanks for the advice :)
    i believe in you, and hope u will find the solution for this :)

  • First, you need to extract all the files in the ZIP to a folder.

    Next, open up a command prompt (Start > Run > cmd > enter) and navigate to the folder you extracted the files to (Type “cd ” and press enter). Then type “runtunnel” and press enter. Now if iTunnel has any errors, you’ll be able to see them before the window closes.

    Lastly, if you’re running Windows 7, iTunnel will just exit without saying anything. I’m also trying to find a solution for that at the moment.

  • Im stuck. I dl the stuff, but it doesnt work.
    i start the “runtunnel.cmd” and it automatically closes right after that. can u explain, step-by-step this operation? pls…

    A hopeless ssh user :/

Comments are closed.