HidP / HidD APIs in Win DDK

Hi all,

I have been using the HidD/HidP APIs in the Win DDK on Win XP to access USB HID devices from user mode and read reports, etc.

With the new driver framework (WDF?) that was introduced recently and Windows Vista, I’m not sure if this API is going to stay around and if there are any changes I have to be aware of?

Thanks in advance,
Bert.

WDF helps in implementing the driver itself, it plays no role in the
driver’s interfaces/structures/contracts. HID defines an byte format,
WDF does not touch that, so you can easily continue to use HID apis.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@percussa.com
Sent: Friday, September 07, 2007 2:22 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] HidP / HidD APIs in Win DDK

Hi all,

I have been using the HidD/HidP APIs in the Win DDK on Win XP to access
USB HID devices from user mode and read reports, etc.

With the new driver framework (WDF?) that was introduced recently and
Windows Vista, I’m not sure if this API is going to stay around and if
there are any changes I have to be aware of?

Thanks in advance,
Bert.


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

Hi Doron,

Doron Holan wrote:

WDF helps in implementing the driver itself, it plays no role in the
driver’s interfaces/structures/contracts. HID defines an byte format,
WDF does not touch that, so you can easily continue to use HID apis.

Thanks for your response. I understand that WDF helps implementing drivers.

However, I am not writing a driver. I am using the HidD / HidP APIs in
user mode, to communicate with a HID device.

I wanted ot know if :

  1. Microsoft was planning to remove these APIs anytime soon
  2. The APIs also work on Windows Vista

Thanks,
Bert

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@percussa.com
Sent: Friday, September 07, 2007 2:22 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] HidP / HidD APIs in Win DDK

Hi all,

I have been using the HidD/HidP APIs in the Win DDK on Win XP to access
USB HID devices from user mode and read reports, etc.

With the new driver framework (WDF?) that was introduced recently and
Windows Vista, I’m not sure if this API is going to stay around and if
there are any changes I have to be aware of?

Thanks in advance,
Bert.


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


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

  1. if we removed them, we would break a ton of apps
  2. if they didn’t work on vista, we would break a ton of apps

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bert
Schiettecatte
Sent: Friday, September 07, 2007 3:44 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] HidP / HidD APIs in Win DDK

Hi Doron,

Doron Holan wrote:

WDF helps in implementing the driver itself, it plays no role in the
driver’s interfaces/structures/contracts. HID defines an byte format,
WDF does not touch that, so you can easily continue to use HID apis.

Thanks for your response. I understand that WDF helps implementing
drivers.

However, I am not writing a driver. I am using the HidD / HidP APIs in
user mode, to communicate with a HID device.

I wanted ot know if :

  1. Microsoft was planning to remove these APIs anytime soon
  2. The APIs also work on Windows Vista

Thanks,
Bert

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@percussa.com
Sent: Friday, September 07, 2007 2:22 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] HidP / HidD APIs in Win DDK

Hi all,

I have been using the HidD/HidP APIs in the Win DDK on Win XP to
access
USB HID devices from user mode and read reports, etc.

With the new driver framework (WDF?) that was introduced recently and
Windows Vista, I’m not sure if this API is going to stay around and if
there are any changes I have to be aware of?

Thanks in advance,
Bert.


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


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


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

> However, I am not writing a driver. I am using the HidD / HidP APIs in

user mode, to communicate with a HID device.

Then this is irrelevant for you whether the driver below you is KMDF or not.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Hi Doron,

Doron Holan wrote:

  1. if we removed them, we would break a ton of apps
  2. if they didn’t work on vista, we would break a ton of apps

thanks a lot for clearing that up :slight_smile:

I always wondered why those APIs are accessible from user mode even the
DDK was/is intended for kernel mode development?

Not that I have anything against it … those APIs are exactly what I
needed.

Bert

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bert
Schiettecatte
Sent: Friday, September 07, 2007 3:44 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] HidP / HidD APIs in Win DDK

Hi Doron,

Doron Holan wrote:

> WDF helps in implementing the driver itself, it plays no role in the
> driver’s interfaces/structures/contracts. HID defines an byte format,
> WDF does not touch that, so you can easily continue to use HID apis.
>
>
>
Thanks for your response. I understand that WDF helps implementing
drivers.

However, I am not writing a driver. I am using the HidD / HidP APIs in
user mode, to communicate with a HID device.

I wanted ot know if :

  1. Microsoft was planning to remove these APIs anytime soon
  2. The APIs also work on Windows Vista

Thanks,
Bert

> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@percussa.com
> Sent: Friday, September 07, 2007 2:22 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] HidP / HidD APIs in Win DDK
>
> Hi all,
>
> I have been using the HidD/HidP APIs in the Win DDK on Win XP to
>
access

> USB HID devices from user mode and read reports, etc.
>
> With the new driver framework (WDF?) that was introduced recently and
> Windows Vista, I’m not sure if this API is going to stay around and if
> there are any changes I have to be aware of?
>
> Thanks in advance,
> Bert.
>
>
> —
> 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
>
> —
> 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

>
>


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


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

Bert Schiettecatte wrote:

Doron Holan wrote:
> 1) if we removed them, we would break a ton of apps
> 2) if they didn’t work on vista, we would break a ton of apps
>
thanks a lot for clearing that up :slight_smile:

I always wondered why those APIs are accessible from user mode even
the DDK was/is intended for kernel mode development?

Not that I have anything against it … those APIs are exactly what I
needed.

The DDK was intended for device driver development. Some devices can be
driven perfectly well from user-mode.


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

Tim Roberts wrote:

Bert Schiettecatte wrote:

> Doron Holan wrote:
>
>> 1) if we removed them, we would break a ton of apps
>> 2) if they didn’t work on vista, we would break a ton of apps
>>
>>
> thanks a lot for clearing that up :slight_smile:
>
> I always wondered why those APIs are accessible from user mode even
> the DDK was/is intended for kernel mode development?
>
> Not that I have anything against it … those APIs are exactly what I
> needed.
>

The DDK was intended for device driver development. Some devices can be
driven perfectly well from user-mode.

Hi Tim,

Thanks for your reponse.

I could solve some of the issues I’ve been dealing with if I knew more
about how ReadFile / WriteFile are implemented in the Microsoft HID
driver in Windows. Is there documentation somewhere that describes how
the driver works in more detail ?

Thanks in advance,
Bert

It is pretty standard logic. If there is data, complete the the request immediately. If there is no data, pend the request.

What problems are you having?

d

Sent using my smartphone, apologies forany typos

-----Original Message-----
From: “Bert Schiettecatte”
To: “Windows System Software Devs Interest List”
Sent: 09/11/07 2:56 AM
Subject: Re: [ntdev] HidP / HidD APIs in Win DDK

Tim Roberts wrote:
> Bert Schiettecatte wrote:
>
>> Doron Holan wrote:
>>
>>> 1) if we removed them, we would break a ton of apps
>>> 2) if they didn’t work on vista, we would break a ton of apps
>>>
>>>
>> thanks a lot for clearing that up :slight_smile:
>>
>> I always wondered why those APIs are accessible from user mode even
>> the DDK was/is intended for kernel mode development?
>>
>> Not that I have anything against it … those APIs are exactly what I
>> needed.
>>
>
> The DDK was intended for device driver development. Some devices can be
> driven perfectly well from user-mode.
>
>
Hi Tim,

Thanks for your reponse.

I could solve some of the issues I’ve been dealing with if I knew more
about how ReadFile / WriteFile are implemented in the Microsoft HID
driver in Windows. Is there documentation somewhere that describes how
the driver works in more detail ?

Thanks in advance,
Bert


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

Doron Holan schreef:

It is pretty standard logic. If there is data, complete the the request immediately. If there is no data, pend the request.

What problems are you having?

Hi Doron,

Thanks for your reponse. My problems are mostly architecturally related.
Of course if I use ReadFile to read a report it works fine. I’m using
ReadFile with overlapped I/O in a thread, and it seems that the thread
locks up for some reason, even though my code was working last month.
I’ve looked at my commits the past month and couldn’t immediately detect
a problem with changes I made.

Is there an easy way to debug these type of thread related problems?

Thanks,
Bert.

d

Sent using my smartphone, apologies forany typos

-----Original Message-----
From: “Bert Schiettecatte”
> To: “Windows System Software Devs Interest List”
> Sent: 09/11/07 2:56 AM
> Subject: Re: [ntdev] HidP / HidD APIs in Win DDK
>
> Tim Roberts wrote:
>
>> Bert Schiettecatte wrote:
>>
>>
>>> Doron Holan wrote:
>>>
>>>
>>>> 1) if we removed them, we would break a ton of apps
>>>> 2) if they didn’t work on vista, we would break a ton of apps
>>>>
>>>>
>>>>
>>> thanks a lot for clearing that up :slight_smile:
>>>
>>> I always wondered why those APIs are accessible from user mode even
>>> the DDK was/is intended for kernel mode development?
>>>
>>> Not that I have anything against it … those APIs are exactly what I
>>> needed.
>>>
>>>
>> The DDK was intended for device driver development. Some devices can be
>> driven perfectly well from user-mode.
>>
>>
>>
> Hi Tim,
>
> Thanks for your reponse.
>
> I could solve some of the issues I’ve been dealing with if I knew more
> about how ReadFile / WriteFile are implemented in the Microsoft HID
> driver in Windows. Is there documentation somewhere that describes how
> the driver works in more detail ?
>
> Thanks in advance,
> Bert
>
>
> —
> 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
>
> —
> 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
>

What do you mean by locks up? Am event does not get signalled?

d

Sent using my smartphone, apologies forany typos

-----Original Message-----
From: “Bert Schiettecatte”
To: “Windows System Software Devs Interest List”
Sent: 09/11/07 11:07 AM
Subject: Re: [ntdev] HidP / HidD APIs in Win DDK

Doron Holan schreef:
> It is pretty standard logic. If there is data, complete the the request immediately. If there is no data, pend the request.
>
> What problems are you having?
>
>
Hi Doron,

Thanks for your reponse. My problems are mostly architecturally related.
Of course if I use ReadFile to read a report it works fine. I’m using
ReadFile with overlapped I/O in a thread, and it seems that the thread
locks up for some reason, even though my code was working last month.
I’ve looked at my commits the past month and couldn’t immediately detect
a problem with changes I made.

Is there an easy way to debug these type of thread related problems?

Thanks,
Bert.

> d
>
> Sent using my smartphone, apologies forany typos
>
> -----Original Message-----
> From: “Bert Schiettecatte”
> To: “Windows System Software Devs Interest List”
> Sent: 09/11/07 2:56 AM
> Subject: Re: [ntdev] HidP / HidD APIs in Win DDK
>
> Tim Roberts wrote:
>
>> Bert Schiettecatte wrote:
>>
>>
>>> Doron Holan wrote:
>>>
>>>
>>>> 1) if we removed them, we would break a ton of apps
>>>> 2) if they didn’t work on vista, we would break a ton of apps
>>>>
>>>>
>>>>
>>> thanks a lot for clearing that up :slight_smile:
>>>
>>> I always wondered why those APIs are accessible from user mode even
>>> the DDK was/is intended for kernel mode development?
>>>
>>> Not that I have anything against it … those APIs are exactly what I
>>> needed.
>>>
>>>
>> The DDK was intended for device driver development. Some devices can be
>> driven perfectly well from user-mode.
>>
>>
>>
> Hi Tim,
>
> Thanks for your reponse.
>
> I could solve some of the issues I’ve been dealing with if I knew more
> about how ReadFile / WriteFile are implemented in the Microsoft HID
> driver in Windows. Is there documentation somewhere that describes how
> the driver works in more detail ?
>
> Thanks in advance,
> Bert
>
>
> —
> 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
>
> —
> 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
>


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

Hi Doron,

Doron Holan schreef:

What do you mean by locks up? Am event does not get signalled?

I managed to fix my problems by reading up on various topics at

http://www.flounder.com/asynchexplorer.htm

meanwhile :slight_smile:

One thing that still puzzles me is that if I open a read handle on a HID
device, do I have to be concerned with HID report data being buffered
somehow, and do I have to empty send/receive buffers at all ? For serial
port I/O there are calls like PurgeComm () etc.

Thanks,
Bert

Hidclass will start buffering reports when you open a handle, all previous reports sent from the hw before you open the handle will be thrown away. I don’t think there is a command to purge what hidclass has buffered for you, but it should not be too hard to keep up with the data rate.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Bert Schiettecatte
Sent: Monday, September 17, 2007 5:20 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] HidP / HidD APIs in Win DDK

Hi Doron,

Doron Holan schreef:

What do you mean by locks up? Am event does not get signalled?

I managed to fix my problems by reading up on various topics at

http://www.flounder.com/asynchexplorer.htm

meanwhile :slight_smile:

One thing that still puzzles me is that if I open a read handle on a HID
device, do I have to be concerned with HID report data being buffered
somehow, and do I have to empty send/receive buffers at all ? For serial
port I/O there are calls like PurgeComm () etc.

Thanks,
Bert


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

Doron Holan wrote:

Hidclass will start buffering reports when you open a handle, all previous reports sent from the hw before you open the handle will be thrown away. I don’t think there is a command to purge what hidclass has buffered for you, but it should not be too hard to keep up with the data rate.

Right now I created a thread with CreateThread() and used overlapped I/O
with ReadFile() to get the reports. I just wonder what the best way is
to keep up if there is a new report every frame (1ms)?

Best,
Bert

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Bert Schiettecatte
Sent: Monday, September 17, 2007 5:20 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] HidP / HidD APIs in Win DDK

Hi Doron,

Doron Holan schreef:

> What do you mean by locks up? Am event does not get signalled?
>
>
>
I managed to fix my problems by reading up on various topics at

http://www.flounder.com/asynchexplorer.htm

meanwhile :slight_smile:

One thing that still puzzles me is that if I open a read handle on a HID
device, do I have to be concerned with HID report data being buffered
somehow, and do I have to empty send/receive buffers at all ? For serial
port I/O there are calls like PurgeComm () etc.

Thanks,
Bert


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


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

Bert Schiettecatte wrote:

Doron Holan wrote:
> Hidclass will start buffering reports when you open a handle, all
> previous reports sent from the hw before you open the handle will be
> thrown away. I don’t think there is a command to purge what hidclass
> has buffered for you, but it should not be too hard to keep up with
> the data rate.
>
>
Right now I created a thread with CreateThread() and used overlapped
I/O with ReadFile() to get the reports. I just wonder what the best
way is to keep up if there is a new report every frame (1ms)?

Either use a larger buffer (so you get multiple reports per transfer),
or submit lots of overlapped requests.


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