Liang Zhu
unread,Jan 28, 2013, 11:14:55 AM1/28/13You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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");
}
}