Thread (2 messages) 2 messages, 2 authors, 2021-11-30

Question: how to handle tty output buffer

From: chaozeng <hidden>
Date: 2021-11-30 07:36:27


Dear all

I have a question about the output buffer, it just related hardware 
flow-control enabled.


Question Description:

When the flow control works, rts works. At this time, the sender stops 
data transmission and exits the sender with interrupt.

We observed that the output buffer was not empty.

But

1. When the serial port device is used again, it will hang when 
modifying the properties.(We think the buffer is not empty, change 
termios property is not OK).

2. the receive side could receive these output buffer(before) next 
time.(seems strange)

Reproduce steps:

  1. Connect the send and receive side. enable hardware flow-control for
     both Send side and recv side. (start recv.py then send.py)(refer
     attachments)
  2. Waiting for RTS desseart.
  3. Close the send side using CTRL+C
  4. Using stty to show or set the uart attributes(it would hang).  and
     start the second round, the receive side would receive the data 
last sent.

I found FTDI usb-serial device would sent the data out when flow-control 
is enabled when closing the port ,but the ti omap_8250 device could not 
sent the data out and keep the buffer.

the behavior is not the same between several serial ports.


Questions:

I'd like to know the common handle logic about the output buffer.

When closing the port, should the output buffer to be sent out or be 
cleared no matter flow-control is enabled?

Who should be response for these output buffer. kernel or userspace 
application?

If we keep the output buffer after closing the port, what's thex intend 
of this?



Looking forward to your kind reply

Thanks a lot


BRs

Chao Zeng

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help