none
Checking to see if a virtual com port has been opened by USB RRS feed

  • Question

  • Basically we have an issue right now with one of our ring buffers not being notified that the data its waiting on isn't going to arrive because the physical port has been unplugged. And we want it to back out and die basically.

    What I'm wondering is if there is a way to catch one of the system events that tell the drivers to unload so we don't have to poll for anything.

     Here is the output that is correct. When we disconnect DLServer should shut down, but there is an occasion where its trying to read an asynchronous buffer that is gathering data from the port. The port will crash out but the buffer won't get any data, but we'll still be waiting for data to enter the buffer. We don't want to use a time out, but we do want it to be notified that the com port was canned and the best way I can think of is checking the driver or getting the system event that removes UFN1

    2073948 PID:560012 TID:c70002 [NOTIFY] HandleSystemEvent 7 /REMOVE UFN1:

    2073923 PID:400002 TID:25a0002 cppiChannelAbort: RX Ch 2 (EP 3) not allocated

    2073990 PID:400002 TID:25a0002 -cppiChannelAbort: RX Ch 2 (EP 3)

    2073990 PID:400002 TID:25a0002 +cppiChannelAbort: RX Ch 3 (EP 4)

    2073991 PID:400002 TID:25a0002 cppiChannelAbort: RX Ch 3 (EP 4) not allocated

    2073991 PID:400002 TID:25a0002 -cppiChannelAbort: RX Ch 3 (EP 4)

    2073992 PID:400002 TID:20b001a UsbFnMdd!UfnMdd_Notify: Ignoring notification 0x00000001 - 0x00000000 from PDD

    2074015 PID:400002 TID:25a0002 UsbFnMdd!CPipeBase::Close: Closed pipe (0xd0a698e0): physical address 0, bus address 0x00

    2074015 PID:400002 TID:25a0002 IOCTL_BUS_SET_POWER_STATE:

    2074015 PID:400002 TID:25a0002 IOCTL_BUS_SET_POWER_STATE:

    2074018 PID:2d20006 TID:2d40006 DLSERVER: ERROR: ProcessMsg failed to get command

    2074018 PID:2d20006 TID:2d40006 ERROR: DLServer: Re-initializing links

    2074030 PID:2d20006 TID:2d40006 DLServer: *** Disconnected ***

    2074032 PID:400002 TID:25a0002 COM_Close: (0 handles) total RX 0, total TX 0, dropped (mdd, pdd) 0,0

    2074053 PID:560012 TID:c70002 [NOTIFY] HandleSystemEvent 7 /REMOVE COM4:

    2074095 PID:400002 TID:25a0002 OSAXST1: <<< Unloading Module 'serialusbfn.dll' (0x82D572DC) at address 0xC0A30000-0xC0A4E000 in Process 'NK.EXE' (0x81BBFAA0)

    2074099 PID:400002 TID:25a0002 UsbFnMdd!CUfnBus::CleanUpAfterClient: Deactivated client driver "USB_DirectLink"

    2074112 PID:400002 TID:25a0002 +cppiPoolDeinit

    Monday, September 5, 2011 10:12 PM

All replies

  • Hi,
    For plug/unplug use : RegisterDeviceNotifications()

    "The port will crash out" what does that mean ? is if because your read an invalid handle ?
    "that the com port was canned " what does that mean ? (closed?)

    the software should not crash on the port, catching the exception is not the right way .

    Rob
    www.robtso.nl

     

     

     

    Wednesday, September 7, 2011 7:38 AM
  • This is all on the device side, if I unplug it the com port doesn't even exist any more. So I can use registerdevice even on the device? I didn't even think of it for some odd reason even though we are using it on the PC.
    Wednesday, September 7, 2011 8:54 AM
  • Never tried it client side, but I guess the appearance/disapperance of a comport should be reported as usual...

    Rob
    www.robtso.nl

     

     

    Wednesday, September 7, 2011 9:06 AM
  • Kevin:

    Rob mentioned using RegisterDeviceNotifications which is entirely different from RegisterDevice.  I am assuming that you just didn't type enough, but wanted to make sure that you saw the difference.

    I do have an example of using RegisterDeviceNotifications at http://geekswithblogs.net/BruceEitman/archive/2008/06/13/windows-ce-monitoring-for-disk-insertion-to-add-support-for.aspx which looks for block drivers, but you can modify it to look for notifications from your serial driver by changing the GUID to the GUID associated with your driver's IClass.


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Thursday, September 8, 2011 2:21 PM
    Moderator
  • Actually I know how to use RegisterDevice and RegisterDeviceNotification, it just never occured to us that we could use RegisterDeviceNotification on the device, because its the client side of the usb port and never tried. So right now we are just polling some OpenComPort().. until it opens then start processing messages.


    I don't like the way it was designed especially since its running into timing problems where the PC side starts sending messages before the com port is even opened.

    Thursday, September 8, 2011 9:45 PM