Connect emulated device on Linux to a car (Android Auto) - General Questions and Answers

Hi!
I'm trying to establish a connection between an Android Virtual Device and a car. The goal is to run the AVD on a Linux laptop and connect it to the car via USB. Ideally the AVD would recognize the car's HU (and also the other way around) which should make it possible to use Android Auto.
I read a lot about the Android Open Accessory Protocol and how the connection is established. I also found posts about people tunneling USB connections from a Linux host to an Emulator using the command below:
emulator @AVDname -qemu -usb -device usb-ehci.id=ehci -device usb-host,vendorid=0x----,productid=0x----
Some also say you need to build a custom kernel beforehand so that USB on the Emulator is enabled in the first place. So far the Linux machine doesn't recognize the HU at all, which makes it impossible to use the USB tunnel since I don't know the vendor and device id.
The HU probably acts as host and expects a device, so does the Linux machine. This is somehow where my progress stopped.
Does someone know if that kind of connection is even possible with a emulated device? Do AVD's support the Accessory Mode in the first place? Is there a way around this Host to Host problem?
Any hints or ideas would mean a lot to me!

Related

How to connect two android devices over USB

First, why:
I own two Coby Kyros tablets that I am using 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), have 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 hart and right now is fully manual. If you find it helpful I might work on automating the link.
Tested on Froyo. At least one device has to be rooted and support the USB Host mode.
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.
1. 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 market to access its console.
2. 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.
3. Connect the master and the slave using a miniUSB-USBfemale and USBmale-miniUSB combination, a USB hub (make sure it is a high-speed one) or a miniUSBmale-miniUSBmale cord.
4. Now the tough 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
Code:
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:
Code:
su
mkdir -p /dev/bus/usb/001/
ln -sf /proc/bus/usb/[BUS#]/[Dev#] /dev/bus/usb/001/001
5. Test. On the slave run 'adb devices'. It should show your master in the list.
6. 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.
sicvolo said:
Tested on Froyo. At least one device has to be rooted and support the USB Host mode.
Click to expand...
Click to collapse
Is there a guide on getting USB Host Mode to work on this device or if there isn't could you write one?
I have two Galaxy S3. I went through steps 1-3, all fine. But in step 4, there is no '/proc/bus/usb/devices'; there are only '/proc/bus/input' and '/proc/bus/input/devices'.
Is there any other method to get dev# and bus#? Thanks.

[Q] establishing a console connection trough serial cable

Hello everyone,
I am taking networking classes and I was wondering if it's possible, instead of carrying a laptop with me, to use my SGS2(rooted) to configure switches/router with.
I bought a female to female usb adapter, and i also have a USB to serial cable. So all the cabling is fine, but still when I open a console emulator i get nothing going there...
I believe it may be parity related, but there seem to be no console parity settings on any of the terminal emulators that i was able to find on the market.
Usualy, if you extablish a console connection from a laptop via USB, the usb port gets defaulted to COM3 or COM4. Do android devices have a defaulted COM port to the usb connection, Is there a config file where I can change it, or is it supported at all?
any help would be appreciated,
thanks

Share USB connection over Wifi/Bluetooth. Possible?

Is there an app/program or is it otherwise possible to share a usb device plugged into an android phone with a desktop computer, or vice versa over wifi or bluetooth. For example plugging a DSLR into my android phone and having it show up on the desktop computer as if it were connected via usb. There would be a ton of uses for this if it is possible. It would change your phone into a sort of wireless USB port.
there is software USB Network Gate with Win and Linux versions which probably could help you, but I don't know if it will work with Android...
I had run into USB Network Gate in my search for something similar for android. Seems like a great tool. If only it were able to run on android and was a bit cheaper.
Anyone know of something like this that will run on android?

[Q] Looking for confirmation - no USB accessory support

Hello.
I have a machine with a USB host and a USB accessory port.
I have successfully got an Android tablet to talk to the machine, using an OTG cable which puts the tablet into Host Mode (using the machine accessory port).
This has a couple of problems, one of which is charging while in host mode.
I am now trying to keep the tablet in accessory mode, and connect to the host port on the machine.
My research suggests that Android has no support for running as the accessory.
The ADK sample code clearly seems to intended to run on a host (as it enumerates accessories).
I know the tablet supports an accessory mode because when I plug it into a PC, it mounts as camera or storage.
I can understand why they would not expect a keyboard or hub to be running Android, but there do seem to be some legitimate use cases.
Can anyone confirm my understanding, that there is no way to run Android as the accessory ?
Thanks.
I have since found the Android Open Accessory Protocol. Using information from ver 1 and 2 of the protocol, I found enough info to switch the android device into the special android-accessory mode. Note that on Linux, you may need to change the adb program so it is owned by root if you want to run the debugger over the new connection.

Installing vanilla Debian with console (no X) on my mobile device.

My Goal: To run a small Debian server on my mobile device. Like a raspberry Pi, but no need for Xwindows, So no GUI needed. Like a mini-NAS.
I guess to make my goal, the idea would be to use a USB 3.1 hub with enough USB ports for the following:
1 Gbit Ethernet USB dongle.
1 (or more) SSDs attached by USB
As an extra bonus it would be great to display 'top' or 'vmstat' on the phone screen. The idea is also to use the battery as a UPS. So should the power fail, the 'server' would keep running.
My OS of choice is 'Debian'.
Some assumptions on my part:
I will need to build a custom ROM based on a kernel for my model of phone (or could I get away with a 'generic' kernel for all phones?)
It will need to use DHCP to get an IP on the USB ethernet adapter and start SSH as a minimum (as I won't have the screen working to be able to log in).
Is this possible? Is it 'easy'? Would I need to build a custom kernel? Do I need to do 'special' things to get USB support to work, or is that pretty 'standard'? Initially I don't care about Screen/mic/speakers/lights/vibrate and all of those.

Categories

Resources