--- DrvHostSerial.cpp	2008-11-26 19:41:01.000000000 +0100
+++ DrvHostSerial_orig.cpp	2008-11-26 18:57:06.000000000 +0100
@@ -61,8 +61,6 @@
 #  ifndef TIOCM_LOOP
 #   define TIOCM_LOOP 0x8000
 #  endif
-
-#define LINUX_CMIWAIT_BUG 1 /* 2.6.24 TIOCMIWAIT workaround */
 # endif /* linux */
 
 #elif defined(RT_OS_WINDOWS)
@@ -123,7 +121,7 @@
     RTFILE                      WakeupPipeR;
     /** The write end of the control pipe */
     RTFILE                      WakeupPipeW;
-# if !defined RT_OS_LINUX || LINUX_CMIWAIT_BUG
+# ifndef RT_OS_LINUX
     /** The current line status.
      * Used by the polling version of drvHostSerialMonitorThread.  */
     int                         fStatusLines;
@@ -945,23 +943,57 @@
 {
     PDRVHOSTSERIAL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTSERIAL);
     int rc = VINF_SUCCESS;
-    unsigned const uStatusLinesToCheck = TIOCM_CAR | TIOCM_RNG | TIOCM_DSR | TIOCM_CTS;
+    unsigned uStatusLinesToCheck = 0;
 
-    if ( PDMTHREADSTATE_INITIALIZING == pThread->enmState)
+    uStatusLinesToCheck = TIOCM_CAR | TIOCM_RNG | TIOCM_LE | TIOCM_CTS;
+
+    if (pThread->enmState == PDMTHREADSTATE_INITIALIZING)
         return VINF_SUCCESS;
-    do
+
+    while (pThread->enmState == PDMTHREADSTATE_RUNNING)
     {
         uint32_t newStatusLine = 0;
         unsigned int statusLines;
 
-        if ( 0 > (rc = ioctl( pThis->DeviceFile, TIOCMGET, &statusLines)))
+# ifdef RT_OS_LINUX
+        /*
+         * Wait for status line change.
+         */
+        rc = ioctl(pThis->DeviceFile, TIOCMIWAIT, &uStatusLinesToCheck);
+        if (pThread->enmState != PDMTHREADSTATE_RUNNING)
+            break;
+        if (rc < 0)
         {
+ioctl_error:
             PDMDrvHlpVMSetRuntimeError( pDrvIns, false, "DrvHostSerialFail",
                 N_("Ioctl failed for serial host device '%s' (%Rrc). The device will not work properly"),
-                pThis->pszDevicePath, RTErrConvertFromErrno(errno)
-            );
+                                       pThis->pszDevicePath, RTErrConvertFromErrno(errno));
             break;
         }
+
+        rc = ioctl(pThis->DeviceFile, TIOCMGET, &statusLines);
+        if (rc < 0)
+            goto ioctl_error;
+# else  /* !RT_OS_LINUX */
+        /*
+         * Poll for the status line change.
+         */
+        rc = ioctl(pThis->DeviceFile, TIOCMGET, &statusLines);
+        if (rc < 0)
+        {
+            PDMDrvHlpVMSetRuntimeError(pDrvIns, false, "DrvHostSerialFail",
+                                       N_("Ioctl failed for serial host device '%s' (%Rrc). The device will not work properly"),
+                                       pThis->pszDevicePath, RTErrConvertFromErrno(errno));
+            break;
+        }
+        if (!((statusLines ^ pThis->fStatusLines) & uStatusLinesToCheck))
+        {
+            PDMR3ThreadSleep(pThread, 500); /* 0.5 sec */
+            continue;
+        }
+        pThis->fStatusLines = statusLines;
+# endif /* !RT_OS_LINUX */
+
         if ( statusLines & TIOCM_CAR)
             newStatusLine |= PDM_ICHAR_STATUS_LINES_DCD;
         if ( statusLines & TIOCM_RNG)
@@ -970,27 +1002,10 @@
             newStatusLine |= PDM_ICHAR_STATUS_LINES_DSR;
         if ( statusLines & TIOCM_CTS)
             newStatusLine |= PDM_ICHAR_STATUS_LINES_CTS;
-        pThis->pDrvCharPort->pfnNotifyStatusLinesChanged( pThis->pDrvCharPort, newStatusLine);
-
-        if ( PDMTHREADSTATE_RUNNING != pThread->enmState)
-            break;
-# if defined RT_OS_LINUX && !LINUX_CMIWAIT_BUG
-        /* BUGBUG: In Linux 2.6.24 and earlier the 8250 driver doesn't report modem status
-         * changes unless there has been data I/O. */
-
-        /* Wait for status line change. */
-        ioctl( pThis->DeviceFile, TIOCMIWAIT, uStatusLinesToCheck);
-        Log(("HostSerial#%d: MonitorThread modem status changed.\n", pDrvIns->iInstance));
-# else
-        /* Poll for status line change. */
-        if (!((statusLines ^ pThis->fStatusLines) & uStatusLinesToCheck))
-            PDMR3ThreadSleep( pThread, 500); /* 0.5 sec */
-        pThis->fStatusLines = statusLines;
-# endif
+        rc = pThis->pDrvCharPort->pfnNotifyStatusLinesChanged(pThis->pDrvCharPort, newStatusLine);
     }
-    while ( PDMTHREADSTATE_RUNNING == pThread->enmState);
 
-    return rc;
+    return VINF_SUCCESS;
 }
 
 /**
@@ -1325,7 +1340,7 @@
 
 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN)
     /* Linux & darwin needs a separate thread which monitors the status lines. */
-# if !defined RT_OS_LINUX || LINUX_CMIWAIT_BUG
+# ifndef RT_OS_LINUX
     ioctl(pThis->DeviceFile, TIOCMGET, &pThis->fStatusLines);
 # endif
     rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pThis->pMonitorThread, pThis, drvHostSerialMonitorThread, drvHostSerialWakeupMonitorThread, 0, RTTHREADTYPE_IO, "SerMon");
