Changeset 63583 in vbox
- Timestamp:
- Aug 18, 2016 11:16:44 AM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp
r62956 r63583 114 114 /** The write end of the control pipe */ 115 115 RTPIPE hWakeupPipeW; 116 # ifndef RT_OS_LINUX117 116 /** The current line status. 118 117 * Used by the polling version of drvHostSerialMonitorThread. */ 119 118 int fStatusLines; 120 # endif121 119 #elif defined(RT_OS_WINDOWS) 122 120 /** the device handle */ … … 895 893 { 896 894 PDRVHOSTSERIAL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTSERIAL); 897 int rc = VINF_SUCCESS;898 895 unsigned long const uStatusLinesToCheck = TIOCM_CAR | TIOCM_RNG | TIOCM_DSR | TIOCM_CTS; 896 #ifdef RT_OS_LINUX 897 bool fPoll = false; 898 #endif 899 899 900 900 if (pThread->enmState == PDMTHREADSTATE_INITIALIZING) … … 908 908 * Get the status line state. 909 909 */ 910 rc= ioctl(RTFileToNative(pThis->hDeviceFile), TIOCMGET, &statusLines);911 if (rc < 0)910 int rcPsx = ioctl(RTFileToNative(pThis->hDeviceFile), TIOCMGET, &statusLines); 911 if (rcPsx < 0) 912 912 { 913 913 PDMDrvHlpVMSetRuntimeError(pDrvIns, 0 /*fFlags*/, "DrvHostSerialFail", … … 940 940 * modem irqs and so the monitor thread never gets released. The workaround 941 941 * is to send a signal after each tcsetattr. 942 * 943 * TIOCMIWAIT doesn't work for the DSR line with TIOCM_DSR set 944 * (see http://lxr.linux.no/#linux+v4.7/drivers/usb/class/cdc-acm.c#L949) 945 * However as it is possible to query the line state we will not just clear 946 * the TIOCM_DSR bit from the lines to check but resort to the polling 947 * approach just like on other hosts. 942 948 */ 943 ioctl(RTFileToNative(pThis->hDeviceFile), TIOCMIWAIT, uStatusLinesToCheck); 949 if (!fPoll) 950 { 951 rcPsx = ioctl(RTFileToNative(pThis->hDeviceFile), TIOCMIWAIT, uStatusLinesToCheck); 952 if (rcPsx < 0) 953 { 954 LogRel(("Serial#%u: Failed to wait for status line change, switch to polling\n", pDrvIns->iInstance)); 955 fPoll = true; 956 pThis->fStatusLines = statusLines; 957 } 958 } 959 else 960 { 961 /* Poll for status line change. */ 962 if (!((statusLines ^ pThis->fStatusLines) & uStatusLinesToCheck)) 963 PDMR3ThreadSleep(pThread, 500); /* 0.5 sec */ 964 pThis->fStatusLines = statusLines; 965 } 944 966 # else 945 967 /* Poll for status line change. */ … … 948 970 pThis->fStatusLines = statusLines; 949 971 # endif 950 } 951 while (PDMTHREADSTATE_RUNNING == pThread->enmState); 972 } while (PDMTHREADSTATE_RUNNING == pThread->enmState); 952 973 953 974 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.

