4
2
It's possible to setup a serial port communication using hardware flow control with the RTS/CTS pins (CRTSCTS flag for tcsetattr), but there is no way to use the DTR/DSR pins for flow control in a reliable and efficient way.
One can use the TIOCMGET ioctl() to check the pin state, but then we need to send one byte at a time, which makes it VERY SLOW!
Isn't there a better way? Making our own cables doesn't scale and there are many POS serial printers on the market that only use DTR/DSR flow control.
P.S.- Forget XON/XOFF, I need reliable 8-bit communication.
Voted to delete my answer to increase the chances of getting better answers. This really seems to be an interesting problem other people have faced, too. Interestingly there were at least 3 kernel patches (2001, 2008 and 2010) to address this issue, but none of them seem to be implemented in current ditribution kernels. Looks like only solution (if not taking the custom cable option) would be to patch the kernel on your own. If it's for POS terminals where you have control over all installes software, a BSD UNIX could also worth a try. – ktf – 2011-10-10T21:23:11.640
This comment actually helped me. I found that Red Hat Enterprise Linux 5.3 included a patch to fix this problem [1] on a 2.6.18 kernel. Since RHEL is pretty much a kind of industry standard I believe it's pretty safe to use their patch [2]. [1] http://rhn.redhat.com/errata/RHSA-2009-0225.html [2] https://bugzilla.redhat.com/show_bug.cgi?id=445211
– nlucas – 2011-10-12T12:35:30.720