Thanks a lot for your comments.
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”>Why
are you trying to do this? What problem are you really trying
to solve?
The customer’s app may instruct the device to restart its firmware. The
host sees this as a USB unplug/plug in.
The app was originally written for RS232 (hence the usb-2-serial
driver) and, unfortunately, modifying the app or the firmware is not an
option.
As a solution, I need to keep the COM file handle alive across USB
unplug/plugin.
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”> color=“#000000”>
To accomplish this, I am going to create a ROOT enumerated device which
will become a parent of COM children.
When a USB dev is plugged in, a new COM child will be enumerated.
When a USB dev is plugged out:
- no COM file handle ==> the COM child is removed
- there is a COM file handle ==> the COM child will fail all
subsequent read/write/ioctl style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”> color=“#000000”>with IoStatus.Status = STATUS_DEVICE_NOT_CONNECTED.
- COM file handle is closed while USB dev is unplugged ==> the
COM child is removed
When the USB dev is plugged in while COM file handle is open, I’ll
check USB instance id (hwid +
physical location), if it’s the same, I’ll revive the COM file handle.
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”>>
Are you going to create a handle for nonexistent hardware before
it is every plugged in?
no
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”><o:p></o:p>
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”>>
For how long are you going to create handles after the hardware
is gone?
after the HW is gone, the file handle will remain
alive until its closed by the app.
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”><o:p></o:p>
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”>>
What are you going to do with i/o and IOCTls that expect strict
timing and actual hw response?
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”> color=“#000000”>All HW related IOCTL’s and Read/Write will fail with
IoStatus.Status = STATUS_DEVICE_NOT_CONNECTED
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”>>
In the COM port case, I don’t see how this
could ever work while the app has the Com port open and expects it to
keep on
functioning.<o:p></o:p>
Since style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”>the
app instructs the device to restart the firmware, it cannot expect that
the device will be functional immediately after that.
Thanks,
Alexey.
Doron Holan wrote:
cite="xxxxx@WIN-MSG-21.wingroup.windeploy.ntdev.microsoft.com"
type=“cite”>
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”>Why
are you trying to do this? What problem are you really trying
to solve? With a solution like this hwere you split the handle away
from the lifetime
of the hardware, you also have to consider the following:<o:p></o:p>
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”><o:p> </o:p>
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”>Are
you going to create a handle for nonexistent hardware before
it is every plugged in?<o:p></o:p>
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”>For
how long are you going to create handles after the hardware
is gone?<o:p></o:p>
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”>What
are you going to do with i/o and IOCTls that expect strict
timing and actual hw response? In the COM port case, I don’t see how
this
could ever work while the app has the Com port open and expects it to
keep on
functioning.<o:p></o:p>
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”><o:p> </o:p>
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”>As
for how to enumerate the 2nd stack,
IoReportDetectedDevice is not a supported enumeration method in a KMDF
driver.
You would have to install a root enumerated bus driver (like toaster’s
busenum)
and communicate with the bus driver to tell it to enumerate you “fake”
device
which is not tied to the real presence of hw.<o:p></o:p>
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”><o:p> </o:p>
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”>d<o:p></o:p>
style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(192, 0, 0);”><o:p> </o:p>
style=“border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;”>
style=“font-size: 10pt; font-family: “Tahoma”,“sans-serif”; color: windowtext;”>From: style=“font-size: 10pt; font-family: “Tahoma”,“sans-serif”; color: windowtext;”>
xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]
On Behalf Of Alexey Polonsky
Sent: Monday, May 21, 2007 2:46 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Resume virtual COM port after USB
unplug/plugin<o:p></o:p>
<o:p> </o:p>
This should do the job.
Thanks a lot !
Maxim S. Shatskih wrote: <o:p></o:p>
I am looking for a solution that would allow the USB pdo to be properly<o:p></o:p>
removed, while virtual COM pdo is kept perfectly alive as long as the<o:p></o:p>
<o:p></o:p>
<o:p> </o:p>
It must be a PDO independent of USB stack PnP-wise, use IoReportDetectedDevice<o:p></o:p>
to plant a parent of the new PnP tree, and then create children for it.<o:p></o:p>
<o:p> </o:p>
The only relation between these COM ports and the USB driver should be via PnP<o:p></o:p>
device interfaces, not the PnP tree parent-child relation.<o:p></o:p>
<o:p> </o:p>
<o:p></o:p>
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer <o:p></o:p>
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer