Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

with the host capabilities of the android phone, it's kinda easy to send serial messages. All you have to do is to plug a USB to serial adapter to your phone (via an USB otg cable) and then write to the file /dev/usb/tty2-1:1.0 (echo "string" > /dev/usb/tty2-1:1.0) (or an other file in that directorey, depending on which file comes up when you plug iin the adapter). But does anyone know how to determine and change the parameters for the serial connection? I belive that it should be a config file or something where all the parameters are stored.

regards Agge

share|improve this question

1 Answer

On an (implicitly non-standard) Android device which has a kernel module to support this and something which makes a device node with permissions such that you can actually use it, you should be able to use normal serial APIs as in desktop linux.

There is probably not a "config file" for the line settings - there typically isn't on a desktop linux either, as it is up to an application to set what it needs (a given terminal application might itself have a configuration file that would include these settings, but they would only take effect when it was run)

You should be able to use tcgetattr()/cfsetospeed()/tcsetattr() and related from an NDK library (find a desktop linux example C program as a guide, also see the linux termios manpage); likely there's a standard API inherited from non-Android Java as well.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.