I decided to try some inter-device adb action today. I'm sure some people have tried this, but I thought it was interesting. So I began by connecting from my laptop to my Nexus 4. I set up the Nexus 4 to do adb wireless with:
On my laptop I connected to the Nexus 4 with:
Then I set up my G4 to do adb wireless the same way. In the adb shell into my Nexus 4, I connected to my G4 with:
I tested some file transfers betwen phones with "adb push" and "adb pull" which worked really well. I'll definitely be using adb in the future to transfer files from one phone to the other. ftp works well, but this is even easier.
I decided to take my adb connection even further. My adb shell is now from laptop -> Nexus 4 -> G4 now. I then connected back to the Nexus 4 with:
When adb connects to a device it connects to the abdb daemon, and multiple connections can be made. Now that I'm back in the Nexus 4, I could reconnect to the G4, but that would be pointless since I already connected from the Nexus 4 to the G4. I wanted to try some other things. In the Nexus 4, I dropped down into a chrooted ubuntu image. I retrieved adb like you do on a computer with ubuntu:
In the ubuntu chroot on the Nexus 4, I connected back to the G4. I'm now running laptop -> Nexus 4 -> G4 -> (Nexus 4 -> ubuntu chroot) -> G4. At this point the connection was showing some lag. In the G4, I dropped down to a chrooted ubuntu image I have on that phone. I connected back to the Nexus 4. Dropped down into a chrooted Debian image I also have on that phone. At that point, I was able to connect back to the G4, but the device showed up as "offline", so I exited the chroot. In the Android environment, I found out I was still able to connect back and forth between phones, launching new adb processes each time. I ended up with an adb shell connection like this: laptop -> Nexus 4 -> G4 -> (Nexus 4 -> ubuntu chroot) -> (G4 -> ubuntu chroot) -> (Nexus 4 -> G4 ->)x20. You can see the processes for the connections with:
In the Android environment (not the chroot), I connected from phone to phone about 20 times until I got bored and the connection got too laggy. Unfortunately, the adbd daemon you can download in ubuntu gives a segmentation fault when you run it in Linux, so no connection between ubuntu's. Telnet and ssh work though. I was able to ssh back into my laptop with my ridiculous, laggy adb cascade and then adb back into the phones once again. Depending on which device you're currently in, you can kill the whole chain with:
This was all kind of ridiculous, but the adb between phones is useful, so I guess I got something out of it.
Code:
setprop service.adb.tcp.port 5555
adbd &
Code:
adb connect 192.168.0.7 (Nexus 4's host)transfer files over telnet
adb shell
su
Code:
adb connect 192.168.0.11 (G4's host)
adb shell
su
I decided to take my adb connection even further. My adb shell is now from laptop -> Nexus 4 -> G4 now. I then connected back to the Nexus 4 with:
Code:
adb connect 192.168.0.7
adb shell
su
Code:
apt-get install android-tools-adb
Code:
pgrep -fl adb
# You get something like:
>339 adb -s 192.168.0.7:5555 shell
>2869 adb -s 192.168.0.7:5555 shell
>4049 adb -s 192.168.0.7:5555 shell
>4933 adb -s 192.168.0.7:5555 shell
>5085 adb -s 192.168.0.7:5555 shell
>5772 adb -s 192.168.0.7:5555 shell
>5879 adb -s 192.168.0.7:5555 shell
>6027 adb -s 192.168.0.7:5555 shell
>6135 adb -s 192.168.0.7:5555 shell
>6236 adb -s 192.168.0.7:5555 shell
>6334 adb -s 192.168.0.7:5555 shell
>6447 adb -s 192.168.0.7:5555 shell
>6548 adb -s 192.168.0.7:5555 shell
>31220 /sbin/adbd --root_seclabel=u:r:su:s0
>31669 adb -P 5037 fork-server server
>31684 adb -P 5038 fork-server server
Code:
pkill adbd