28

I am trying to connect from my Android device to the host using usb and ppp.

There seems to be an option "adb ppp " that can be used. But I can't find an explanation on how to use it. There is an old discussion here. But they ended patching adb. I can't believe this hasn't being fixed by now.

http://forum.xda-developers.com/showthread.php?p=4537323

This is the explanation of the adb command, and that is all the documentation I have been able to find.

networking:
  adb ppp  [parameters]   - Run PPP over USB.
 Note: you should not automatically start a PPP connection.
  refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
 [parameters] - Eg. defaultroute debug dump local notty usepeerdns

I am not clear on what the tty argument. Looking at the sources it seems to be a service such as "shell", "host:version", etc. Or it could be (as the doc says) dev:/dev/* but I don't know which to use.

Also, the command seems to fork a ppp in the host. But, I don't know how it runs on the android device.

2
  • 2
    I hope someone answers, this has been bugging me for a while as well.
    – num1
    Dec 30, 2010 at 18:30
  • Hey there, could you provide some info on your environment? [OS, Android SDK version, etc.]
    – defbyte
    Apr 8, 2011 at 20:27

4 Answers 4

10

PTY/TTY is basically a serial line tunnel using file handles. Just like sockets, the PTY is the server side and the TTY the client.

Below an example command that could work.

adb ppp "shell:pppd nodetach noauth noipdefault /dev/tty" nodetach noauth noipdefault notty <local-ip>:<remote-ip>
2
  • 1
    Unfortunately, it does not work with Windows: "error: adb ppp not implemented on Win32". Any ideas with Windows? May 28, 2012 at 13:43
  • 1
    What do you mean by local and remote IP? Do I need to define new ones? Do I need to use the existing ones? Nov 24, 2015 at 23:30
4

Ok and to use this to f.e. make a backup of your system partition (alternative to unpacking a nandroid backup with unyaffs2):

  1. connect device with USB debugging enabled
  2. start an SSH server (via app or deb s with debian-kit set up)
  3. for password-less login transfer host key to device f.e. via

    adb push /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
    
  4. setup network bridge between host (10.0.0.1) and device (10.0.0.2):

    adb ppp "shell:pppd nodetach noauth noipdefault /dev/tty" \
    nodetach noauth noipdefault notty 10.0.0.1:10.0.0.2
    
  5. backup system partition (needs rsync executable on device, i.e. full debian or custom busybox build):

    rsync -vaiuhhP 10.0.0.2:/system /where/to/backup/

    -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
    -P                          same as --partial --progress
        --partial               keep partially transferred files
        --progress              show progress during transfer
    -u, --update                skip files that are newer on the receiver
    -i, --itemize-changes       output a change-summary for all updates
    -v, --verbose               increase verbosity
    -h, --human-readable        output numbers in a human-readable format
                               (if the option is repeated, the
                                units are powers of 1024 instead of 1000.)
    -z, --compress              compress file data during the transfer
    

Comes down to about 9 minutes for my xperia mini pro with Android 4.04/RealICS custom firmware:

sent 27.94K bytes received 215.94M bytes 413.75K bytes/sec total size is 321.52M speedup is 1.49

1
  • This is useless. the adb ppp command does not appear to do anything. And what IP addresses do I choose? Existing ones? New ones? Nov 24, 2015 at 23:29
1

adb's ppp option is not working for me. Here's how I got around it...

You may need to install busybox on the device to get the "nc" command.

In one window, type in...

adb shell
su
nc -ll -p 7001 -e pppd notty defaultroute nodetach

In another window type in...

adb forward tcp:7001 tcp:7001
sudo /usr/sbin/pppd nodetach 10.0.1.1:10.0.1.2 pty "nc localhost 7001"

Now there's networking from the device to the computer. Run "ifconfig" to check.

If you want the device to get normal internet you'll need to set up some SNAT routing on the host machine.

0

If adb ppp fail on your device, and you have root permission, try this:

    adb ppp "shell:su -c 'pppd nodetach noauth noipdefault /dev/tty'" \
nodetach noauth noipdefault notty 10.0.0.1:10.0.0.2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.