Freigeben über


Adding Keyboard LED Support to the HID Keyboard Driver (Windows CE 5.0)

Send Feedback

To migrate a keyboard driver from Windows CE .NET 4.1 to Windows CE .NET 4.2, HID requires some support from the keyboard driver to support the NUM LOCK LED, CAPS LOCK LED, SCROLL LOCK LED, and numeric keypad remapping.

An IOCTL must be sent from the GWES keyboard driver to the HID keyboards in two places for the HID keyboard drivers to get the global modifier state and to keep the HID drivers current with the other keyboard drivers in the system. The global modifier state is the state of NUM LOCK, CAPS LOCK, and SCROLL LOCK, when they are attached. Microsoft provides the code to do this, which is boilerplate. The keyboard driver must make two new function calls. Both of the functions that need to be called are declared in the included header file.

To add keyboard LED support to the HID keyboard driver

  1. Examine the boilerplate code in %_WINCEROOT%\Public\Common\OAK\Drivers\Keybd\Hidioctl.

  2. Send the IOCTL whenever a new HID keyboard is attached by creating a thread during GWES keyboard initialization that waits for any keyboard IClass drivers to be attached, and then send each the current global modifier state.

    GWES keyboard initialization takes place in PFN_KEYBD_DRIVER_INITIALIZE_EX, which calls CreateHidKbdThread to create the thread that waits for new HID keyboards and sends them the initialize IOCTL.

  3. Send the IOCTL whenever the global modifier state changes.

    This occurs in PFN_KEYBD_DRIVER_VKEY_TO_UNICODE. After updating the KeyState array entry for the current virtual key, usually through a call to NewKeyStateFlags, it calls ProcessEventForHidKbd(KeyState) that sends an IOCTL to each HID keyboard if the global modifier state changed.

  4. Update your keyboard driver's sources file to build the included .cpp file.

See Also

Keyboard Driver Migration | Keyboard Drivers | Layout Manager

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.