How to find if an USB device is attached to OHCI HC?

I’d like to enable specific workaround in my USB driver if our device is attached to OHCI HC only. It is only for Vista and I already use USB_BUS_INTERFACE_USBDI_V3 to get pointer to function QueryControllerType(). I use it to find if the device is attached to VIA HC which needs another workaround.

HcdiOptionFlags parameter seems promising but returned flags aren’t defined in WDK headers. Quick experiment shows flags 0xd at OHCI HC (NVIDIA) and 0x2c3 at UHCI HC (VIA). Anybody knows what these flags mean and if ti is possible to distinguish OHCI and UHCI this way?

Thanks.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

One way would be to query the compatible IDs of the HC and search them. UHCIs will contain PCI\CC_030C00, while OHCIs will contain PCI\CC_030C10. No device should ever have both of these strings in its compatible IDs list.

Yes, this is somewhat implementation-dependent; it assumes a specific structure for the compatible IDs. However, this hasn’t changed for a long time, isn’t likely to change, and at least you’re comparing, not parsing, PNP IDs.

This will let you identify all OHCI and UHCI implementations. If you want to enable work-arounds for specific implementations, you can search for the vendor/pid version, e.g. PCI\VEN_xxxx&CC_030C10. Again, I share the general reluctance to parse PNP IDs, but I consider comparing to be much more acceptable.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Friday, January 12, 2007 8:49 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to find if an USB device is attached to OHCI HC?

I’d like to enable specific workaround in my USB driver if our device is attached to OHCI HC only. It is only for Vista and I already use USB_BUS_INTERFACE_USBDI_V3 to get pointer to function QueryControllerType(). I use it to find if the device is attached to VIA HC which needs another workaround.

HcdiOptionFlags parameter seems promising but returned flags aren’t defined in WDK headers. Quick experiment shows flags 0xd at OHCI HC (NVIDIA) and 0x2c3 at UHCI HC (VIA). Anybody knows what these flags mean and if ti is possible to distinguish OHCI and UHCI this way?

Thanks.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


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

Thanks. I presume there is no way how to get compatible IDs in kernel. We’d prefer kernel mode only solution because it is much easier to make change in the driver than in all user mode software packages we have. Driver coninstaller could solve it but… no way. (I’d have to write it :slight_smile:

However, it seems as this info can be decoded as PCI class, subclass and prog interface (CC_ccssii) which QueryControllerType() function returns. I quickly tested it at OHCI and UHCI adapter and it returns what you wrote. The difference is PciProgIf parameter. At UHCI it is 0 and at OHCI 0x10 (PciClass == 0xc and PciSubClass == 0x3 at both; PciRevisionIds differ).

Looks like simpler and better way than to compare or even parse IDs. Do you think it is correct and reliable?

BTW, I already use this function to get VID and PID to enable implementation specific workaround (for VIA).

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Arlie Davis[SMTP:xxxxx@microsoft.com]
Reply To: Windows System Software Devs Interest List
Sent: Tuesday, January 16, 2007 12:43 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to find if an USB device is attached to OHCI HC?

One way would be to query the compatible IDs of the HC and search them. UHCIs will contain PCI\CC_030C00, while OHCIs will contain PCI\CC_030C10. No device should ever have both of these strings in its compatible IDs list.

Yes, this is somewhat implementation-dependent; it assumes a specific structure for the compatible IDs. However, this hasn’t changed for a long time, isn’t likely to change, and at least you’re comparing, not parsing, PNP IDs.

This will let you identify all OHCI and UHCI implementations. If you want to enable work-arounds for specific implementations, you can search for the vendor/pid version, e.g. PCI\VEN_xxxx&CC_030C10. Again, I share the general reluctance to parse PNP IDs, but I consider comparing to be much more acceptable.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Friday, January 12, 2007 8:49 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to find if an USB device is attached to OHCI HC?

I’d like to enable specific workaround in my USB driver if our device is attached to OHCI HC only. It is only for Vista and I already use USB_BUS_INTERFACE_USBDI_V3 to get pointer to function QueryControllerType(). I use it to find if the device is attached to VIA HC which needs another workaround.

HcdiOptionFlags parameter seems promising but returned flags aren’t defined in WDK headers. Quick experiment shows flags 0xd at OHCI HC (NVIDIA) and 0x2c3 at UHCI HC (VIA). Anybody knows what these flags mean and if ti is possible to distinguish OHCI and UHCI this way?

Thanks.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


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


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

Yes, that’s right. As you’ve noticed, for the documented / public USB HCIs, the class is 0x03, subclass 0x0c, and the “interface” value identifies the particular HCI spec. UHCI is 0x00, OHCI is 0x10, and EHCI is 0x20.

I believe you can query IDs from a device in kernel mode. Use IRP_MJ_PNP / IRP_MN_QUERY_ID, with Parameters.QueryId.IdType set to BusQueryCompatibleIDs. Of course, you must target the HC device stack, not a USB device / port attached to it.

I guess both approaches get the same job done, in basically the same way. Your approach is probably a bit less code than the string ops.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Monday, January 15, 2007 4:34 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to find if an USB device is attached to OHCI HC?

Thanks. I presume there is no way how to get compatible IDs in kernel. We’d prefer kernel mode only solution because it is much easier to make change in the driver than in all user mode software packages we have. Driver coninstaller could solve it but… no way. (I’d have to write it :slight_smile:

However, it seems as this info can be decoded as PCI class, subclass and prog interface (CC_ccssii) which QueryControllerType() function returns. I quickly tested it at OHCI and UHCI adapter and it returns what you wrote. The difference is PciProgIf parameter. At UHCI it is 0 and at OHCI 0x10 (PciClass == 0xc and PciSubClass == 0x3 at both; PciRevisionIds differ).

Looks like simpler and better way than to compare or even parse IDs. Do you think it is correct and reliable?

BTW, I already use this function to get VID and PID to enable implementation specific workaround (for VIA).

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Arlie Davis[SMTP:xxxxx@microsoft.com]
Reply To: Windows System Software Devs Interest List
Sent: Tuesday, January 16, 2007 12:43 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to find if an USB device is attached to OHCI HC?

One way would be to query the compatible IDs of the HC and search them. UHCIs will contain PCI\CC_030C00, while OHCIs will contain PCI\CC_030C10. No device should ever have both of these strings in its compatible IDs list.

Yes, this is somewhat implementation-dependent; it assumes a specific structure for the compatible IDs. However, this hasn’t changed for a long time, isn’t likely to change, and at least you’re comparing, not parsing, PNP IDs.

This will let you identify all OHCI and UHCI implementations. If you want to enable work-arounds for specific implementations, you can search for the vendor/pid version, e.g. PCI\VEN_xxxx&CC_030C10. Again, I share the general reluctance to parse PNP IDs, but I consider comparing to be much more acceptable.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Friday, January 12, 2007 8:49 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to find if an USB device is attached to OHCI HC?

I’d like to enable specific workaround in my USB driver if our device is attached to OHCI HC only. It is only for Vista and I already use USB_BUS_INTERFACE_USBDI_V3 to get pointer to function QueryControllerType(). I use it to find if the device is attached to VIA HC which needs another workaround.

HcdiOptionFlags parameter seems promising but returned flags aren’t defined in WDK headers. Quick experiment shows flags 0xd at OHCI HC (NVIDIA) and 0x2c3 at UHCI HC (VIA). Anybody knows what these flags mean and if ti is possible to distinguish OHCI and UHCI this way?

Thanks.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


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


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


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

Great, thanks. I prefer my approach mainly because have the necessary code already written and checking interface value is just one more line of code :slight_smile:

However, it works only at Vista so if I ever need it at older OS version, I’d try to query for IDs. Hopefully it won’t be necessary; instead of Vista, USB is relatively functional there and doesn’t need such crazy workarounds.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Arlie Davis[SMTP:xxxxx@microsoft.com]
Reply To: Windows System Software Devs Interest List
Sent: Tuesday, January 16, 2007 2:07 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to find if an USB device is attached to OHCI HC?

Yes, that’s right. As you’ve noticed, for the documented / public USB HCIs, the class is 0x03, subclass 0x0c, and the “interface” value identifies the particular HCI spec. UHCI is 0x00, OHCI is 0x10, and EHCI is 0x20.

I believe you can query IDs from a device in kernel mode. Use IRP_MJ_PNP / IRP_MN_QUERY_ID, with Parameters.QueryId.IdType set to BusQueryCompatibleIDs. Of course, you must target the HC device stack, not a USB device / port attached to it.

I guess both approaches get the same job done, in basically the same way. Your approach is probably a bit less code than the string ops.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
Sent: Monday, January 15, 2007 4:34 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to find if an USB device is attached to OHCI HC?

Thanks. I presume there is no way how to get compatible IDs in kernel. We’d prefer kernel mode only solution because it is much easier to make change in the driver than in all user mode software packages we have. Driver coninstaller could solve it but… no way. (I’d have to write it :slight_smile:

However, it seems as this info can be decoded as PCI class, subclass and prog interface (CC_ccssii) which QueryControllerType() function returns. I quickly tested it at OHCI and UHCI adapter and it returns what you wrote. The difference is PciProgIf parameter. At UHCI it is 0 and at OHCI 0x10 (PciClass == 0xc and PciSubClass == 0x3 at both; PciRevisionIds differ).

Looks like simpler and better way than to compare or even parse IDs. Do you think it is correct and reliable?

BTW, I already use this function to get VID and PID to enable implementation specific workaround (for VIA).

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

> ----------
> From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Arlie Davis[SMTP:xxxxx@microsoft.com]
> Reply To: Windows System Software Devs Interest List
> Sent: Tuesday, January 16, 2007 12:43 AM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] How to find if an USB device is attached to OHCI HC?
>
> One way would be to query the compatible IDs of the HC and search them. UHCIs will contain PCI\CC_030C00, while OHCIs will contain PCI\CC_030C10. No device should ever have both of these strings in its compatible IDs list.
>
> Yes, this is somewhat implementation-dependent; it assumes a specific structure for the compatible IDs. However, this hasn’t changed for a long time, isn’t likely to change, and at least you’re comparing, not parsing, PNP IDs.
>
> This will let you identify all OHCI and UHCI implementations. If you want to enable work-arounds for specific implementations, you can search for the vendor/pid version, e.g. PCI\VEN_xxxx&CC_030C10. Again, I share the general reluctance to parse PNP IDs, but I consider comparing to be much more acceptable.>
>
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Michal Vodicka
> Sent: Friday, January 12, 2007 8:49 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] How to find if an USB device is attached to OHCI HC?
>
> I’d like to enable specific workaround in my USB driver if our device is attached to OHCI HC only. It is only for Vista and I already use USB_BUS_INTERFACE_USBDI_V3 to get pointer to function QueryControllerType(). I use it to find if the device is attached to VIA HC which needs another workaround.
>
> HcdiOptionFlags parameter seems promising but returned flags aren’t defined in WDK headers. Quick experiment shows flags 0xd at OHCI HC (NVIDIA) and 0x2c3 at UHCI HC (VIA). Anybody knows what these flags mean and if ti is possible to distinguish OHCI and UHCI this way?
>
> Thanks.
>
> Best regards,
>
> Michal Vodicka
> UPEK, Inc.
> [xxxxx@upek.com, http://www.upek.com]
>
>
> —
> 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
>
> —
> 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
>


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


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