Ø Generate a keyboard layout from Windows XP keyboard layout
1. Copy kbdfr.dll (Windows XP French keyboard layout) to your expected folder from C:\WINDOWS\system32
2. Open command prompt in Platform Builder
3. Enter previous folder which include kbdfr.dll and type the follows kbdgen kbdfr.dll -o 40c -i 040c
P.S. kbdgen is Keyboard Layout Generator Tool
4. Previous step generate three files:
40cIL.cpp –Input language source file.
40cDL.cpp - Device layout source file.
40c.reg - Sample registry entries that may be used for this layout.
P.S. The prefix of file name is assigned by blue words of kbdgen parameters
Ø Creating the Keyboard Device Layout
1. Create a DeviceLayout directory within the keyboard driver directory for your project.
For example, %_WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\KEYBD\DEVICELAYOUTS\PS2_AT\0000040C
2. Add a sources file to the DeviceLayout directory.
For an example DeviceLayout sources file, see %_WINCEROOT%\Public\Common\Oak\Drivers\Keybd\DeviceLayouts\PS2_AT\00000409.
3. Add the Makefile file to the DeviceLayout directory.
For an example DeviceLayout Makefile file, see %_WINCEROOT%\Public\Common\Oak\Drivers\Keybd\DeviceLayouts\PS2_AT\00000409.
4. From the files that the Kbdgen.exe tool generated, add the file ending in DL to the DeviceLayout directory.
We copy 40cDL.cpp into this folder.
5. Modify the sources file to fit your project
Ex:
TARGETDEFNAME=kbdfr TARGETNAME=$(TARGETDEFNAME)_lib TARGETTYPE=LIBRARY
DEFFILE=$(TARGETDEFNAME).def WINCETARGETFILE0=$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\$(TARGETDEFNAME).def
SOURCES= \ 40cDL.cpp \ |
6. Add and modify the kbdfr.def file to the DeviceLayout directory.
For an example DeviceLayout DEF file, see
%_WINCEROOT%\Public\Common\Oak\Drivers\Keybd\DeviceLayouts\PS2_AT\00000409\kbdus.def.
7. Build it to generate the kbdfr_lib.lib
Ø Generate Input language Library for French Layout
1. Create a InputLanguage directory within the keyboard driver directory for your project.
For example, %_WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\KEYBD\INPUTLANGS\040C
2. Add a sources file to the InputLanguage directory.
For an example InputLanguage sources file, see %_WINCEROOT%\Public\Common\Oak\Drivers\Keybd\InputLangs\0409
3. Add the Makefile file to the DeviceLayout directory.
For an example InputLanguage Makefile file, see %_WINCEROOT%\Public\Common\Oak\Drivers\Keybd\InputLangs\0409.
4. From the files that the Kbdgen.exe tool generated, add the file ending in IL to the InputLanguage directory.
We copy 40cIL.cpp into this folder.
5. Modify the sources file to fit your project
Ex:
TARGETNAME=InputLang_040C TARGETTYPE=LIBRARY
SOURCES= \ 40cIL.cpp \ |
6. Build it to generate the InputLang_040C.lib
Ø Creating the Keyboard DLL Sources File
1. Create a Keyboard DLL directory within the keyboard driver directory for your project.
For example, %_WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\KEYBD\DLL\KBD8042FR
2. Add a sources file to the Keyboard DLL directory.
For an example Keyboard DLL sources file, see %_WINCEROOT%\Public\Common\Oak\Drivers\KEYBD\DLL\KBD8042US.
3. Add a Makefile file to the Keyboard DLL directory.
For an example Keyboard DLL Makefile file, see %_WINCEROOT%\Public\Common\Oak\Drivers\KEYBD\DLL\KBD8042US.
4. Add a pddlist.cpp file to the Keyboard DLL directory.
For an example Keyboard DLL Makefile file, see %_WINCEROOT%\Public\Common\Oak\Drivers\KEYBD\DLL\KBD8042US.
5. Modify the sources file to fit your project
Ex:
SYNCHRONIZE_DRAIN=1
DEFFILE=$(_COMMONOAKROOT)\DRIVERS\KEYBD\DLL\KBD8042FR\KbdFR.def
!IFDEF DOSYSGEN
TARGETNAME=Kbd8042FR_lib TARGETTYPE=LIBRARY TARGETDEFNAME=Kbd8042FR
WINCETARGETFILE0=$(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\$(TARGETDEFNAME).def
!ELSE
TARGETNAME=Kbd8042FR TARGETTYPE=DYNLINK DLLENTRY=DllMain TARGETLIBS= \ $(_PROJECTROOT)\cesysgen\sdk\lib\$(_CPUINDPATH)\coredll.lib \ $(_SYSGENOAKROOT)\lib\$(_CPUINDPATH)\ceddk.lib
!ENDIF
SOURCELIBS=\ $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\PS2_8042_KbdCommon.lib \ $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\LayoutManager.lib \ $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\KeybdIst.lib \ $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\kbdfr_lib.lib \ $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\NumPadRmp.lib \ $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\InputLang_040C.lib \
WINCETARGETFILES=dummy
SOURCES=\ PDDList.cpp \ |
P.S. remove DOSYSGEN=1 to generate DLL file, not LIB file
6. Add and modify the kbdfr.def file to the Keyboard DLL directory.
For an example Keyboard DLL DEF file, see %_WINCEROOT%\Public\COMMON\OAK\INC\kbdus.def.
LIBRARY LAYOUTMANAGER
EXPORTS
KeybdDriverInitializeEx KeybdDriverPowerHandler KeybdDriverGetInfo KeybdDriverSetMode KeybdDriverInitStates KeybdDriverVKeyToUnicode KeybdDriverMapVirtualKey
LayoutMgrGetKeyboardType LayoutMgrGetKeyboardLayout LayoutMgrGetKeyboardLayoutName LayoutMgrGetKeyboardLayoutList LayoutMgrLoadKeyboardLayout LayoutMgrActivateKeyboardLayout
IL_0000040C PS2_AT_0000040C |
7. Build it to generate the Kbd8042FR.dll
Ø Add New French Layout Keyboard Driver
1. Modify the 40c.reg and add it (save as new filename kbd8042FR.reg) into your OS Design.
; French Keyboard Layout
; Generated by tool built on Dec 30 2003 15:22:20 ; from keyboard DLL kbdfr.dll ; for input locale 0000040C
; Please define the Layout File, Layout Text and PS2_AT values [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Layouts\0000040C] "Layout File"="Kbd8042FR.dll" "Layout Text"="FR" "PS2_AT"="Kbd8042FR.dll"
; Please choose a preload key number appropriate for the target device. [HKEY_CURRENT_USER\Keyboard Layout\Preload\2] @="0000040C"
; French is the default keyboard layout [HKEY_CURRENT_USER\Keyboard Layout\Preload] @="0000040C"
|
P.S. Take care on “\HKCU\Keyboard Layout\Preload\<Number>“
a. Don’t overlap <Number> with other keyboard layout owns, ex: US (Preload\1)
b. <Number> is from 1 to 15. (Defined by layout manager)
2. add kbd8042.bib into your OS Design
; French Keyboard Layout
MODULES Kbd8042FR.dll $(_FLATRELEASEDIR)\Kbd8042FR.dll NK SH |
3. Make image.
In my verification, PS/2 and USB keyboard could support French keyboard layout
US layout: QWERTY
French layout: AZERTY
You can runtime switch the keyboard layout via the icon
--------------------------------------------------------------------------------------------------------
Reference: