UpperFilters for a specific device class

Hello there,

How can I set an upper filter for a “specific” device class (f.ex. an USB device) instead of a “general” class (f.ex. Universal Serial Bus Controller)?

In other words, can I put an “UpperFilter” registry value under the “DeviceClasses” registry key?
I tried it but my AddDevice funcion was not called for a USB device insertion. If I put the UpperFilter value under the “Universal Serial Bus controller” then I do get the AddDevice call, but I guess it would be for every USB thing (host controller, usb hub, etc).

TIA

What are you trying to do exactly?

-scott


Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com

wrote in message news:xxxxx@ntdev…
> Hello there,
>
> How can I set an upper filter for a “specific” device class (f.ex. an USB
> device) instead of a “general” class (f.ex. Universal Serial Bus
> Controller)?
>
> In other words, can I put an “UpperFilter” registry value under the
> “DeviceClasses” registry key?
> I tried it but my AddDevice funcion was not called for a USB device
> insertion. If I put the UpperFilter value under the “Universal Serial Bus
> controller” then I do get the AddDevice call, but I guess it would be for
> every USB thing (host controller, usb hub, etc).
>
> TIA
>

Hi Scott,

I would like to put an upper filter for a “device interface”, not for a “device class”, so that I can (for example) distinguish between a USB hub and a USB flash drive.

Is it possible?

TIA

The closest thing you could do would be to register a class filter for every device class that might expose the interface that you want and in your AddDevice routine you check the HWID to see if it’s interesting and if not don’t add a device-object to the stack (but still return STATUS_SUCCESS).

You just can’t talk to the device during AddDevice, so if you can’t figure out whether the device is interesting from its PNP properties then this won’t help much.

What are you trying to filter?

-p

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.es
Sent: Sunday, March 21, 2010 9:51 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] UpperFilters for a specific device class

Hi Scott,

I would like to put an upper filter for a “device interface”, not for a “device class”, so that I can (for example) distinguish between a USB hub and a USB flash drive.

Is it possible?

TIA


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

You wrote:

I would like to put an upper filter for a “device interface”, not for a
“device class”, so that I can (for example) distinguish between a USB
hub and a USB flash drive.

Is it possible?

Not as you have described it. By default, USB mass storage drives appear in Class=USB exactly like a USB hub. The usbstor driver then creates a storage-class device on top.

You can, of course, have your filter read the descriptors and try to discern the type of device from that.

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

Hi Harvey,

You can check “addfilter” sample in DDK directory. It is a good example to show how to set a upper filter on the specific device.

Fan

Thanks to everyone for your responses,

What I’m trying to do is to detect the insertion of every USB device (whatever type), and then try to determine its type (f.e. joystick, headphones, flash drives) and then add my device object depending on type.

So I guess that Peter’s post is the best option for me, isn’t it?

Thanks a lot!

BTW, about querying the device info (hardware IDs, device type, and so on) is it safe to do it during the AddDevice phase?

Thanks.

Yes it is safe, I’ve been doing it for years.

Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: xxxxx@yahoo.es [mailto:xxxxx@yahoo.es]
Posted At: Monday, March 22, 2010 4:25 PM
Posted To: ntdev
Conversation: UpperFilters for a specific device class
Subject: RE: UpperFilters for a specific device class

BTW, about querying the device info (hardware IDs, device type, and so
on) is
it safe to do it during the AddDevice phase?

Thanks.

__________ Information from ESET Smart Security, version of virus
signature
database 4966 (20100322) __________

The message was checked by ESET Smart Security.

http://www.eset.com

Depends on what you need to query for. Querying HW IDs is safe (anything via IoGetDeviceProperty really). Device Type (if by this you mean the DeviceType field in the PDEVICE_OBJECT) is meaningless for your purposes. Talking to the hw (via URBs, direct HW access, whatever) is not safe in AddDevice

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.es
Sent: Monday, March 22, 2010 1:25 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] UpperFilters for a specific device class

BTW, about querying the device info (hardware IDs, device type, and so on) is it safe to do it during the AddDevice phase?

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

Ok, will try, thanks a lot for the info!

> BTW, about querying the device info (hardware IDs, device type, and so on) is it safe to do it during

the AddDevice phase?

IoGetDeviceProperty? yes


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com