Bug 209359 - tcdrain() returns too early on PL2303
Summary: tcdrain() returns too early on PL2303
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Serial (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Russell King
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-23 14:57 UTC by pkk
Modified: 2020-09-23 14:57 UTC (History)
0 users

See Also:
Kernel Version: 5.8.7
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description pkk 2020-09-23 14:57:11 UTC
In an application where I need to know that all data has been transmitted, a FT232R works, but Pl2303GT and PL2303TA do not.
I tracked this down to a tcdrain() issue: If I add an usleep() calculated to give enough time to transmit everything, the PL2303GT and PL2303TA work too.

So I had a quick look at the pl2303 driver. It sets port.drain_delay to 256, which should be enough to drain the buffers. However, it looks to me as if port.drain_delay is used only when closing the port (via tty_port_close in tty_port.c), not for tcdrain (via TCSBRK ioctl in tty_io.c).

Note You need to log in before you can comment on or make changes to this bug.