none
Hid keyboard LEDs does not respond RRS feed

  • Question

  •  I tried to turn on the HID keyboard LEDs with the code below.  DeviceIoControl does not return any error, but none of my LEDs responses to the call.  am I on the right track?

    DEVDETAIL *pd = (DEVDETAIL*)pPNPBuf;
        HANDLE hDriver;

       GUID InterfaceClassGuid = DEVCLASS_KEYBOARD_GUID;

       KEY_STATE_FLAGS g_HidKeyStateFlags = 1;

      DWORD dwBytesRead, dwBytesWritten, dwPos;
      char buff[4096];

        DEVMGR_DEVICE_INFORMATION DeviceInfo;

        DeviceInfo.dwSize = sizeof(DEVMGR_DEVICE_INFORMATION);
        hDriver = FindFirstDevice(DeviceSearchByGuid, &InterfaceClassGuid, &DeviceInfo);

    if (pd->fAttached==TRUE)
         {

              hkbd= CreateFile(DeviceInfo.szDeviceName,
                    GENERIC_WRITE|GENERIC_READ,     
                           0,                    
                           NULL,                
                           OPEN_EXISTING,         
                           FILE_FLAG_OVERLAPPED,
                           0);        

              if ( hkbd == INVALID_HANDLE_VALUE)
              {
                 printf("Terminal Failure:unable to open file\n");
              }
              else
              {
               

               BOOL bErrIO=DeviceIoControl(hkbd, IOCTL_HID_SET_MODIFIERS,  &g_HidKeyStateFlags,

                        sizeof(g_HidKeyStateFlags),  NULL, 0, NULL, NULL);

    
    

              }

    }

    Friday, December 28, 2012 9:29 PM