No announcement yet.

Is serial port in use?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Lance Edmonds
    I gather this question is a result of the other topic where you are having problems monitoring the DSR status in the Modem Status Register of the UART?

    In my tests on Windows 2000, the hardware accessibility layer (HAL) virtualizes the ports so simply testing the state of DSR/CTS/DTR gives you the state that Windows wants your code to see... in the best interests of your PC's security.

    On occasion, the MSR state appears to be the state of the port the last time it was actually opened by a DOS app... I don't believe it is guaranteed to be the <U>actual</U> port state at any given moment (at least for CTS/DSR).

    For example, I can query my external modem's DSR line only after I switch off the Fax service, and only if I actually open the port before prodding as the MSR. Once I open the port at least once, sucessive tests show the same result even if I turn the modem off... but if I open the port, the MSR value returned by Windows will instantly refresh the status accurately.

    However, if I then restart the Fax service and continue running my tests on the MSR status (without actually opening the port in the DOS app), I still see the same states in the MSR registers... even though the port has now been OPEN'ed by the fax monitor service, not my DOS app.

    Summary: It's not possible to get 100% reliable results from a DOS app under Windows 2000 by testing the [virtualized] modem status register. The same should apply equally to NT and XP since they employ the same HAL control.

    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:

  • Clay Clear
    started a topic Is serial port in use?

    Is serial port in use?

    Is there any way to have a PB/DOS 3.5 program determine if a serial
    port is already in use so it does not use it? I need to know this
    because I am writing an ANSI terminal program for my own use so
    I can remotely logon to my own 16-bit BBS in order to test
    BBS doors/utilities that I write. Therefore, the BBS remote node
    that is currently up will be using one serial port for itself.
    So, my program needs to be able to detect that so it can move on
    to the next serial port or end with an error message.

    Thanks for any replies.

    Clay C. Clear
    mailto:[email protected][email protected]</A>