Synchronous read from virtual HID device

Hello

I’m using VMulti (http://code.google.com/p/vmulti/) to create virtual HID devices.

The problem is, I’m not able to read anything from these devices using ReadFile. HID_GetInputReport kind of works, but the input buffer size is always zero.

When I use ReadFile, it just blocks and debug output from the driver doesn’t show any indication of that call. It’s like the call wasn’t forwarded to the driver at all.

Do I understand correctly that call to ReadFile should result in IOCTL_HID_READ_REPORT being sent to VMultiEvtInternalDeviceControl?

HID_GetInputReport results in IOCTL_HID_GET_INPUT_REPORT being send.

I verified above results with HClient from WDK.

Can anyone help?

Are you opening the handle as overlapped? If not, the call to readfile could be blocked by another io call (read, write, ioctl) etc at the io manager level

d

debt from my phone

-----Original Message-----
From: xxxxx@gmail.com
Sent: Wednesday, June 29, 2011 12:54 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Synchronous read from virtual HID device

Hello

I’m using VMulti (http://code.google.com/p/vmulti/) to create virtual HID devices.

The problem is, I’m not able to read anything from these devices using ReadFile. HID_GetInputReport kind of works, but the input buffer size is always zero.

When I use ReadFile, it just blocks and debug output from the driver doesn’t show any indication of that call. It’s like the call wasn’t forwarded to the driver at all.

Do I understand correctly that call to ReadFile should result in IOCTL_HID_READ_REPORT being sent to VMultiEvtInternalDeviceControl?

HID_GetInputReport results in IOCTL_HID_GET_INPUT_REPORT being send.

I verified above results with HClient from WDK.

Can anyone help?


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

The application I’m trying to support is using non overlapped handle. I can’t patch the application, so I need to fix this somehow.

I tried changing IOCTL_HID_READ_REPORT procedure to always return STATUS_BUFFER_TOO_SMALL. I thought that would at least solve the blocking problem, but it didn’t. ReadFile still blocks waiting for data and it still seems that the read request isn’t delivered to the driver at all, I see no indication of that happening in the debug view, although I see that something (OS?) is reading from the device periodically.

Do you have any idea how to diagnose what the problem is?

That means that some other io is pending on the handle.

d

debt from my phone

-----Original Message-----
From: xxxxx@gmail.com
Sent: Thursday, June 30, 2011 1:27 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Synchronous read from virtual HID device

The application I’m trying to support is using non overlapped handle. I can’t patch the application, so I need to fix this somehow.

I tried changing IOCTL_HID_READ_REPORT procedure to always return STATUS_BUFFER_TOO_SMALL. I thought that would at least solve the blocking problem, but it didn’t. ReadFile still blocks waiting for data and it still seems that the read request isn’t delivered to the driver at all, I see no indication of that happening in the debug view, although I see that something (OS?) is reading from the device periodically.

Do you have any idea how to diagnose what the problem is?


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

Is there a way to check what’s pending on the handle, or to “flush” these pending requests?
Why is something pending at all, when I handle all requests when they arrive?

No, there is no way to check. You could try process explorer and see what it says. You could try CancelIoEx once you know the thread that is stuck. As for why something is pending at all, you are a HID miniport, hidclass handles all of the IO sent on file handle. It will either queue the request (as is the case for reads usually) or send it to the miniport directly (for writes)

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Thursday, June 30, 2011 10:16 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Synchronous read from virtual HID device

Is there a way to check what’s pending on the handle, or to “flush” these pending requests?
Why is something pending at all, when I handle all requests when they arrive?


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

Is there a way to override this behavior? For example, to force hidclass to forward all events to my driver?

Nope. Fix your app or open another handle to the device

d

debt from my phone

-----Original Message-----
From: xxxxx@gmail.com
Sent: Friday, July 01, 2011 11:56 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Synchronous read from virtual HID device

Is there a way to override this behavior? For example, to force hidclass to forward all events to my driver?


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