Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Accessing HID attributes from user mode

0 views
Skip to first unread message

Kurt Fankhauser

unread,
May 7, 2002, 5:11:36 PM5/7/02
to
I am trying to access the Vendor ID (VID) of the USB HID devices currently
attached to the computer. Under Windows 98 I use the HID GUID and calls
to SetupDiGetClassDevs(), SetupDiEnumDeviceInterfaces() and
SetupDiGetDeviceInterfaceDetail() to obtain a device path. Calling
CreateFile() with the device path returns a handle to the device which can
then be used to call HidD_GetAttributes() which returns the VID and PID of
the device.

This techinique does not work with Windows 2000 as the CreateFile()
function fails with an error code of "Access Denied". I believe this is
because the OS opens the keyboard and mouse devices with exclusive access.

Is there an alternate way to obtain the VIDs of the current HID devices?

Doron Holan [MS]

unread,
May 7, 2002, 6:59:09 PM5/7/02
to
if you open the file without asking for read access, the create should
succeed and you should be able to use HidD_GetAttributes on either the
keyboard or mouse.

--
d

This posting is provided "AS IS" with no warranties, and confers no rights.
"Kurt Fankhauser" <kf...@shell.pacifier.com> wrote in message
news:udggo8g...@corp.supernews.com...

Adrian Taylor

unread,
May 12, 2002, 6:56:09 PM5/12/02
to
Fantastic! This is just what I needed to do to get a user-mode application
to use a GetFeature/SetFeature interface to my Windows2000 HID minidriver.

I had previously been trying to use the recommended way of creating a 2nd
top-level collection to do this. However, after a fortnight of banging my
head against a brick wall I found that the HIDClass parser does not allow 2
top-level collections in a single report descriptor, and that there is no
way of getting the HIDClass driver to accept 2 different report descriptors
(if this is even a viable alternative anyway).

My only question is : Is this solution a loop-hole that is likely to be sewn
up in a future service pack or OS update, or is it an entirely valid
approach that will stand forever?

Adrian.

"Doron Holan [MS]" <dor...@online.microsoft.com> wrote in message
news:3cd85c3d$1...@news.microsoft.com...


> if you open the file without asking for read access, the create should
> succeed and you should be able to use HidD_GetAttributes on either the
> keyboard or mouse.
>
> --
> d


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.303 / Virus Database: 164 - Release Date: 24/11/2001

Eliyas Yakub

unread,
May 13, 2002, 11:20:52 AM5/13/02
to
>I found that the HIDClass parser does not allow 2 top-level collections in
a single report descriptor

I don't think this is true. In the sample I sent you, look at the commented
report desc in the header file. That has both mouse report and a generic hid
report. Try using that. I'm sure it works because Kumar was doing the
initial testing with that.

-Eliyas


"Adrian Taylor" <adr...@not.here> wrote in message
news:abn39f$8ak$1...@news8.svr.pol.co.uk...

Adrian Taylor

unread,
May 13, 2002, 5:02:10 PM5/13/02
to
I actually cut-and-pasted that commented-out report descriptor into my
mini-driver just to make sure : but the driver still got removed straight
away after returning it. I was half expecting it as I had tried this method
every-which-way before, but I thought your one might have just the right
settings or something. As a double check I removed the last part of the
descriptor (the 2nd top-level collection) and it was fine again.

What OS / service pack did you have it running on?

Adrian.

"Eliyas Yakub" <eli...@microsoft.com> wrote in message
news:oRQD8.30407$Po6....@rwcrnsc52.ops.asp.att.net...


> >I found that the HIDClass parser does not allow 2 top-level collections
in
> a single report descriptor
>
> I don't think this is true. In the sample I sent you, look at the
commented
> report desc in the header file. That has both mouse report and a generic
hid
> report. Try using that. I'm sure it works because Kumar was doing the
> initial testing with that.
>
> -Eliyas

0 new messages