Android App and Communications via USB - android

Ok, so I have researched this somewhat and am not encouraged, but I'm going to ask anyway, and be specific about what I'm trying to do. Maybe it will help!
I have a custom board with DaVinci processor with USB 2.0 OTG controller on it. I have it configured as a host with an attached hub and various peripherals. This processor runs Monta Vista Linux (MVL) 4.0 with 2.6.18 based kernel. This custom board some video processing and streaming.
I also have a Moto Droid. I can attach the phone as a USB device to my DaVinci system and MVL will enumerate the phone, but obviously doesn't know which driver to use. That I can fix.
So what I would ideally like to do is be able to have a data connection between my board and the phone, and use the phone with a custom app, as a configuration tool (initially). I'm thinking RNDIS would be wonderful, but I don't know if Android supports that on the USB port. Then my custom app would establish a connection over the USB to a server on my custom board.
Can anyone attest to what Android DOES support over USB, besides adb and flash file system?
Any other suggestions are welcome, although please don't tell me "Bluetooth", it doesn't have bandwidth for video, which is a future goal.
Thanks!

For small amounts of data, you could look at Working Android with Arduino, which points at Microbridge (http://code.google.com/p/microbridge/) or you could also look at IOIO (http://ytai-mer.blogspot.com/2011/04/meet-ioio-io-for-android.html).
For things like video, adb port forward (http://developer.android.com/guide/developing/tools/adb.html#forwardports) could be you friend (assuming you have the networking stack on MVL all setup and adb configured). You can basically set up port tunnels for TCP over USB and shift reasonably large amounts of data over the link. One end of the connection (probably the android device) runs a TCP/HTTP server, and the custom board opens connections to communicate. This works reasonably well, you set up a thread running adb devices to detect the plugging in of the Droid device, run adb port forward to set up the port forward, then open your sockets and you're good to go.

Is using 802.11 an option for you on the Davinci board? E.g. either via a Wifi USB dongle or through wired ethernet to an AP? If so, that would seem to be an easier route to communicate with Android than trying to go through USB. Or are your video resolution and compression requirements more than what you'd expect to realistically get through 802.11?

Related

How to create a pppoe connection for wired ethernet (ieee 802.3) in android?

I have an android 2.3 tablet featuring a host usb port. I also have a ethernet adapter that connects to usb.
My device supports ethernet facility as it is visible from settings menu.
Only problem is there is no way I can " create a connection" to my ISP using login details.
I dont have a router to translate wan to lan. Neither do i have a desktop/laptop/netbook.
I am not a geek but from the little knowledge I have I figure out it is only a matter of few lines of code or an app, till now I dont seem to have found.
It is far from trivial. Android doesn't natively support PPPoE, so you will need to build relevant code yourself, which is only doable on a rooted device. Additionally stock Android 2.3 doesn't support USB host mode. Does your tablet see the ethernet port when you connect it to USB? If so, you might have a chance. Otherwise invest in a cheap wireless router, all of them should support PPPoE.

Android USB HID Device

Does anyone know how to configure an Android device (tablet) to appear as a USB HID device when connected to a PC?
Is there any other way of getting data from the tablet to the PC (via USB) other than writing it to a file, and have the PC retrieve the (updated) file from the tablet which is acting as a 'mass storage device' for the PC?
Can USB carry a TCP/IP end-end connection?
Using a tablet as a high-end intelligent 'keyboard' or 'mouse' or similar device would be immensely powerful, and open up lots of possibilities. Controlling a model railway layout is the end I have in mind.
Thanks
It's possible to do this using the linux gadget framework http://www.linux-usb.org/gadget/ using a custom composite USB device. The gadget framework is part of the Android kernel source tree by inheritance from Linux.
Unfortunately, Android has its own customizations that restrict the ability to dynamically register new USB gadgets so you will need to patch the kernel source tree for your particular device and add your HID gadget (otherwise you could create a module and load it that way) to the supported Android list.
I have done this before and will update this answer to contain more detail if there is interest. Unfortunately I lost the code so I will have to start from scratch.
If I set up a web server on my phone and enable usb tethering, I can access that server from my PC. If that's not enough for you, this might help: https://market.android.com/details?id=usbwebcam.application&hl=en
I'm running cyanogenmod on a Desire CDMA (BravoC)
Let me know what you find out; it would be pretty handy to use my phone as a USB keyboard in the field. An android server with a PC client is gonna be easiest though.
Have a look at Android Open Accessory Protocol 2.0. This could help you out.

Using My Android as a USB Device

I've been able to find a few posts on StackOverflow about how to control USB devices using an Android phone -- which I understand is impossible (The Android being a USB device and all.)
However, I would be perfectly happy to set up my application to communicate with the other computer (a Linux host) as a USB device. (Like a really expensive mouse...)
Does anybody have information about how to set up an Android app/phone to use the USB connection and exchange data with a host computer. Obviously, it already works at some level -- it's how Eclipse and Android SDK/debugger do what they do, but I'm still looking for some way to do this in an application.
(My current phone, BTW, is a Droid Incredible.)
Thanks,
R.
Basically you'd need to install the USB device driver and the ADB toolsuite from the SDK, either that or reverse engineer their functionality and build it into something else.
Then you enable USB debugging on the phone.
And then you can do something like an adb port forward to allow an application on the pc to connect to a network socket listener on the phone. Note that connections cannot be made in the other direction, but once a connection is made it is bidirectional.
If your version of android supports tethering over USB, you could also leverage that to implicitly create a network between the PC and the phone, at which point you can make connections in either direction. Just make sure nothing starts accidentally pumping lots of data through the phone's mobile network!
(Many android phones actually can experimentally function as USB hosts, but you have to compile new drivers into the kernel, install the new version, and make up a cable to provide USB power to the device as the phone cannot. Also you lose the ADB over USB channel which makes debugging a pain)

Android: Communicating with a USB device which acts as host

We have made a device which can act as an USB host or slave and processes the data it receives. I want to use the Android phones to send the data to it via USB.
My research leads me to conclude that we cannot use Android devices in USB Host mode without modifying the hardware or OS. Doing so is not an option as this is going to be a commercially deployed device.
However, I couldn't find any information on using the Android phone as a slave. This is already technically possible because it can connect to the PC in a similar configuration. Can we do the same via an application? If so, any information on how to achieve this will be greatly appreciated. I have full access to our device's embedded system, so custom code there should not be a problem.
This is already technically possible
because it can connect to the PC in a
similar configuration.
Only for things baked into the firmware. Your SDK application cannot invent new Linux device drivers, nor does it have any access to the Android device side of the adb connection.
Can we do the same via an application?
Since you have not said what you are trying to do, this is impossible to answer in a definitive fashion.
Say, for example, the "device which can act as an USB host or slave and processes the data it receives" wants screenshots off of the Android device. That is eminently possible via adb, because adb has a protocol for that built in. All you would need to do is have your device connect to the Android device via the adb protocol and request screenshots, no different than does DDMS or hierarchyviewer.
So, I would look at the problem from a different perspective: if you can accomplish it via DDMS, you can do it via your custom device. If you can accomplish it via adb shell commands, you can do it via your custom device. If you cannot accomplish your goals via existing interfaces, though, since you have no way to invent new ones over USB, you will be stuck.
Conceivably, you could plug your custom device into a Bluetooth or WiFi dongle, then use those on Android for communication.

External USB devices to Android phones?

I would like to use Android phones as a way to do some processing and visualization of a sensor that would be attached to the USB port on the phone. The sensor would plug into the micro/mini USB, and then I would need to read the incoming data from the USB serial port.
Is this possible? I have heard of people using Android to steer robots and other applications, but I have never seen Android being used as a host for a USB sensor. I can't seem to find any official documentation on the subject either, but it seems like it would be a very useful tool. Any thoughts, links, or information on this matter? Thanks.
What you're looking for is USB Host support.
There's an open issue in Android's issue tracker here for it:
http://code.google.com/p/android/issues/detail?id=738&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
and it's actually ranked 7th, in terms of "stars" (think votes, by the people), at 1110 stars. You can log in and star it yourself, both to vote for it, and to receive email updates.
There was also work on a patch back in February, 2010:
http://groups.google.com/group/android-kernel/browse_thread/thread/c8471573d7553331
and there's info on using a USB keyboard here:
http://www.tombom.co.uk/blog/?p=124
Perhaps you can find something for your sensor there?
This is cool =):
http://www.technologyreview.com/biomedicine/25286/?a=fb
Cheers,
Victor
should be possible, look up android.hardware.usb.UsbDevice # http://developer.android.com/reference/android/hardware/usb/UsbDevice.html
This support has been added since Android 3.1.
Look at http://developer.android.com/guide/topics/connectivity/usb/index.html
This guy has modded his Nexus One to work as a USB host and has done several cool things.
He uses a USB keyboard and runs a movie from his USB stick. Then he runs a webcam through the phone and displays it on the computer and even runs an entire desktop-based Linux distro from his phone onto his computer monitor.
Pretty amazing stuff.
http://sven.killig.de/android/N1/2.2/usb_host/
The USB defines two type of equipment 1 usb host 2usb device .A device can only be attached to a host,no host to host or device to device connection.,in the beginning usb hosts were computers to which a usb device is attached.but with increase in popularity of usb interface a number of equipments come as usb host ie you can attach your pendrive and other usb device to it.In the starting mobile phones were manufactured as usb device ie you can attach your phone to usb host only typically a computer.but there also revolution come in now we have phone which can act as host and device when it is working as host we can attatch printer to it and when it work as device it can be attatched to a computer.only high end phone has this support.low end phones are still usb devices.
so we have two options
phone in usb host mode and your senser as usb device(you will need microcontroller that can act as usb device for this purpose-eg pic 18f2550 microcontroller);
your phone as device and your senser circuit as usb host here you will need high end microcontrollers that can act as usb host
in both cases there involves coding at both phone and senser circuit microcontroller
i dont know anything about phone side coding but i think this helps you to get a direction to what to do.
Have a look at You Are Here GPS.
https://play.google.com/store/apps/details?id=com.agbooth.usbgps

Categories

Resources