mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-22 15:07:43 +08:00
2dab880c96
In winsup/cygwin/fhandler/serial.cc, the function fhandler_serial::switch_modem_lines() is called when TIOCMBIS/TIOCMBIC are used in an ioctl() call. This function uses EscapeCommFunction() for setting and resetting RTS and DTR signals of a serial port. Unfortunately, this function does not work on USB CDC devices. This is not a true bug of CYGWIN but an issue of the usbser.sys driver, from Windows 2000 to the latest Windows 11. Both 32bit and 64bit versions of the operating system are affected. Actually, I tested EscapeCommFunction() also when using a real UART, based on the traditional 16550 driver and it works fine. Using thirdy party CDC drivers, like the one provided by FTDI for their USB bridge chips, probably also works. However, it is also possible to drive the RTS/DTR signals by writing their state with SetCommState(), which proved to be working fine all types of connection. This is also a better solution for handling these signals since RTS/DTR can be set at the same time rather than having two separate calls with a visible delay between them.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cygwin documentation is available on the net at https://cygwin.com You might especially be interested in https://cygwin.com/faq/faq.html#faq.programming.building-cygwin