cannot read but can write on serial port through Android Emulator
Posted
by
Aad
on Stack Overflow
See other posts from Stack Overflow
or by Aad
Published on 2013-11-07T11:04:13Z
Indexed on
2013/11/12
9:54 UTC
Read the original article
Hit count: 239
I am working on a program that is communicating with serial port over USB through Android emulator.
emulator -qemu -serial /dev/ttyUSB0
The emulator is able to open the port and write into it. However, read is not happening.
The program has a timeout for read maintained by a timer. The read happens in a separate 'read' thread. The main thread has a socketpair
fd pair to signal the read-thread that the serial port is closed post timeout. In the read-thread, polling happens(poll()
function call) over the 2 file-descriptors: one is serial port fd, the other is one of the socketpair.
The board that I have connected to works fine with sending commands over 'cutecom'
The poll never succeeds for serial port. However, poll succeeds for 'socketpair'ed fd and the thread ends on a close-signal sent from main-thread post timeout.
Ouestions:
- Are there any special settings for read as even loop-back fails
- Are there differences between settings for read and write on a serial port?
© Stack Overflow or respective owner