I have one tablet, OTG cable and one specific device that reads signals and send them over USB. Now I want to make application that reads data from this device. That device is based on FTDI chip.
In documentation there is stated that emulator does not support USB connections.
So how to test and debug applications in this case? Copying .apk file every time to tablet is not solution.
You can debug on your tablet just as you do with the emulator, unless there is no adb USB driver available for your device.
Guidance can be found here: http://developer.android.com/tools/device.html
Related
I am creating an app (running in USB accessory mode) that will recognise when a specially made device (that I am also working on) is plugged in and connect to it.
I have written code in the app for this recognition to happen but now need to test it and the specially made device is not made yet.
So, I was wanting to test my app by somehow setting my PC up to be recognised as a usb host device that my phone can connect to, I spent a long time googling and looking for a way to do this or a different way to test this but came up empty.
How do I set my PC up in this way to test my app or what would be a good way to test this automatic usb connecting?
Thank you kindly,
EDIT:
Even the name of a cheap device that runs in android usb host mode would be sufficient as I could still just plug that into my device to check if it is working.
I think your question is how to emulate USB Host mode with the Emulator and setting up a bridge with an emulated device on the PC. This is not possible (yet).
See Emulator documentation. In the "What's not supported section" it is said that virtual hardware is not supported for USB.
I'm developing an Android Accessory using a Galaxy Nexus phone and the official Arduino ADK board. I'm using all the standard Arduino libraries available here. I'd like to be able to debug my Android code at runtime so I followed Googles' instructions in their "Debugging Considerations" documentation in order to do remote debugging via WiFi.
When I connect to the phone via USB I'm able to debug just fine (of course it's not talking to the Arduino board though). When I connect to the phone via WiFi I can debug just fine. However when I plug in the board to the phone it no longer auto-launches my application (that's registered with the ADK device). So instead I manually start my application but it cannot find the Arduino accessory. If I switch back to USB debugging and reconnect the ADK board to the phone it auto-launches like normal and everything is fine, but then I'm back to not being able to debug.
There are no changes to the code during all of this. All I did was change how the adb tool reaches the phone. Any guesses why the phone and my application can no longer see the ADK board?
In short:
If the phone is set to debug via USB, it can talk to the Arduino ADK with no problems.
If I invoke "adb tcpip 5555 < enter> adb connect < device-ip-address>:5555" I can remotely debug the phone with no problems.
If I now connect the ADK board to the phone with the USB cable, the phone cannot find the ADK board, but I can still do remote debugging via WiFi. That's how I know that the accessory cannot be found.
Edit:
The phone is running Android 4.1.1 and the Arduino is 1.0.1.
Just bumped into this problem, having returned to USB Accessory work. Yes there is a problem, I've no idea how to fix the problem as later versions of Android simply don't allow you to both run adb over wifi and USB Accessory at the same time. My solution and you probably got there already yourself was to root my phone, luckily a Nexus S, and down grade the Android on it to 2.3.6
It's not a great solution but to debug USB Accessory I have to boot into 2.3.6. Hopefully in the future this might work again.
Debugging USB Accessory through wifi is only possible on Nexus devices. I tried many others (Samsung's, Motorola), they don't detect accessory when USB debugging is enabled in settings. Also tried hardware usb switcher - does not help.
I am trying to debug on a USB connection to several different Sony tablets (particularly the P, which is listed as supported). I can debug on a smart phone, but the tablet doesn't show up as a connected device when I try to run my app in Eclipse. I have checked that the settings of the tablet have Applications->Unknown sources, and Applications->Development->USB Debugging
This is a fairly common problem. You basically don't have the drivers you need for USB debugging.
There are a few different ways I've had to obtain drivers for phones. The first way you should attempt is to go into the Android SDK and AVD manager and download the Google USB driver debug package.
This may or may not give you the driver you need. If it doesn't you will have to do one of two things. One, add the device details to the driver file you just downloaded. Generally these will be posted on forums/boards discussing your Tablet/Phone type. Secondly, you can download a different driver from another source like the Tab/Phone manufacturer.
Here a Youtube video how to install Sony Tablet S & P
Or the app you are developing has set the target higher than your tablet supports. Then it also won`t show up in the AVD Manager.
In case you wont get proper drivers for your tablet you can try adb over network.
Connect your device to wifi as well as your computer.
turn on ADB over network in Options for developers (maybe some ROM dont support it). Eventualy you can enable this using specific commands on your tablet.
on your computer run terminal and use: adb connect <ip>:<port> where <ip> refers to IP of your tablet and <port> refers to port on which adb is listening (usually 5555).
run adb devices to verify that device is connected
I found the USB docs for Android and from there it seems as if one could write a communication program on an Android phone that works exactly like on a PC.
I have a normal USB-cable that normally connects between a PC and an external device. On one end it is a normal USB on the other end it has a special plug for the device.
If I get an USB female-female adapter I could connect my normal Android phone cable USB end to my device USB cable and so basically plug in my special USB cable into the Android phone.
Does anyone have experience doing USB communcation programming on Android - basically copying normal PC USB functionality? All I would have to do is sent and receive text strings over the USB port - just like on a PC.
Is this possible or is the USB port programming on Android limited in any way
and not really identical to USB programming on a PC? eg. power supply through USB or anything else?
ps on the PC I need to have a FTDI driver installed to work with the external device.
Many thanks
UPDATE:
it seems that starting with Android 3.1 it is possible to do this - however, if I understand htis correctly, Android 3.1 runs only on tablet Android devices - I might be wrong with this - compared to Apple this all this pretty confusing (however, with Apple iPhone it will never work! ;)
Yes, Android supports USB host on 3.1 and newer, so you can connect USB devices directly to an Android device using a converter cable. Android 4.0 brings this feature to handset devices.
What would be the best way to access the USB as a serial port on an Android device (HTC Magic)?
I am thinking about an OBD-II interface. Can I do this on a standard phone or more likely will I need a modified firmware?
According to this post, Matt Porter presented a review of Android at the Embedded Linux Conference Europe. I mention this mostly because of the example used to describe the current state of Android.
"Just one more practical example: You cannot even plug a USB drive to an android system, since /dev/sd* is not an expected device name in their hardcoded hotplug management.
Executive summary: Android is a screwed, hard-coded, non-portable abomination."
I'm sure someone's working on it, but I'm afraid for now you're out of luck unless you're willing to go low-level and edit the OS.
PSFreedom (project to jailbrack Playstation 3) has list of controllers which support usb host mode which then translate to supported Android devices.
My own expirience is that usb host works on HTC Dream/G1 without problems.
For OBD-II I would suggest bluetooth ODB-II dongle which side-stepps problem with usb host adapter.
Depending on the USB chip in your particular phone, it may be possible to rebuild the kernel to support USB Host mode or USB On-The-Go (Host + Gadget modes) instead of the normal USB Gadget mode. I've found some people speculating that it could be possible on the HTC Dream. Assuming you could reconfigure the USB port in Host mode a USB to serial, ODB-II, or CAN should be doable.
From what I can tell Android is Linux of some sort, to have USB device which would apear as serial port, you should write a driver for that device. I don't know much about OBD-II interface but i am guesing they use some sort of USB driver for windows, same is for android, not mentioning the application to handle the driver.
I don't think the current Android devices can act as a USB host only as a USB device when attached to a host. So using the USB port as a serial port is not likely.
Get a hostmode kernel for your device and you can use python for android and the pyserial library to talk to the serial over USB. I did this with Huawei Ideos U8150 (here is the post) for a loopback test.