如何使用“adb ppp”?

发布于 2024-10-09 18:07:49 字数 728 浏览 11 评论 0原文

我正在尝试使用 USB 和 ppp 从 Android 设备连接到主机。

似乎有一个选项“adb ppp”可以使用。但我找不到解释 关于如何使用它。这里有一个古老的讨论。但他们结束了对 adb 的修补。我不敢相信这个问题现在还没有得到解决。

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

这个是 adb 命令的解释,这就是我能找到的所有文档。

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

我不清楚 tty 的论点是什么。查看源代码,它似乎是一个服务,例如“shell”、“host:version”等。或者它可能是(如文档所说)dev:/dev/* 但我不知道该使用哪个。

另外,该命令似乎在主机中分叉了一个 ppp。但是,我不知道它在 Android 设备上如何运行。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

你在看孤独的风景 2024-10-16 18:07:49

PTY/TTY 基本上是使用文件句柄的串行线路隧道。
就像套接字一样,PTY 是服务器端,TTY 是客户端。

下面是一个可以工作的示例命令。

adb ppp "shell:pppd nodetach noauth noipdefault /dev/tty" nodetach noauth noipdefault notty <local-ip>:<remote-ip>

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>
罗罗贝儿 2024-10-16 18:07:49

好的,要使用它来备份您的系统分区(或者使用 unyaffs2 解压 nandroid 备份):

  1. 连接设备并启用 USB 调试
  2. 启动 SSH 服务器(通过应用程序或使用 debian 的 deb s -kit 设置)
  3. 用于无密码登录,通过将主机密钥传输到设备 fe

    adb push /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
    
  4. 在主机(10.0.0.1)和设备(10.0.0.2)之间设置网桥将主机密钥传输到设备fe:

    adb ppp "shell:pppd nodetach noauth noipdefault /dev/tty" \
    nodetach noauth noipdefault notty 10.0.0.1:10.0.0.2
    
  5. 备份系统分区(需要设备上的 rsync 可执行文件,即完整的 debian 或自定义 busybox 版本< /强>):

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

    -a, --archive 归档模式;等于 -rlptgoD(无 -H、-A、-X)
    -P 与 --partial --progress 相同
        --partial 保留部分传输的文件
        --progress 显示传输过程中的进度
    -u, --update 跳过接收器上较新的文件
    -i, --itemize-changes 输出所有更新的更改摘要
    -v, --verbose 增加详细程度
    -h, --人类可读的以人类可读格式输出数字
                               (如果重复该选项,则
                                单位是 1024 的幂而不是 1000。)
    -z, --compress 在传输过程中压缩文件数据
    

大约需要 9 分钟:

发送 27.94K 字节 接收 215.94M 字节 413.75K 字节/秒
总大小为 321.52M 加速为 1.49

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

も星光 2024-10-16 18:07:49

adb 的 ppp 选项对我不起作用。以下是我解决这个问题的方法...

您可能需要在设备上安装 busybox 才能获取“nc”命令。

在一个窗口中,键入...

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

在另一个窗口中,键入...

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

现在,设备与计算机之间已建立网络。运行“ifconfig”进行检查。

如果您希望设备获得正常的互联网连接,您需要在主机上设置一些 SNAT 路由。

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.

妞丶爷亲个 2024-10-16 18:07:49

如果 adb ppp 在您的设备上失败,并且您拥有 root 权限,请尝试以下操作:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文