Android How To
| Android |
|---|
| Android Topics |
| How To |
[edit] How to connect two android devices
First, why:
I own two android tablets that act as a part-time car headrest entertainment system. Heck, they are so cheap, buying a dedicated car video just does not make sense. Tablets work great for that purpose, great resolution (for a car), games and music. There is only one piece that is missing, simultaneous video playback on both tablets.
Getting this working presents two challenges:
- A fast, stable, always ON connection between the tablets.
- A master/slave video playback software, either streaming or syncing
Glad to report, I've solved the first issue, that I'll describe here. Be warned this is not for the faint of heart and right now is fully manual. If you find it helpful I might work on automating it.
Tested on Froyo (Android 2.2). At least one device has to support the USB Host mode and provide root access.
Now, how:
The idea is simple - use the android debugging bridge to forward TCP ports between two systems over USB. If you do have USB tethering enabled on at least one device (I did not) you could use RNDIS to route all traffic, not just specific ports, over USB.
- Pick a tablet to be the slave. It must be rooted. Get the adb client compiled for android from here, upload it to the slave /system/xbin ("adb push ...") and make executable (adb shell chmod 755...). Get ConnectBot from the android market to access the console.
- Put the slave into the USB Host mode, disable USB debugging on it. Put the master into the USB device mode and enable USB debugging.
- Connect the master and the slave using a USB-female and USB-male combination, a USB hub (make sure it is a high-speed one) or a USBmale-to-USB male cord, if you can find one.
- Now the tedious part, typing shell commands on the tablet. You can make it a bit easier by using a USB hub and connecting a keyboard and a mouse together with the other tablet to the slave. On the slave start ConnectBot for the localhost and type the following:
less /proc/bus/usb/devices
Look for your master's devices BUS# and DEV#. Record both. Note, these numbers change when you re-plug USB.
Now, on the slave:
su mkdir -p /dev/bus/usb/001/ ln -sf /proc/bus/usb/[BUS#]/[Dev#] /dev/bus/usb/001/001[/CODE]
- Test. On the slave run 'adb devices'. It should show your master in the list.
- Forward slave ports to the master as needed. Run 'adb forward tcp:123 tcp:234'. Now you can use localhost:123 on the slave to reach out to the master port 234 over USB.
If your kernel is RNDIS enabled you could route all network connections over the usb0 interface, essentially creating a one-to-one network. Stock Kyros unfortunately does not support RNDIS so I've not tested it.
The ADB USB speed is not bad, averaging 2.5MB/sec after protocol overhead.
I did some research on the second issue, went several routes (mplayer, VLC and UPNP) and, sadly, found nothing that currently works. If you know of any working video source/sink pair or a sync peer for android, let me know.
|
|||||