About automatic bus enumeration ?

Hi, everyone

i’m writing a virtual bus and virtual device, and the virtual device should be enumerated by the virtual bus, how can let the virtual bus enumerate the virtual device automatically, i mean, no user level action.

i known MS DDK sample ‘toaster’ is a virtual bus and it can can create a virtual device PDO and load virtual device’s driver. but it need user interaction by sending a IoCtrl IRP to the bus driver from an application, and is not desirable for me.

I have searched the list server and found a few people have asked the question, but i don’t think the answers satisfy me. so i hope someone can give me a detailed answer.

thanks for your attention

WeiYu, Dong


(resending due to being rejected for an attachment, let’s see if this
goes through this time)

In the toaster example, the busenum.sys driver is the one that
enumerates PDOs. Toaster.sys loads on top of these PDOs. Like you
said, busenum.sys enumerates PDOs based on an IOCTL sent to it. If you
want to automatically enumerate PDOs, just do the same work as you would
in the IOCTL processing in AddDevice or IRP_MN_START_DEVICE.

Now the question becomes, what do you enumerate? Well, there are 2 (and
a half) answers to that. The first is that the list of PDOs is
hardcoded, you just know ahead of time. The 2nd is that you read the
list from somewhere, most likely the devnode. This way you have a
flexible list of what you enumerate, but the list has to be rich enough
to describe the details of each PDO (hardware IDs, compat IDs, instance
ID, etc etc). The last half answer is that you can use both at the
same, both a fixed and dynamic list.