http://bugs.winehq.org/show_bug.cgi?id=11339
Summary: serial.c:wait_on() sanity checks seem to be too strict Product: Wine Version: unspecified Platform: Other OS/Version: other Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: ntdll AssignedTo: wine-bugs@winehq.org ReportedBy: e_val@inbox.ru
Created an attachment (id=10448) --> (http://bugs.winehq.org/attachment.cgi?id=10448) Trivial patch to fix the problem
In its present state, wait_on() function implemented in ntdll/serial.c fails more often then it should. This means that in some cases serial events are not reported to the calling Windows program (even if in practice they could be) leading to application malfunction.
The problem is in the sanity check: if ((status = get_irq_info(fd, &commio->irq_info)) || (status = get_modem_status(fd, &commio->mstat))) goto out_now;
which bails out and silently returns 0 if low-level Unix kernel driver for serial device doesn't implement TIOCGICOUNT or TIOCMGET ioctl()s. This is, in fact, intended behavior if the calling program wants to monitor events like EV_BREAK, EV_ERR or EV_CTS and friends (otherwise, Wine will loop forever in wait_for_event()) but is useless and even harmful if the event in interest is EV_RXCHAR or EV_TXEMPTY. In latter case the check just prevents the program from working correctly.
I've came across this bug when trying to make control software for AnyData CDMA modems (EasyWirelessNet 1.00.xx) working. In Linux, those devices use "option" driver, which lacks TIOCGICOUNT ioctl().
The trivial patch is attached. It's not against git clone of Wine so it is not meant for applying directly.