PATCH: TIOCMBIS/TIOCMBIC not working when using usbser.sys

Carlo B. carlo.bramini@gmail.com
Thu Nov 10 09:07:01 GMT 2022


Hello,
into winsup/cygwin/fhandler/serial.cc, the function
fhandler_serial::switch_modem_lines() is called when TIOCMBIS/TIOCMBIC
are used into 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 a CYGWIN but an issue of the usbser.sys
driver from Microsoft, 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.

Here, I attached a patch that I made for fixing this issue.
Anyways, in my opinion 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.

I was wondering if this fix could be imported into the core of CYGWIN
and if it could be possible to include it also into the v3.3.x branch,
since I have seen that 32bit support has been removed from Master
branch recently.

Thank you very much for your time.

Sincerely,

Carlo Bramini.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winsup_cygwin_fhandler_serial.cc.patch
Type: application/octet-stream
Size: 1743 bytes
Desc: not available
URL: <https://cygwin.com/pipermail/cygwin/attachments/20221110/e6e4dbcb/attachment.obj>


More information about the Cygwin mailing list