Android USB Serial - problems


#1

Any advice for getting a serial port working over USB?

I’m experimenting with two different USB-Serial dongles, one based on the Prolific PL2303 chipset and the other based on the FTDI R232. I’ve only had luck getting the prolific chip to do anything at all, but it’s extremely intermittent.

(1)
I’ve written some test apps based on Prolific’s drivers with middling success. Most of the time, the USB-serial dongle isn’t detected at all. The only way to get Android to recognize the presence of a serial dongle is to connect a micro-USB cable, then disconnect it. This seems to force Android to re-enumerate the USB bus, and see the USB-serial dongle. This will work through the first run of a serial app. After I quit and relaunch, the dongle isn’t detected.

No luck at all with the FTDI chipset, even using their provided test app (link below)

(2)
A second problem I have, is that for some of the test apps I’ve written, Android fails to request USB permission despite having

<uses-feature android:name="android.hardware.usb.host"/>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />

in the AndroidManifest.xml file.

Here are the various apps and libraries I’ve tried:

[works sometimes]
Prolific PL2303 Android USB Host API SDK (v1.0.0.13b)
http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=230&pcid=41

[doesn’t work]
FTDI UART Terminal Application
http://www.ftdichip.com/Android.htm

[doesn’t work - sometimes crashes]
usb-serial-for-android

[doesn’t work]
UsbSerial


#2

I can’t really speak to the “android drivers” things, the whole concept is pretty flakey.

But I will tell you that if you build the appropriate drivers into the linux kernel, either of the devices will work flawlessly AS a generic linux RS232 device. I.e., /dev/ttyUSBx


#3

Hello: I ‘think’ your problem is permissions on the /dev/ttyXXX device. connect to the board with adb shell, change to the /dev directory, and use ls look at the listed tty* devices. When you plug in the dongle you should get an additional tty* device. (/dev/ttyACM0 for the dongle I was using). Then run ls -l and you will find you don’t have write permissions. you can fix this with su and chmod, but the next timer you boot it will disappear. You need a more permanent solution.

Automatically Starting a program after the IFC6410 boots

The script you need to modify is:
/system/etc/init.qcom.post_boot.sh

You need to add the following at the very bottom of the file:
chmod 777 /dev/ttyACM0
chmod 777 /dev/ttyACM1

If you want your program to start when the 410c boots, just add it below the chmod instructions in the same file:

am start -n org.opencv.samples.tutorial2/org.opencv.samples.tutorial2.Tutorial2Activit