hidd_setfeature never returns in my DLL

Hi All,

I’m running into a strange issue. I have a code to send SET_FEATURE to turn on the light. The code runs well on a test application. But when I put the code into a DLL which is loaded by the 3rd application, calling the API Hidd_SetFeature hangs and never returns. I use the USB analyzer and saw that the device has already sent ACK back to the host. I’m wondering why this happens in the DLL not my test application. I’m 100% sure that they’re using the same. In what circumstances, the API hangs even after the device sends the ACK.

Thanks,
Marshall

Who opens the handle? Overlapped? Shared between the app and all or just in your dll?

d

Bent from my phone


From: xxxxx@hotmail.commailto:xxxxx
Sent: ?10/?9/?2014 9:22 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] hidd_setfeature never returns in my DLL

Hi All,

I’m running into a strange issue. I have a code to send SET_FEATURE to turn on the light. The code runs well on a test application. But when I put the code into a DLL which is loaded by the 3rd application, calling the API Hidd_SetFeature hangs and never returns. I use the USB analyzer and saw that the device has already sent ACK back to the host. I’m wondering why this happens in the DLL not my test application. I’m 100% sure that they’re using the same. In what circumstances, the API hangs even after the device sends the ACK.

Thanks,
Marshall


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>

Hi Doron,

The DLL opens the HID device in overlapped mode. It’s only used by the DLL and not shared with the application. Calling the hidd_setfeature in a worker thread that created by the DLL. The OS is windows 7 64bit. The application is also 64bit application and the DLL is also 64bit.

Thanks,
Marshall

I don’t remember if hid.dll supports overlapped handles or not, my guess is not. Try opening a non overlapped handle and see if the hang still occurs

d

Bent from my phone


From: xxxxx@hotmail.commailto:xxxxx
Sent: ?10/?9/?2014 9:32 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] hidd_setfeature never returns in my DLL

Hi Doron,

The DLL opens the HID device in overlapped mode. It’s only used by the DLL and not shared with the application. Calling the hidd_setfeature in a worker thread that created by the DLL. The OS is windows 7 64bit. The application is also 64bit application and the DLL is also 64bit.

Thanks,
Marshall


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>

Hi Doron,

It works. I noticed that there is such a comment in the HClient but I didn’t put it in my mind because I only saw this issue in the DLL. The issue doesn’t happen if I open the device with overlapped mode in the test application.

Regards,
Marshall

You were getting lucky with the io completing synchronously

d

Bent from my phone


From: xxxxx@hotmail.commailto:xxxxx
Sent: ?10/?9/?2014 10:45 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] hidd_setfeature never returns in my DLL

Hi Doron,

It works. I noticed that there is such a comment in the HClient but I didn’t put it in my mind because I only saw this issue in the DLL. The issue doesn’t happen if I open the device with overlapped mode in the test application.

Regards,
Marshall


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>

Doron Holan wrote:

I don’t remember if hid.dll supports overlapped handles or not, my
guess is not.

Well, I’ll be darned. I certainly didn’t realize this. I’m working on
a project literally right now that uses a USB-to-SPI bridge chip
(MCP2210) that is exposed as a HID device, and the sample code (and
hence all of my code) uses overlapped I/O. Without that, how do we
implement timeouts?


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