Regard a USB virtual COM as a real physical COM

My USB device is a virtual COM. when the virtual COM is opened by an application, I remove USB device from a USB port(The application does not close the virtual COM).
At the same time, I insert USB device into the same USB port again.

I hope the application can continue to read and write data through the opened virtual COM. In other words, It seems that the USB virtual COM can work as a real physical COM.

How can I modify my WDM driver code to realize the function?
can anybody help me?

thanks a lot

If you get this to work (there are convoluted ways to do this) what are you going to do when the app sends a read or write when the com port is disconnected? The app might have timing requirements that you cannot satisfy

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Sunday, March 22, 2009 9:52 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Regard a USB virtual COM as a real physical COM

My USB device is a virtual COM. when the virtual COM is opened by an application, I remove USB device from a USB port(The application does not close the virtual COM).
At the same time, I insert USB device into the same USB port again.

I hope the application can continue to read and write data through the opened virtual COM. In other words, It seems that the USB virtual COM can work as a real physical COM.

How can I modify my WDM driver code to realize the function?
can anybody help me?

thanks a lot


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

thanks Doron Holan,

I know app has timing requirements.
The app is a special one and it just work with my USB driver together.
For some reason, the app will send an instruction to reset my USB device.
During the time, the app will wait for several minutes until my USB device restore to work again.
So, What I need to do is just to realize the funtion.

thanks!

If you control the app, why not have the app register for file handle notifications and have it gracefully close the handle when the device goes away. It can listen for device interface state arrivals to know when the device comes back. Are you going to track state in the driver to know what to reset the driver to? keep the driver as simple as possible. By far the easiest solution on *both* sides is to make the app aware of when the devices goes away. Also, fix your device not to have the device reset based off of input from the app (unless that is by design)

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Sunday, March 22, 2009 11:02 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Regard a USB virtual COM as a real physical COM

thanks Doron Holan,

I know app has timing requirements.
The app is a special one and it just work with my USB driver together.
For some reason, the app will send an instruction to reset my USB device.
During the time, the app will wait for several minutes until my USB device restore to work again.
So, What I need to do is just to realize the funtion.

thanks!


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

There are some comments:

  1. The app is designed by other company and we only get their exe file without source code.
  2. My USB device is a CDMA phone and it must reset while receiving some special AT commands according to CDMA specification.

So, What I can do is just modify my WDM driver code to work together with the third-party app.

thanks a lot

Have you contacted the other company to see if they can change their app? How do you knoe that you can fake out the app sufficiently when the device is gone such that the app still works?

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Monday, March 23, 2009 12:12 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Regard a USB virtual COM as a real physical COM

There are some comments:

1. The app is designed by other company and we only get their exe file without source code.
2. My USB device is a CDMA phone and it must reset while receiving some special AT commands according to CDMA specification.

So, What I can do is just modify my WDM driver code to work together with the third-party app.

thanks a lot


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

  1. Yeah, we contact the company and they refused to change their app code. Because the drivers of some other companys have already realized the function I mentioned.
  2. The function of the app is to test all kinds of AT commands according CDMA specification.
    When the app send special AT commands which make USB device reset, it will wait for adequate time to make sure that USB device resotre again and can continue to work.

thanks!

yongfan yongfan wrote:

When the app send special AT commands which make USB
device reset, it will wait for adequate time to make sure that
USB device resotre again and can continue to work.

You said this is a CDMA phone … note that Qualcomm, in their infinite wisdom, created an IOCTL called “IOCTL_QCOMSER_WAIT_NOTIFY” which is pended to your driver at the start of a session. When your device disappears, you’re supposed to complete this IOCTL as some sort of kludged form of PNP notification. If you’re using the Qualcomm suite of apps to test your driver in this fashion, you’ll need to implement this IOCTL.

#define QCOMSER_IOCTL_INDEX 2048
#define IOCTL_QCOMSER_WAIT_NOTIFY CTL_CODE(FILE_DEVICE_UNKNOWN, \
QCOMSER_IOCTL_INDEX+1, \
METHOD_BUFFERED, \
FILE_ANY_ACCESS)

Don’t know if this is helpful or not, thought I would mention it, tho…

xxxxx@hotmail.com wrote:

  1. Yeah, we contact the company and they refused to change their app code. Because the drivers of some other companys have already realized the function I mentioned.

Are they actually calling CreateFile on some COM port number, or are
they calling a DLL that you provided? If you have a wrapper DLL, then
you can easily provide this kind of protection in your DLL.

  1. The function of the app is to test all kinds of AT commands according CDMA specification.
    When the app send special AT commands which make USB device reset, it will wait for adequate time to make sure that USB device resotre again and can continue to work.

If they are really opening the driver handle themselves, then it seems
to me the only answer you have is to make sure your device’s reset does
actually cause it to remove itself from the bus.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

thanks Chris Aseltine,
Our CDMA chip is from VIA, so the IOCTL you mentioned is useless.

Anyway, thanks your reply!

>
Are they actually calling CreateFile on some COM port number, or are
they calling a DLL that you provided? If you have a wrapper DLL, then
you can easily provide this kind of protection in your DLL.

yeah, They have called CreateFile on some COM port number.
I don’t offer them a DLL to call. They just open my Virtual COM directly.

If they are really opening the driver handle themselves, then it seems
to me the only answer you have is to make sure your device’s reset does
actually cause it to remove itself from the bus.

How can I remove my device object from driver even if the app opened my Virtual COM?