How to use "adb ppp"?
Asked Answered
H

4

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.

Hamal answered 30/12, 2010 at 18:14 Comment(2)
I hope someone answers, this has been bugging me for a while as well.Livvie
Hey there, could you provide some info on your environment? [OS, Android SDK version, etc.]Oops
K
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>
Klara answered 19/4, 2011 at 14:32 Comment(2)
Unfortunately, it does not work with Windows: "error: adb ppp not implemented on Win32". Any ideas with Windows?Informal
What do you mean by local and remote IP? Do I need to define new ones? Do I need to use the existing ones?Roubaix
M
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

Motionless answered 30/12, 2010 at 18:14 Comment(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?Roubaix
E
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.

Epitomize answered 9/1, 2016 at 10:13 Comment(0)
U
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
Urease answered 20/6, 2015 at 8:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.