Android 3.1+ USB as virtual COM port

Posted by ZachMc on Stack Overflow See other posts from Stack Overflow or by ZachMc
Published on 2012-02-16T12:22:55Z Indexed on 2012/03/23 11:30 UTC
Read the original article Hit count: 323

Filed under:
|
|

I have a third party usb device, that when plugged into a Windows machine, is recognized as a serial device and assigned to the COM 4 port. I can communicate with the device just like I would with a device connected via a serial port. For instance, I can write "abc" serially to the device via the USB connection.

I have been searching for a way to do a similar thing in Android. If I try the Usb Host method, and use a UsbManager to open the UsbDevice, I can get one interface, with 2 endpoints. I have tried sending control messages using the method in UsbDeviceConnection, but the method returns -1 for everything (though I don't know what I should use for the parameters of that method).

Is there a way to get an OutputStream that I can write to that will send bytes to the USB device? Right now I am looking at recompiling the kernel to include a virtual COM port driver and write some native code to be able to do this.

Thanks!

Edit: I am using the FTDI serial to USB converter circuit. Is this compatible with Android?

© Stack Overflow or respective owner

Related posts about android

Related posts about usb