Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use "adb ppp"?

Tags:

android

adb

ppp

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.

like image 870
huherto Avatar asked Dec 30 '10 18:12

huherto


People also ask

How do I access files using ADB?

Open cmd type adb shell then press enter. Type ls to view files list.

What is ADB and how it works?

Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.


2 Answers

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> 
like image 58
Alessandro Persano Avatar answered Oct 01 '22 03:10

Alessandro Persano


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

like image 27
4 revs Avatar answered Oct 01 '22 04:10

4 revs