[2/2] ntdll: Store full line status register in the internal structure, not just the TIOCSER_TEMT bit.

Dmitry Timoshkov dmitry at baikal.ru
Wed Aug 28 20:27:05 CDT 2013


Printing complete lsr value in the log may help with diagnosing
test failures on Alexandre's machine.
---
 dlls/ntdll/serial.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c
index de699ef..6cd3d8f 100644
--- a/dlls/ntdll/serial.c
+++ b/dlls/ntdll/serial.c
@@ -781,7 +781,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 +826,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 +840,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 +865,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 +885,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;
-- 
1.8.3.4




More information about the wine-patches mailing list