开发者

USB Android I/O

Is it possible to access the USB port on Android phones? (Droid X for example)

Here is my usage case:

Have a USB device attached to the Android phone. The phone listens for data on this USB device. (The USB device i开发者_StackOverflows connected to a USB->RS-232 converter that has I/O attached to it)

This would be slick if possible. Does anyone know if this is possible?


Would be slick, yup. Not possible though. There's a feature request for it: http://code.google.com/p/android/issues/detail?id=738


Actually it is possible on a lot of the phones if you are able to install a new kernel with a USB host driver and rig up a custom cabling scheme to provide usb bus power to the device as the phone won't. A few phones even shipped with this capability already live.

I don't know if the Droid X specifically ships with this already, can have it added (if you are able to flash kernels), could have it added but no one has written the host driver yet, or is missing the hardware capability.

You also would need to enable the appropriate usb serial converter device driver (identified by experimenting with the device on a desktop linux box), but that's probably already in the kernel sources and just needs to be selected in the config. You may also need to create a device file for the /dev/ttyUSB0 or whatever and give it permissions appropriate to the application that wants to access it. (This requires root, but if you can reflash the kernel, you can get root)

If you want to pursue this, search the android kernel google group for posts about USB host mode.

One serious downside to putting the USB into host mode is that you loose the adb interface into the phone, which makes working on your projects hard. You'll probably need to either build an adapter for the low voltage debug serial port if there is one (as on G1, mytouch, etc) so you can get a console shell (or just use that instead of USB to talk to your peripheral) or at a minimum set up an ssh and sftp server on the wifi.

Since you want serial anyway, another option people have used is to get a bluetooth-to-serial module from an outfit such as sparkfun.


A bluetooth to serial adapter might solv your problems. You can find one at https://www.sparkfun.com/products/582. Boards from other companies are also available for example on ebay.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜