Updating the Keyboard Driver IST (Windows CE 5.0)

Send Feedback

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 named Ps2keybd.cpp.

To update the keyboard driver IST

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

    Keyboard drivers for some hardware platforms might 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 example 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 that Windows CE .NET 4.1 and earlier Windows CE OSs assigned 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_EVENTtypedef. The pfnGetKeybdEvent function only returns the new scan codes and whether each was a key-up or a key-down event. The IST calls pfnGetKeybdEvent, then passes the returned information to the Layout Manager's pfnKeybdEvent callback function. Keyboard drivers for some hardware platforms name this function KeybdPdd_GetEventEx2, but you can name it anything because the IST calls it through a function pointer.

See Also

Layout Manager

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.