How to control a serial device on Android?

I want to develop a whitch application controlling a serial device via usb on Linux Android.
Android OS 3.1, which supports a USB host.

Q1: Please let me know how to get the port on which the serial device is installed.

I got information about a USB device when I received a β€œDump Device Status” on the Dalvik debug monitor.
And I checked / dev / tty * on an Android device using adb.
I do not know which one (/ dev / tty ??) is a serial device.

adb shell
$ ls / dev / tty *
/ Dev / terminal
/ Dev / ttyFIQ 0
/ Dev / ttyHS 0
/ Dev / ttyHS 2
/ Dev / ttyHS 3
/ Dev / ttyHS 4
/ Dev / ttyS 0
/ Dev / ttyS 1
/ Dev / ttyS 2
/ Dev / ttyS 3

Q2: Please let me know how to control a serial device on Android without root permission.

I have an application (exe) that can control a serial device on linux.
I tried to do this on android, but I could not do this for failure.

And I tried redirecting to the serial port (maybe)
$ ls> / dev / ttyS0
But I could not.
cannot create / dev / ttyS 0: permission denied.

Please let me know how to manage and access the serial device.

+8
android serial-port usb usbserial
source share
3 answers

The XDA forum review has an excellent review:

How to talk to a modem using AT commands .

This thread shows you how to send AT-commands (ATC) from a remote terminal (USB connection to your PC), but it has not yet solved the problem of using a local (telephone) terminal to talk to the Modem phone.

BTW. You need a terminal application / application to talk to the modem (remember that this is a two-way communication). So, what do you need the root device for, since the root kit usually has Busybox (which includes the microcomputer's terminal program). Otherwise, you need to write your own program.

+3
source share

in the next step, you can check tty * port for a couple of commands: $ cat / dev / tty * / to receive characters from tty and also $ echo 'text string'> / dev / tty * / to send characters to tty

Good luck

+1
source share

Try it on the root device? Learning the same thing that I read that only some devices 3.1 / 2.3.4 allow root access to the usb port without root access.

This is what I get from my HTC Desire not downloaded 2.2:

$ ls /dev/tty* ls /dev/tty* /dev/tty /dev/ttyHS0 /dev/ttyHSUSB0 /dev/ttyHSUSB1 /dev/ttyHSUSB2 /dev/ttyMSM0 

My Asus Transformer, unrooted, 3.2:

 $ ls /dev/tty* ls /dev/tty* /dev/tty /dev/ttyHS1 /dev/ttyHS2 /dev/ttyS0 /dev/ttyS1 /dev/ttyS2 /dev/ttyS3 

I get exactly the same list when it docked with the keyboard dock installed (it's like 2 USB ports).

Hope this helps, please let me know, I will be happy to do the same.

0
source share

All Articles