Device Parameters missing from CurrentControlSet/Enum/USB

Hi!

I have a USB 3.0 controller, and I’m writing a bus driver (USB controller + hub) to work with the HW.
I also have a USB test device with a class driver. This driver does not configure the device by default. I can control this with an application.
I made the following observations:

  1. When I plug this device into the controller (no SELECT_CONFIGURATION), there is no Device Parameters key in the registry under CurrentControlSet/Enum/USB/VID_vvvv&PID_pppp/instance.
  2. When I plug it into EHCI with MS driver (no SELECT_CONFIGURATION), the key is present.
  3. When I configure the device (SELECT_CONFIGURATION), the key appears in the registry, and when I plug it out, and then in again (but no config this time), the key is also present. It is present until controller driver reinstallation.
  4. When I plug a real device (e.g. a pendrive) into the controller, the Device Parameters key is present in the registry. That’s ok, and this is what I would expect.

Why is it so? How is the Device Parameters key created? This should be done by the PnP manager, I suppose. Do I have to implement something in the controller driver?

Thanks!

Why does it matter? You don’t open this by path, you call the right Io API to get a handle to this key

d

debt from my phone


From: xxxxx@gmail.com
Sent: 11/30/2011 7:16 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Device Parameters missing from CurrentControlSet/Enum/USB

Hi!

I have a USB 3.0 controller, and I’m writing a bus driver (USB controller + hub) to work with the HW.
I also have a USB test device with a class driver. This driver does not configure the device by default. I can control this with an application.
I made the following observations:

  1. When I plug this device into the controller (no SELECT_CONFIGURATION), there is no Device Parameters key in the registry under CurrentControlSet/Enum/USB/VID_vvvv&PID_pppp/instance.
  2. When I plug it into EHCI with MS driver (no SELECT_CONFIGURATION), the key is present.
  3. When I configure the device (SELECT_CONFIGURATION), the key appears in the registry, and when I plug it out, and then in again (but no config this time), the key is also present. It is present until controller driver reinstallation.
  4. When I plug a real device (e.g. a pendrive) into the controller, the Device Parameters key is present in the registry. That’s ok, and this is what I would expect.

Why is it so? How is the Device Parameters key created? This should be done by the PnP manager, I suppose. Do I have to implement something in the controller driver?

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

I have an application which tries to write a value to Device Parameters. But it can’t, because there is no such key.
It’s confusing to me. Why is this key sometimes present and sometimes it is not?

You wrote that I call an Io API to get a handle to the key. But how can I get the handle when there is no such key?

Thanks!

How is the app attempting to open the HKEY? What api are you using?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, November 30, 2011 12:18 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Device Parameters missing from CurrentControlSet/Enum/USB

I have an application which tries to write a value to Device Parameters. But it can’t, because there is no such key.
It’s confusing to me. Why is this key sometimes present and sometimes it is not?

You wrote that I call an Io API to get a handle to the key. But how can I get the handle when there is no such key?

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

xxxxx@gmail.com wrote:

I have an application which tries to write a value to Device Parameters. But it can’t, because there is no such key. It’s confusing to me. Why is this key sometimes present and sometimes it is not?

If the device hasn’t been instantiated yet, so there have been no
parameters to write, then the key won’t exist. Why should it?

You wrote that I call an Io API to get a handle to the key. But how can I get the handle when there is no such key?

You use SetupDiOpenDevRegKey. If the key does not exist, the API will
create it. This is why we are told to use the documented methods, and
not rely on the implementation details of the registry.


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

Thanks for your answers!
This makes perfect sense - if no one needs the key, it won’t exist.
I checked with Process Monitor what’s happening when I configure the device (because this triggers the creation of the key). There is a RegOpenKey(Device Parameters) called, but returns with NAME NOT FOUND. Immediately after that, the RegCreateKey(Device Parameters) is called, even though the application I use to configure the device does not call directly any of these functions. This happens in the background. It seems that somehow Windows needs access to this key and creates it (and then tries to read a value).
It seems that the other application first checks if the path exists and only then tries to open the key. I will check this and let you know.
Thanks once again!

> It seems that the other application first checks if the path exists and only then tries to open the key

This sounds like a bug to me in the app. The app should never have a hard coded path to the key. They path is not guaranteed to be the same from machine to machine and even OS to OS release. The app should always use the SetupDI functions to get to the key

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Thursday, December 01, 2011 1:25 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Device Parameters missing from CurrentControlSet/Enum/USB

Thanks for your answers!
This makes perfect sense - if no one needs the key, it won’t exist.
I checked with Process Monitor what’s happening when I configure the device (because this triggers the creation of the key). There is a RegOpenKey(Device Parameters) called, but returns with NAME NOT FOUND. Immediately after that, the RegCreateKey(Device Parameters) is called, even though the application I use to configure the device does not call directly any of these functions. This happens in the background. It seems that somehow Windows needs access to this key and creates it (and then tries to read a value).
It seems that the other application first checks if the path exists and only then tries to open the key. I will check this and let you know.
Thanks once again!


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