From f7ca1e197b389341f9074aa17631c113beda4114 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Mon, 22 Sep 2014 10:01:26 +0200 Subject: [PATCH] Add a separate adb-channel tool. --- README.md | 22 ++++++++++++++++++++++ adb-channel | 14 ++++++++++++++ 2 files changed, 36 insertions(+) create mode 100755 adb-channel diff --git a/README.md b/README.md index ce77c93..3593988 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,28 @@ To copy all downloads from your device to your PC, type: adb-sync --reverse /sdcard/Download/ ~/Downloads ``` +ADB Channel +=========== + +This package also contains a separate tool called adb-channel, which is a +convenience wrapper to connect a networking socket on the Android device to +file descriptors on the PC side. + +It is best used as a `ProxyCommand` for SSH (intall +[SSHelper](https://play.google.com/store/apps/details?id=com.arachnoid.sshelper) +first) using a configuration like: + +``` +Host sshhelper +Port 2222 +ProxyCommand adb-channel tcp:%d +``` + +After adding this to `~/.ssh/config`, run `ssh-copy-id sshhelper`. + +Congratulations! You can now use `rsync`, `sshfs` etc. to the host name +`sshhelper`. + Contributing ============ diff --git a/adb-channel b/adb-channel new file mode 100755 index 0000000..ce906d4 --- /dev/null +++ b/adb-channel @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +t=`mktemp -d -t adb-channel.XXXXXX` + +atexit() { + adb forward --remove localfilesystem:"${t}/sock" + rm -rf "${t}" +} +trap atexit EXIT + +adb forward localfilesystem:"${t}/sock" "${1}" +socat stdio unix:"${t}/sock"