> firstly, wouldn’t it be possible to have some other driver just “create” a PNP surprise removal IRP and pass it in to my driver, thereby “simulating” a real PNP surprise-removal?
No.
You cannot just send pnp state changing irps to a device. Only the pnp manager can send pnp state changing irps b/c only it has the lock to guarantee serialization of those requests.
And secondly, what happens if I just “surprise-remove” some other non-USB piece of hardware, like let’s say I suddenly unplugged a DMA-capable card from my PCI bus backplane, what kinds of events/activity would I expect my driver to see in that case?
The bus you yank your card from must support surprise removal. IIRC, PCI by itself does not support surprise removal, you need to have either an express card or a special chassis.
I really don’t see why surprise removal is really that important that the driver sees it, but if you insist on it, create a root enumerated bus driver (use the KMDF toaster bus sample,statbus or dynambus) and then enumerate a PDO for your virtual usb device. You can fake all the URB processing you want in the PDO and when you want it to disappear, you just report the PDO as missing and the child stack gets surprise removed.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@advancedbionics.com
Sent: Monday, November 29, 2010 12:26 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Virtual PNP Device
Doron Holan wrote:
–> A root enumerated device is what you want, although root enumerated
–> devices
cannot be surprise removed. Is the driver you are loading expecting to talk to a usb device? Or is usb just an example?
Yes, thank you Doron. The driver I have is expecting to talk to a USB device. The device that it was written for is fairly complex, but I only really need a tiny part of its functionality, and the part that I need does not require an actual physical device (the information could live in a set of registry entries, or anywhere else), except that there is some pretty intricate logic that apparently is designed to ensure a synchronous series of events during PNP events like surprise-removal.
When you say that “root enumerated devices can not be surprise-removed”, what exactly do you mean? Let me amplify that question two different ways: firstly, wouldn’t it be possible to have some other driver just “create” a PNP surprise removal IRP and pass it in to my driver, thereby “simulating” a real PNP surprise-removal? And secondly, what happens if I just “surprise-remove” some other non-USB piece of hardware, like let’s say I suddenly unplugged a DMA-capable card from my PCI bus backplane, what kinds of events/activity would I expect my driver to see in that case?
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