ntdll: Store full line status register in the internal structure, not just the TIOCSER_TEMT bit. Take 2.
Dmitry Timoshkov
dmitry at baikal.ru
Fri Aug 30 04:21:51 CDT 2013
Printing complete lsr value in the log may help with diagnosing
test failures on Alexandre's machine.
---
dlls/ntdll/serial.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c
index de699ef..7665d60 100644
--- a/dlls/ntdll/serial.c
+++ b/dlls/ntdll/serial.c
@@ -81,6 +81,10 @@
#define TIOCINQ FIONREAD
#endif
+#ifndef TIOCSER_TEMT
+#define TIOCSER_TEMT 0x01
+#endif
+
WINE_DEFAULT_DEBUG_CHANNEL(comm);
static const char* iocode2str(DWORD ioc)
@@ -781,7 +785,7 @@ static NTSTATUS set_XOn(int fd)
*/
typedef struct serial_irq_info
{
- int rx, tx, frame, overrun, parity, brk, buf_overrun, temt;
+ int rx, tx, frame, overrun, parity, brk, buf_overrun, lsr;
}serial_irq_info;
/***********************************************************************
@@ -826,12 +830,12 @@ static NTSTATUS get_irq_info(int fd, serial_irq_info *irq_info)
memset(irq_info,0, sizeof(serial_irq_info));
#endif
- irq_info->temt = 0;
+ irq_info->lsr = 0;
/* Generate a single TX_TXEMPTY event when the TX Buffer turns empty*/
#ifdef TIOCSERGETLSR /* prefer to log the state TIOCSERGETLSR */
if (!ioctl(fd, TIOCSERGETLSR, &out))
{
- irq_info->temt = (out & TIOCSER_TEMT) != 0;
+ irq_info->lsr = out;
return STATUS_SUCCESS;
}
@@ -840,7 +844,7 @@ static NTSTATUS get_irq_info(int fd, serial_irq_info *irq_info)
#ifdef TIOCOUTQ /* otherwise we log when the out queue gets empty */
if (!ioctl(fd, TIOCOUTQ, &out))
{
- irq_info->temt = out == 0;
+ if (!out) irq_info->lsr |= TIOCSER_TEMT;
return STATUS_SUCCESS;
}
TRACE("TIOCOUTQ err %s\n", strerror(errno));
@@ -865,7 +869,7 @@ static DWORD check_events(int fd, DWORD mask,
TRACE("old->parity 0x%08x vs. new->parity 0x%08x\n", old->parity, new->parity);
TRACE("old->brk 0x%08x vs. new->brk 0x%08x\n", old->brk, new->brk);
TRACE("old->buf_overrun 0x%08x vs. new->buf_overrun 0x%08x\n", old->buf_overrun, new->buf_overrun);
- TRACE("old->temt 0x%08x vs. new->temt 0x%08x\n", old->temt, new->temt);
+ TRACE("old->lsr 0x%08x vs. new->lsr 0x%08x\n", old->lsr, new->lsr);
if (old->brk != new->brk) ret |= EV_BREAK;
if ((old_mstat & MS_CTS_ON ) != (new_mstat & MS_CTS_ON )) ret |= EV_CTS;
@@ -885,7 +889,7 @@ static DWORD check_events(int fd, DWORD mask,
}
if (mask & EV_TXEMPTY)
{
- if (!old->temt && new->temt)
+ if (!(old->lsr & TIOCSER_TEMT) && (new->lsr & TIOCSER_TEMT))
ret |= EV_TXEMPTY;
}
return ret & mask;
@@ -973,7 +977,7 @@ static NTSTATUS wait_on(HANDLE hDevice, int fd, HANDLE hEvent, PIO_STATUS_BLOCK
if (commio->evtmask & EV_RXCHAR)
goto error_caps;
#endif
-#if !(defined(TIOCSERGETLSR) && defined(TIOCSER_TEMT)) || !defined(TIOCINQ)
+#if !defined(TIOCSERGETLSR) || !defined(TIOCINQ)
if (commio->evtmask & EV_TXEMPTY)
goto error_caps;
#endif
@@ -1023,7 +1027,7 @@ static NTSTATUS wait_on(HANDLE hDevice, int fd, HANDLE hEvent, PIO_STATUS_BLOCK
if (status != STATUS_SUCCESS) goto out_now;
return STATUS_PENDING;
-#if !defined(TIOCINQ) || (!(defined(TIOCSERGETLSR) && defined(TIOCSER_TEMT)) || !defined(TIOCINQ)) || !defined(TIOCMGET) || !defined(TIOCM_CTS) ||!defined(TIOCM_DSR) || !defined(TIOCM_RNG) || !defined(TIOCM_CAR)
+#if !defined(TIOCINQ) || !defined(TIOCSERGETLSR) || !defined(TIOCINQ) || !defined(TIOCMGET) || !defined(TIOCM_CTS) ||!defined(TIOCM_DSR) || !defined(TIOCM_RNG) || !defined(TIOCM_CAR)
error_caps:
FIXME("Returning error because of missing capabilities\n");
status = STATUS_INVALID_PARAMETER;
--
1.8.3.4
More information about the wine-patches
mailing list