Hi,
I have a device that has either a SCSI or USB interface. When my
AddDevice dispatch function is called I want to determine the type of
bus that the device is connected to.
One way I have used is to look at the DeviceObject name:
PhysicalDeviceObject->DriverObject->DriverName
This could be “\Driver\Usbhub” or “\Driver\Usbstor” or
“\Driver\Usbhub20” or “\Driver\Usbhub3”. This does not appear to be a
very good way to determine the bus type, for example I now see
“\Driver\nusb3hub”. Presumably there could be a number of other names
for USB hubs that my device is connected to.
So, what is the best way to determine if the PDO represents USB?
Thanks,
Hayden
,
Query for the hardware IDs property and see if the HW ID starts with “USB”
d
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Hayden Smith
Sent: Wednesday, March 5, 2014 4:30 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Determining Physical Device Object is USB
Hi,
I have a device that has either a SCSI or USB interface. When my AddDevice dispatch function is called I want to determine the type of bus that the device is connected to.
One way I have used is to look at the DeviceObject name:
PhysicalDeviceObject->DriverObject->DriverName
This could be “\Driver\Usbhub” or “\Driver\Usbstor” or “\Driver\Usbhub20” or “\Driver\Usbhub3”. This does not appear to be a very good way to determine the bus type, for example I now see “\Driver\nusb3hub”. Presumably there could be a number of other names for USB hubs that my device is connected to.
So, what is the best way to determine if the PDO represents USB?
Thanks,
Hayden
,
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
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
Sorry, but is there a WDK function for doing that?
For WDF use WdfDeviceQueryProperty and for WDM use IoGetDeviceProperty. Supply DevicePropertyHardwareID for the DEVICE_REGISTRY_PROPERTY argument.
IoGetDeviceProperty, WdfDeviceQueryProperty // WdfDeviceAllocAndQueryProperty in KMDF after you created the WDFDEVICE, WdfFdoInitAllocAndQueryProperty // WdfFdoInitQueryProperty if you haven’t created the WDFDEVICE yet
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@lasercard.com
Sent: Wednesday, March 5, 2014 4:45 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Determining Physical Device Object is USB
Sorry, but is there a WDK function for doing that?
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
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
Great, I will go try that immediately. If the rule is that the HW ID will always begin with “USB” then this will work perfectly.
Thank you for your immediate responses!
H
xxxxx@lasercard.com wrote:
Great, I will go try that immediately. If the rule is that the HW ID will always begin with “USB” then this will work perfectly.
You specified the hardware IDs you were willing to drive when you wrote
your INF file. You’re always going to get one of those.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Actually it is simpler to get the *DevicePropertyEnumeratorName as it* is
exactly what you want. IoGetDeviceProperty for WDM drivers.
Mark Roddy
On Wed, Mar 5, 2014 at 7:36 PM, Doron Holan wrote:
> Query for the hardware IDs property and see if the HW ID starts with
> “USB”
>
>
>
> d
>
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] *On Behalf Of *Hayden Smith
> Sent: Wednesday, March 5, 2014 4:30 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Determining Physical Device Object is USB
>
>
>
> Hi,
>
>
>
> I have a device that has either a SCSI or USB interface. When my
> AddDevice dispatch function is called I want to determine the type of bus
> that the device is connected to.
>
> One way I have used is to look at the DeviceObject name:
>
> PhysicalDeviceObject->DriverObject->DriverName
>
> This could be “\Driver\Usbhub” or “\Driver\Usbstor” or “\Driver\Usbhub20”
> or “\Driver\Usbhub3”. This does not appear to be a very good way to
> determine the bus type, for example I now see “\Driver\nusb3hub”.
> Presumably there could be a number of other names for USB hubs that my
> device is connected to.
>
> So, what is the best way to determine if the PDO represents USB?
>
>
>
> Thanks,
>
> Hayden
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ,
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>
You are absolutely right. And perform a case insensitive compare
d
Bent from my phone
From: Mark Roddymailto:xxxxx
Sent: ?3/?5/?2014 8:18 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: Re: [ntdev] Determining Physical Device Object is USB
Actually it is simpler to get the DevicePropertyEnumeratorName as it is exactly what you want. IoGetDeviceProperty for WDM drivers.
Mark Roddy
On Wed, Mar 5, 2014 at 7:36 PM, Doron Holan > wrote:
Query for the hardware IDs property and see if the HW ID starts with ?USB?
d
From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.commailto:xxxxx] On Behalf Of Hayden Smith
Sent: Wednesday, March 5, 2014 4:30 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Determining Physical Device Object is USB
Hi,
I have a device that has either a SCSI or USB interface. When my AddDevice dispatch function is called I want to determine the type of bus that the device is connected to.
One way I have used is to look at the DeviceObject name:
PhysicalDeviceObject->DriverObject->DriverName
This could be ?\Driver\Usbhub? or ?\Driver\Usbstor? or ?\Driver\Usbhub20? or ?\Driver\Usbhub3?. This does not appear to be a very good way to determine the bus type, for example I now see ?\Driver\nusb3hub?. Presumably there could be a number of other names for USB hubs that my device is connected to.
So, what is the best way to determine if the PDO represents USB?
Thanks,
Hayden
,
—
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
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
—
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
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
— NTDEV is sponsored by OSR Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See http://www.osr.com/careers 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</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>
Try one of the subcodes of IoGetDeviceProperty, like “enumerator name”.
–
Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com
“Hayden Smith” wrote in message news:xxxxx@ntdev…
Hi,
I have a device that has either a SCSI or USB interface. When my AddDevice dispatch function is called I want to determine the type of bus that the device is connected to.
One way I have used is to look at the DeviceObject name:
PhysicalDeviceObject->DriverObject->DriverName
This could be “\Driver\Usbhub” or “\Driver\Usbstor” or “\Driver\Usbhub20” or “\Driver\Usbhub3”. This does not appear to be a very good way to determine the bus type, for example I now see “\Driver\nusb3hub”. Presumably there could be a number of other names for USB hubs that my device is connected to.
So, what is the best way to determine if the PDO represents USB?
Thanks,
Hayden
,