Updating the Keyboard Driver IST

In Windows CE .NET 4.2, Microsoft modified the keyboard driver interrupt service thread (IST) and the function that the keyboard driver IST calls to get the scan codes from the keyboard.

Perform the following steps in the file that contains the implementation of the IsrThreadProc function. Usually this file is Ps2keybd.cpp.

To update the keyboard driver IST

  1. Add the Keybdpdd.h and Keybdist.h files to the list of #include files.

    Some platform keyboard drivers may already include one or both of these files.

  2. In the IsrThreadProc function, use the extern declarator to obtain access to the v_uiPddId and v_pfnKeybdEvent global variables.

    The following code example shows how to obtain access to these global variables.

    extern UINT            v_uiPddId;
    extern PFN_KEYBD_EVENT v_pfnKeybdEvent;
    
  3. In the IsrThreadProc function, declare a KEYBD_IST structure.

    The following code sample shows how to declare a KEYBD_IST structure.

    KEYBD_IST keybdIst;
    
  4. In the IsrThreadProc function, instead of calling KeybdIstLoop with the event handle, call KeybdIstLoop with a completed KEYBD_IST structure.

    The following code example shows a way to fill in the KEYBD_IST structure.

    keybdIst.hevInterrupt = m_hevInterrupt;
    keybdIst.dwSysIntr_Keybd = dwSysIntr_Keybd;
    keybdIst.uiPddId = v_uiPddId;
    keybdIst.pfnGetKeybdEvent = KeybdPdd_GetEventEx2;
    keybdIst.pfnKeybdEvent = v_pfnKeybdEvent;
    
    KeybdIstLoop(&keybdIst);
    

    This code example assigns the hevInterrupt member the same interrupt event handle Windows CE .NET 4.1 and earlier passed to KeybdIstLoop. The other members receive the keyboard's SysIntr, the identifier value, the Layout Manager callback function that was passed to the PDD entry function, and the function to call when the interrupt event is signaled.

    The pfnGetKeybdEvent function is a simplified version of the KeybdPdd_GetEventEx function, which conforms to the PFN_KEYBD_PDD_GET_KEYBD_EVENT typedef. The pfnGetKeybdEvent function only returns the new scan codes and whether each was a key up or a key down. The IST calls pfnGetKeybdEvent, then passes the returned information to the Layout Manager's pfnKeybdEvent callback function. Some platform's keyboard drivers name this function KeybdPdd_GetEventEx2, but you can name it anything because the IST calls it through a function pointer.

See Also

How to Migrate a Keyboard Driver to Conform to the Layout Manager Interface | Keyboard Drivers | Layout Manager

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.