VirtualBox

Ignore:
Timestamp:
Sep 24, 2018 4:05:11 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
125293
Message:

Devices/Serial: Add callback to flush receive/transmit queues of the underlying driver when the serial device flushes the internal queues to stay in sync. Should fix hanging serial I/O under certain circumstances (Debugging a Windows 7 guest over a serial port attached to a named pipe for example)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp

    r73766 r74446  
    355355
    356356    return RTSerialPortQueryStatusLines(pThis->hSerialPort, pfStsLines);
     357}
     358
     359
     360/**
     361 * @callback_method_impl{PDMISERIALCONNECTOR,pfnQueuesFlush}
     362 */
     363static DECLCALLBACK(int) drvHostSerialQueuesFlush(PPDMISERIALCONNECTOR pInterface, bool fQueueRecv, bool fQueueXmit)
     364{
     365    RT_NOREF(fQueueXmit);
     366    LogFlowFunc(("pInterface=%#p fQueueRecv=%RTbool fQueueXmit=%RTbool\n", pInterface, fQueueRecv, fQueueXmit));
     367    int rc = VINF_SUCCESS;
     368    PDRVHOSTSERIAL pThis = RT_FROM_MEMBER(pInterface, DRVHOSTSERIAL, ISerialConnector);
     369
     370    if (fQueueRecv)
     371    {       
     372        size_t cbOld = 0;
     373        ASMAtomicXchgSizeCorrect(&pThis->cbReadBuf, 0, &cbOld);
     374        if (cbOld) /* Kick the I/O thread to fetch new data. */
     375            rc = RTSerialPortEvtPollInterrupt(pThis->hSerialPort);
     376    }
     377
     378    LogFlowFunc(("-> %Rrc\n", rc));
     379    return VINF_SUCCESS;
    357380}
    358381
     
    582605    pThis->ISerialConnector.pfnChgBrk            = drvHostSerialChgBrk;
    583606    pThis->ISerialConnector.pfnQueryStsLines     = drvHostSerialQueryStsLines;
     607    pThis->ISerialConnector.pfnQueuesFlush       = drvHostSerialQueuesFlush;
    584608
    585609    /*
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette