webclimber
webclimber

Reputation: 2640

Data collection with Android via USB

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?

Upvotes: 14

Views: 17895

Answers (6)

Karibe
Karibe

Reputation: 155

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.

Upvotes: 0

dpavlin
dpavlin

Reputation: 1430

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.

Upvotes: 3

Tim Kryger
Tim Kryger

Reputation: 11246

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.

Upvotes: 1

Kevin Williams
Kevin Williams

Reputation: 2613

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.

Upvotes: 4

Craig
Craig

Reputation: 4840

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.

Upvotes: 0

CrazyChris
CrazyChris

Reputation: 106

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.

Upvotes: 0

Related Questions