none
WinCE HID Driver setreport RRS feed

  • Question

  • I have written the following source to set data to HID slave device.   I am getting the input,  but I can not see the output on the USB analyzer,   could someone tell 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");
                }

    }

    Saturday, January 26, 2013 3:04 AM