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

WinCE HID Driver setreport

9 views
Skip to first unread message

Liang Zhu

unread,
Jan 28, 2013, 11:14:55 AM1/28/13
to
I have written the following source to sent data packet to HID slave device. I am getting the input, but I can not see the output on the USB analyzer, could someone tell me where is my mistake?

HANDLE hReg = NULL;
HANDLE hQueue = NULL;
MSGQUEUEOPTIONS msgopts;
GUID InterfaceClassGuid = DEVCLASS_KEYBOARD_GUID;

output[0]=1;
output[1]=2;
dwBytesToWrite=(DWORD)sizeof(output);

memset(&msgopts, 0, sizeof(msgopts));
msgopts.dwSize = sizeof(msgopts);
msgopts.dwFlags = 0;
msgopts.dwMaxMessages = 0;
msgopts.cbMaxMessage = sizeof(pPNPBuf);
msgopts.bReadAccess = TRUE;

InitializeCriticalSection(&g_csHidDevices);

hQueue = CreateMsgQueue(NULL, &msgopts);
if (hQueue == NULL) {printf("Unable to create message queue !\r\n");}

hReg = RequestDeviceNotifications(&InterfaceClassGuid, hQueue, TRUE);
if (hReg == NULL)
{ printf("Unable to RequestDeviceNotifications!\r\n");}

ReadMsgQueue(hQueue, pd, sizeof(pPNPBuf), &dwSize, 0 , &dwFlags);

if (pd->fAttached == TRUE)
{

DWORD result = (DWORD)((LPSET_REPORT)(hQueue, HidP_Output, output, dwBytesToWrite, 3000));
if (result == NULL)
{
printf("Fail1\n");
}
else
{
printf("the data has transfered %d\n");
}

}
0 new messages