Archived
1
0

Merge pull request #1 from kiibohd/master

Merge upstream changes
This commit is contained in:
mcmasterathl 2015-02-27 16:43:24 -05:00
commit 867e7495a5
5 changed files with 185 additions and 147 deletions

View File

@ -30,44 +30,15 @@ from datetime import date
sys.path.append( os.path.expanduser('..') ) sys.path.append( os.path.expanduser('..') )
from kll_lib.containers import * from kll_lib.containers import *
from kll_lib.backends import *
### Decorators ###
## Print Decorator Variables
ERROR = '\033[5;1;31mERROR\033[0m:'
WARNING = '\033[5;1;33mWARNING\033[0m:'
### Classes ### ### Classes ###
class Backend: class Backend( BackendBase ):
# Initializes backend # Default templates and output files
# Looks for template file and builds list of fill tags templatePaths = ["templates/kiibohdKeymap.h", "templates/kiibohdDefs.h"]
def __init__( self, templatePath, definesTemplatePath ): outputPaths = ["generatedKeymap.h", "kll_defs.h"]
# Does template exist?
if not os.path.isfile( templatePath ):
print ( "{0} '{1}' does not exist...".format( ERROR, templatePath ) )
sys.exit( 1 )
self.definesTemplatePath = definesTemplatePath
self.templatePath = templatePath
self.fill_dict = dict()
# Generate list of fill tags
self.tagList = []
with open( templatePath, 'r' ) as openFile:
for line in openFile:
match = re.findall( '<\|([^|>]+)\|>', line )
for item in match:
self.tagList.append( item )
with open( definesTemplatePath, 'r' ) as openFile:
for line in openFile:
match = re.findall( '<\|([^|>]+)\|>', line )
for item in match:
self.tagList.append( item )
# USB Code Capability Name # USB Code Capability Name
def usbCodeCapability( self ): def usbCodeCapability( self ):
@ -106,10 +77,13 @@ class Backend:
partialLayersInfo = "" partialLayersInfo = ""
for file, name in zip( variables.baseLayout['*LayerFiles'], variables.baseLayout['*NameStack'] ): for file, name in zip( variables.baseLayout['*LayerFiles'], variables.baseLayout['*NameStack'] ):
baseLayoutInfo += "// {0}\n// {1}\n".format( name, file ) baseLayoutInfo += "// {0}\n// {1}\n".format( name, file )
if '*LayerFiles' in variables.layerVariables[0].keys():
for file, name in zip( variables.layerVariables[0]['*LayerFiles'], variables.layerVariables[0]['*NameStack'] ): for file, name in zip( variables.layerVariables[0]['*LayerFiles'], variables.layerVariables[0]['*NameStack'] ):
defaultLayerInfo += "// {0}\n// {1}\n".format( name, file ) defaultLayerInfo += "// {0}\n// {1}\n".format( name, file )
if '*LayerFiles' in variables.layerVariables[1].keys():
for layer in range( 1, len( variables.layerVariables ) ): for layer in range( 1, len( variables.layerVariables ) ):
partialLayersInfo += "// Layer {0}\n".format( layer ) partialLayersInfo += "// Layer {0}\n".format( layer )
if len( variables.layerVariables[ layer ]['*LayerFiles'] ) > 0:
for file, name in zip( variables.layerVariables[ layer ]['*LayerFiles'], variables.layerVariables[ layer ]['*NameStack'] ): for file, name in zip( variables.layerVariables[ layer ]['*LayerFiles'], variables.layerVariables[ layer ]['*NameStack'] ):
partialLayersInfo += "// {0}\n// {1}\n".format( name, file ) partialLayersInfo += "// {0}\n// {1}\n".format( name, file )
@ -186,7 +160,7 @@ class Backend:
# Add each of the arguments of the capability # Add each of the arguments of the capability
for arg in range( 0, len( resultItem[1] ) ): for arg in range( 0, len( resultItem[1] ) ):
self.fill_dict['ResultMacros'] += "0x{0:02X}, ".format( resultItem[1][ arg ] ) self.fill_dict['ResultMacros'] += "{0}, ".format( resultItem[1][ arg ] )
# If sequence is longer than 1, append a sequence spacer at the end of the sequence # If sequence is longer than 1, append a sequence spacer at the end of the sequence
# Required by USB to end at sequence without holding the key down # Required by USB to end at sequence without holding the key down
@ -319,6 +293,7 @@ class Backend:
# Generate stacked name # Generate stacked name
stackName = "" stackName = ""
if '*NameStack' in variables.layerVariables[ layer ].keys():
for name in range( 0, len( variables.layerVariables[ layer ]['*NameStack'] ) ): for name in range( 0, len( variables.layerVariables[ layer ]['*NameStack'] ) ):
stackName += "{0} + ".format( variables.layerVariables[ layer ]['*NameStack'][ name ] ) stackName += "{0} + ".format( variables.layerVariables[ layer ]['*NameStack'][ name ] )
stackName = stackName[:-3] stackName = stackName[:-3]
@ -334,40 +309,3 @@ class Backend:
## Layer State ## ## Layer State ##
self.fill_dict['LayerState'] = "uint8_t LayerState[ LayerNum ];" self.fill_dict['LayerState'] = "uint8_t LayerState[ LayerNum ];"
# Generates the output keymap with fill tags filled
def generate( self, outputPath, definesOutputPath ):
# Process each line of the template, outputting to the target path
with open( outputPath, 'w' ) as outputFile:
with open( self.templatePath, 'r' ) as templateFile:
for line in templateFile:
# TODO Support multiple replacements per line
# TODO Support replacement with other text inline
match = re.findall( '<\|([^|>]+)\|>', line )
# If match, replace with processed variable
if match:
outputFile.write( self.fill_dict[ match[ 0 ] ] )
outputFile.write("\n")
# Otherwise, just append template to output file
else:
outputFile.write( line )
# Process each line of the defines template, outputting to the target path
with open( definesOutputPath, 'w' ) as outputFile:
with open( self.definesTemplatePath, 'r' ) as templateFile:
for line in templateFile:
# TODO Support multiple replacements per line
# TODO Support replacement with other text inline
match = re.findall( '<\|([^|>]+)\|>', line )
# If match, replace with processed variable
if match:
outputFile.write( self.fill_dict[ match[ 0 ] ] )
outputFile.write("\n")
# Otherwise, just append template to output file
else:
outputFile.write( line )

View File

@ -1,7 +1,8 @@
Name = colemak; Name = "Simple Example";
Author = "HaaTa (Jacob Alexander) 2014"; Author = "HaaTa (Jacob Alexander) 2014-2015";
KLL = 0.2a; KLL = 0.3a;
usbKeyOut => Output_usbCodeSend_capability( usbCode : 1 );
#S0x40 : U0x43; #S0x40 : U0x43;
S0x40 : U"Backspace"; S0x40 : U"Backspace";

27
kll.py
View File

@ -83,25 +83,20 @@ def processCommandLineArgs():
# Optional Arguments # Optional Arguments
pArgs.add_argument( '-b', '--backend', type=str, default="kiibohd", pArgs.add_argument( '-b', '--backend', type=str, default="kiibohd",
help="Specify target backend for the KLL compiler.\n" help="Specify target backend for the KLL compiler.\n"
"Default: kiibohd" ) "Default: kiibohd\n"
"Options: kiibohd, json" )
pArgs.add_argument( '-d', '--default', type=str, nargs='+', pArgs.add_argument( '-d', '--default', type=str, nargs='+',
help="Specify .kll files to layer on top of the default map to create a combined map." ) help="Specify .kll files to layer on top of the default map to create a combined map." )
pArgs.add_argument( '-p', '--partial', type=str, nargs='+', action='append', pArgs.add_argument( '-p', '--partial', type=str, nargs='+', action='append',
help="Specify .kll files to generate partial map, multiple files per flag.\n" help="Specify .kll files to generate partial map, multiple files per flag.\n"
"Each -p defines another partial map.\n" "Each -p defines another partial map.\n"
"Base .kll files (that define the scan code maps) must be defined for each partial map." ) "Base .kll files (that define the scan code maps) must be defined for each partial map." )
pArgs.add_argument( '-t', '--template', type=str, default="templates/kiibohdKeymap.h", pArgs.add_argument( '-t', '--templates', type=str, nargs='+',
help="Specify template used to generate the keymap.\n" help="Specify template used to generate the keymap.\n"
"Default: templates/kiibohdKeymap.h" ) "Default: <backend specific>" )
pArgs.add_argument( '--defines-template', type=str, default="templates/kiibohdDefs.h", pArgs.add_argument( '-o', '--outputs', type=str, nargs='+',
help="Specify template used to generate kll_defs.h.\n"
"Default: templates/kiibohdDefs.h" )
pArgs.add_argument( '-o', '--output', type=str, default="generatedKeymap.h",
help="Specify output file. Writes to current working directory by default.\n" help="Specify output file. Writes to current working directory by default.\n"
"Default: generatedKeymap.h" ) "Default: <backend specific>" )
pArgs.add_argument( '--defines-output', type=str, default="kll_defs.h",
help="Specify output path for kll_defs.h. Writes to current working directory by default.\n"
"Default: kll_defs.h" )
pArgs.add_argument( '-h', '--help', action="help", pArgs.add_argument( '-h', '--help', action="help",
help="This message." ) help="This message." )
@ -128,7 +123,7 @@ def processCommandLineArgs():
for filename in partial: for filename in partial:
checkFileExists( filename ) checkFileExists( filename )
return (baseFiles, defaultFiles, partialFileSets, args.backend, args.template, args.defines_template, args.output, args.defines_output) return (baseFiles, defaultFiles, partialFileSets, args.backend, args.templates, args.outputs)
@ -401,7 +396,7 @@ def usbCodeToCapability( items ):
# Only convert if an integer, otherwise USB Code doesn't need converting # Only convert if an integer, otherwise USB Code doesn't need converting
if isinstance( items[ variant ][ sequence ][ combo ], int ): if isinstance( items[ variant ][ sequence ][ combo ], int ):
# Use backend capability name and a single argument # Use backend capability name and a single argument
items[ variant ][ sequence ][ combo ] = tuple( [ backend.usbCodeCapability(), tuple( [ items[ variant ][ sequence ][ combo ] ] ) ] ) items[ variant ][ sequence ][ combo ] = tuple( [ backend.usbCodeCapability(), tuple( [ hid_lookup_dictionary[ items[ variant ][ sequence ][ combo ] ] ] ) ] )
return items return items
@ -588,7 +583,7 @@ def gitRevision( kllPath ):
### Main Entry Point ### ### Main Entry Point ###
if __name__ == '__main__': if __name__ == '__main__':
(baseFiles, defaultFiles, partialFileSets, backend_name, template, defines_template, output, defines_output) = processCommandLineArgs() (baseFiles, defaultFiles, partialFileSets, backend_name, templates, outputs) = processCommandLineArgs()
# Look up git information on the compiler # Look up git information on the compiler
gitRev, gitChanges = gitRevision( os.path.dirname( os.path.realpath( __file__ ) ) ) gitRev, gitChanges = gitRevision( os.path.dirname( os.path.realpath( __file__ ) ) )
@ -596,7 +591,7 @@ if __name__ == '__main__':
# Load backend module # Load backend module
global backend global backend
backend_import = importlib.import_module( "backends.{0}".format( backend_name ) ) backend_import = importlib.import_module( "backends.{0}".format( backend_name ) )
backend = backend_import.Backend( template, defines_template ) backend = backend_import.Backend( templates )
# Process base layout files # Process base layout files
for filename in baseFiles: for filename in baseFiles:
@ -641,7 +636,7 @@ if __name__ == '__main__':
) )
# Generate output file using template and backend # Generate output file using template and backend
backend.generate( output, defines_output ) backend.generate( outputs )
# Successful Execution # Successful Execution
sys.exit( 0 ) sys.exit( 0 )

104
kll_lib/backends.py Normal file
View File

@ -0,0 +1,104 @@
#!/usr/bin/env python3
# KLL Compiler - Kiibohd Backend
#
# Backend code generator classes
#
# Copyright (C) 2015 by Jacob Alexander
#
# This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
### Imports ###
import os
import sys
import re
### Decorators ###
## Print Decorator Variables
ERROR = '\033[5;1;31mERROR\033[0m:'
WARNING = '\033[5;1;33mWARNING\033[0m:'
### Classes ###
class BackendBase:
# Default templates and output files
templatePaths = []
outputPaths = []
# Initializes backend
# Looks for template file and builds list of fill tags
def __init__( self, templatePaths ):
# Use defaults if no template is specified
if templatePaths is not None:
self.templatePaths = templatePaths
self.fill_dict = dict()
# Process each template and add to tagList
self.tagList = []
for templatePath in self.templatePaths:
# Does template exist?
if not os.path.isfile( templatePath ):
print ( "{0} '{1}' does not exist...".format( ERROR, templatePath ) )
sys.exit( 1 )
# Generate list of fill tags
with open( templatePath, 'r' ) as openFile:
for line in openFile:
match = re.findall( '<\|([^|>]+)\|>', line )
for item in match:
self.tagList.append( item )
# USB Code Capability Name
# XXX Make sure to override
def usbCodeCapability( self ):
return "my_capability";
# Processes content for fill tags and does any needed dataset calculations
# XXX Make sure to override
def process( self, capabilities, macros, variables, gitRev, gitChanges ):
print ( "{0} BackendBase 'process' function must be overridden".format( ERROR ) )
sys.exit( 2 )
# Generates the output keymap with fill tags filled
def generate( self, outputPaths ):
# Use default if not specified
if outputPaths is None:
outputPaths = self.outputPaths
for templatePath, outputPath in zip( self.templatePaths, outputPaths ):
# Process each line of the template, outputting to the target path
with open( outputPath, 'w' ) as outputFile:
with open( templatePath, 'r' ) as templateFile:
for line in templateFile:
# TODO Support multiple replacements per line
# TODO Support replacement with other text inline
match = re.findall( '<\|([^|>]+)\|>', line )
# If match, replace with processed variable
if match:
outputFile.write( self.fill_dict[ match[ 0 ] ] )
outputFile.write("\n")
# Otherwise, just append template to output file
else:
outputFile.write( line )

View File

@ -3,7 +3,7 @@
# #
# USB Code Lookup Dictionary # USB Code Lookup Dictionary
# #
# Copyright (C) 2014 by Jacob Alexander # Copyright (C) 2014-2015 by Jacob Alexander
# #
# This file is free software: you can redistribute it and/or modify # This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -105,7 +105,7 @@ hid_lookup_dictionary = dict([
( 0x52, 'KEY_UP' ), ( 0x52, 'KEY_UP' ),
( 0x53, 'KEY_NUM_LOCK' ), ( 0x53, 'KEY_NUM_LOCK' ),
( 0x54, 'KEYPAD_SLASH' ), ( 0x54, 'KEYPAD_SLASH' ),
( 0x55, 'KEYPAD_ASTERIX' ), ( 0x55, 'KEYPAD_ASTERISK' ),
( 0x56, 'KEYPAD_MINUS' ), ( 0x56, 'KEYPAD_MINUS' ),
( 0x57, 'KEYPAD_PLUS' ), ( 0x57, 'KEYPAD_PLUS' ),
( 0x58, 'KEYPAD_ENTER' ), ( 0x58, 'KEYPAD_ENTER' ),
@ -301,10 +301,10 @@ kll_hid_lookup_dictionary = dict([
( '9', 0x26 ), ( '9', 0x26 ),
( '0', 0x27 ), ( '0', 0x27 ),
( 'ENTER', 0x28 ), ( 'ENTER', 0x28 ),
( 'ESC', 0x29 ), ( 'ESC', 0x29 ), ( 'ESCAPE', 0x29 ),
( 'BACKSPACE', 0x2A ), ( 'BACKSPACE', 0x2A ),
( 'TAB', 0x2B ), ( 'TAB', 0x2B ),
( 'SPACE', 0x2C ), ( 'SPACE', 0x2C ), ( 'SPACEBAR', 0x2C ),
( '-', 0x2D ), ( 'MINUS', 0x2D ), ( '-', 0x2D ), ( 'MINUS', 0x2D ),
( '=', 0x2E ), ( 'EQUALS', 0x2E ), ( 'EQUAL', 0x2E ), ( '=', 0x2E ), ( 'EQUALS', 0x2E ), ( 'EQUAL', 0x2E ),
( '{', 0x2F ), ( 'LEFT BRACE', 0x2F ), ( 'LBRACE', 0x2F ), ( '{', 0x2F ), ( 'LEFT BRACE', 0x2F ), ( 'LBRACE', 0x2F ),
@ -312,12 +312,12 @@ kll_hid_lookup_dictionary = dict([
( '\\', 0x31 ), ( 'BACKSLASH', 0x31 ), ( '\\', 0x31 ), ( 'BACKSLASH', 0x31 ),
( '#', 0x32 ), ( 'NUMBER', 0x32 ), ( 'HASH', 0x32 ), ( '#', 0x32 ), ( 'NUMBER', 0x32 ), ( 'HASH', 0x32 ),
( ';', 0x33 ), ( 'SEMICOLON', 0x33 ), ( ';', 0x33 ), ( 'SEMICOLON', 0x33 ),
( "'", 0x34 ), ( 'QUOTE', 0x34 ), ( "'", 0x34 ), ( 'QUOTE', 0x34 ), ( 'SINGLE QUOTE', 0x34 ),
( '`', 0x35 ), ( 'BACKTICK', 0x35 ), ( '`', 0x35 ), ( 'BACKTICK', 0x35 ),
( ',', 0x36 ), ( 'COMMA', 0x36 ), ( ',', 0x36 ), ( 'COMMA', 0x36 ),
( '.', 0x37 ), ( 'PERIOD', 0x37 ), ( '.', 0x37 ), ( 'PERIOD', 0x37 ),
( '/', 0x38 ), ( 'SLASH', 0x38 ), ( '/', 0x38 ), ( 'SLASH', 0x38 ),
( 'CAPSLOCK', 0x39 ), ( 'CAPSLOCK', 0x39 ), { 'CAPS LOCK', 0x39 },
( 'F1', 0x3A ), ( 'F1', 0x3A ),
( 'F2', 0x3B ), ( 'F2', 0x3B ),
( 'F3', 0x3C ), ( 'F3', 0x3C ),
@ -330,22 +330,22 @@ kll_hid_lookup_dictionary = dict([
( 'F10', 0x43 ), ( 'F10', 0x43 ),
( 'F11', 0x44 ), ( 'F11', 0x44 ),
( 'F12', 0x45 ), ( 'F12', 0x45 ),
( 'PRINTSCREEN', 0x46 ), ( 'PRINTSCREEN', 0x46 ), ( 'PRINT SCREEN', 0x46 ),
( 'SCROLLLOCK', 0x47 ), ( 'SCROLLLOCK', 0x47 ), ( 'SCROLL LOCK', 0x47 ),
( 'PAUSE', 0x48 ), ( 'PAUSE', 0x48 ),
( 'INSERT', 0x49 ), ( 'INSERT', 0x49 ),
( 'HOME', 0x4A ), ( 'HOME', 0x4A ),
( 'PAGEUP', 0x4B ), ( 'PAGEUP', 0x4B ), ( 'PAGE UP', 0x4B ),
( 'DELETE', 0x4C ), ( 'DELETE', 0x4C ),
( 'END', 0x4D ), ( 'END', 0x4D ),
( 'PAGEDOWN', 0x4E ), ( 'PAGEDOWN', 0x4E ), ( 'PAGE DOWN', 0x4E ),
( 'RIGHT', 0x4F ), ( 'RIGHT', 0x4F ),
( 'LEFT', 0x50 ), ( 'LEFT', 0x50 ),
( 'DOWN', 0x51 ), ( 'DOWN', 0x51 ),
( 'UP', 0x52 ), ( 'UP', 0x52 ),
( 'NUMLOCK', 0x53 ), ( 'NUMLOCK', 0x53 ), ( 'NUM LOCK', 0x53 ),
( 'P/', 0x54 ), ( 'KEYPAD SLASH', 0x54 ), ( 'P/', 0x54 ), ( 'KEYPAD SLASH', 0x54 ),
( 'P*', 0x55 ), ( 'KEYPAD ASTERIX', 0x55 ), ( 'P*', 0x55 ), ( 'KEYPAD ASTERIX', 0x55 ), ( 'KEYPAD ASTERISK', 0x55 ),
( 'P-', 0x56 ), ( 'KEYPAD MINUS', 0x56 ), ( 'P-', 0x56 ), ( 'KEYPAD MINUS', 0x56 ),
( 'P+', 0x57 ), ( 'KEYPAD PLUS', 0x57 ), ( 'P+', 0x57 ), ( 'KEYPAD PLUS', 0x57 ),
( 'PENTER', 0x58 ), ( 'KEYPAD ENTER', 0x58 ), ( 'PENTER', 0x58 ), ( 'KEYPAD ENTER', 0x58 ),
@ -388,11 +388,11 @@ kll_hid_lookup_dictionary = dict([
( 'PASTE', 0x7D ), ( 'PASTE', 0x7D ),
( 'FIND', 0x7E ), ( 'FIND', 0x7E ),
( 'MUTE', 0x7F ), ( 'MUTE', 0x7F ),
( 'VOLUMEUP', 0x80 ), ( 'VOLUMEUP', 0x80 ), ( 'VOLUME UP', 0x80 ),
( 'VOLUMEDOWN', 0x81 ), ( 'VOLUMEDOWN', 0x81 ), ( 'VOLUME DOWN', 0x81 ),
( 'CAPSTOGGLELOCK', 0x82 ), ( 'CAPSTOGGLELOCK', 0x82 ), ( 'CAPS TOGGLE LOCK', 0x82 ),
( 'NUMTOGGLELOCK', 0x83 ), ( 'NUMTOGGLELOCK', 0x83 ), ( 'NUM TOGGLE LOCK', 0x83 ),
( 'SCROLLTOGGLELOCK', 0x84 ), ( 'SCROLLTOGGLELOCK', 0x84 ), ( 'SCROLL TOGGLE LOCK', 0x84 ),
( 'P,', 0x85 ), ( 'P,', 0x85 ),
( 'KEYPAD AS400 EQUAL', 0x86 ), ( 'KEYPAD AS400 EQUAL', 0x86 ),
( 'INTER1', 0x87 ), ( 'KANJI1', 0x87 ), ( 'INTER1', 0x87 ), ( 'KANJI1', 0x87 ),
@ -401,20 +401,20 @@ kll_hid_lookup_dictionary = dict([
( 'INTER4', 0x8A ), ( 'KANJI4', 0x8A ), ( 'HENKAN', 0x8A ), ( 'INTER4', 0x8A ), ( 'KANJI4', 0x8A ), ( 'HENKAN', 0x8A ),
( 'INTER5', 0x8B ), ( 'KANJI5', 0x8B ), ( 'MUHENKAN', 0x8B ), ( 'INTER5', 0x8B ), ( 'KANJI5', 0x8B ), ( 'MUHENKAN', 0x8B ),
( 'INTER6', 0x8C ), ( 'KANJI6', 0x8C ), ( 'INTER6', 0x8C ), ( 'KANJI6', 0x8C ),
( 'INTER7', 0x8D ), ( 'KANJI7', 0x8D ), ( 'BYTETOGGLE', 0x8D ), ( 'INTER7', 0x8D ), ( 'KANJI7', 0x8D ), ( 'BYTETOGGLE', 0x8D ), ( 'BYTE TOGGLE', 0x8D ),
( 'INTER8', 0x8E ), ( 'KANJI8', 0x8E ), ( 'INTER8', 0x8E ), ( 'KANJI8', 0x8E ),
( 'INTER9', 0x8F ), ( 'KANJI9', 0x8F ), ( 'INTER9', 0x8F ), ( 'KANJI9', 0x8F ),
( 'LANG1', 0x90 ), ( 'HANGULENGLISH', 0x90 ), ( 'LANG1', 0x90 ), ( 'HANGULENGLISH', 0x90 ), ( 'HANGUL ENGLISH', 0x90 ),
( 'LANG2', 0x91 ), ( 'HANJA', 0x91 ), ( 'EISU', 0x91 ), ( 'LANG2', 0x91 ), ( 'HANJA', 0x91 ), ( 'EISU', 0x91 ),
( 'LANG3', 0x92 ), ( 'KATAKANA', 0x92 ), ( 'LANG3', 0x92 ), ( 'KATAKANA', 0x92 ),
( 'LANG4', 0x93 ), ( 'HIRAGANA', 0x93 ), ( 'LANG4', 0x93 ), ( 'HIRAGANA', 0x93 ),
( 'LANG5', 0x94 ), ( 'ZENKAKUHANKAKU', 0x94 ), ( 'LANG5', 0x94 ), ( 'ZENKAKUHANKAKU', 0x94 ), ( 'ZENKAKU HANKAKU', 0x94 ),
( 'LANG6', 0x95 ), ( 'LANG6', 0x95 ),
( 'LANG7', 0x96 ), ( 'LANG7', 0x96 ),
( 'LANG8', 0x97 ), ( 'LANG8', 0x97 ),
( 'LANG9', 0x98 ), ( 'LANG9', 0x98 ),
( 'ALTERASE', 0x99 ), ( 'ALTERASE', 0x99 ), ( 'ALT ERASE', 0x99 ),
( 'SYSREQATT', 0x9A ), ( 'SYSREQATT', 0x9A ), ( 'SYSREQ', 0x9A ), ( 'SYSTEM REQUEST', 0x9A ),
( 'CANCEL', 0x9B ), ( 'CANCEL', 0x9B ),
( 'CLEAR', 0x9C ), ( 'CLEAR', 0x9C ),
( 'PRIOR', 0x9D ), ( 'PRIOR', 0x9D ),
@ -422,16 +422,16 @@ kll_hid_lookup_dictionary = dict([
( 'SEP', 0x9F ), ( 'SEPARATOR', 0x9F ), ( 'SEP', 0x9F ), ( 'SEPARATOR', 0x9F ),
( 'OUT', 0xA0 ), ( 'OUT', 0xA0 ),
( 'OPER', 0xA1 ), ( 'OPER', 0xA1 ),
( 'CLEAR_AGAIN', 0xA2 ), ( 'CLEAR AGAIN', 0xA2 ),
( 'CRSEL_PROPS', 0xA3 ), ( 'CRSEL PROPS', 0xA3 ),
( 'EXSEL', 0xA4 ), ( 'EXSEL', 0xA4 ),
( 'P00', 0xB0 ), ( 'KEYPAD 00', 0xB0 ), ( 'P00', 0xB0 ), ( 'KEYPAD 00', 0xB0 ),
( 'P000', 0xB1 ), ( 'KEYPAD 000', 0xB1 ), ( 'P000', 0xB1 ), ( 'KEYPAD 000', 0xB1 ),
( '1000SEP', 0xB2 ), ( 'THOUSANDSEPARATOR', 0xB2 ), ( '1000SEP', 0xB2 ), ( 'THOUSANDSEPARATOR', 0xB2 ), ( 'THOUSAND SEPARATOR', 0xB2 ),
( 'DECIMALSEP', 0xB3 ), ( 'DECIMALSEPARATOR', 0xB3 ), ( 'DECIMALSEP', 0xB3 ), ( 'DECIMALSEPARATOR', 0xB3 ), ( 'DECIMAL SEPARATOR', 0xB3 ),
( 'CURRENCY', 0xB4 ), ( 'CURRENCYUNIT', 0xB4 ), ( 'CURRENCY', 0xB4 ), ( 'CURRENCYUNIT', 0xB4 ), ( 'CURRENCY UNIT', 0xB4 ),
( 'CURRENCYSUB', 0xB5 ), ( 'CURRENCYSUBUNIT', 0xB5 ), ( 'CURRENCYSUB', 0xB5 ), ( 'CURRENCYSUBUNIT', 0xB5 ), ( 'CURRENCY SUB UNIT', 0xB5 ),
( 'P(', 0xB6 ), ( 'KEYPAD LEFT PARENTHESES', 0xB6 ), ( 'P(', 0xB6 ), ( 'KEYPAD LEFT PARENTHESES', 0xB6 ),
( 'P)', 0xB7 ), ( 'KEYPAD RIGHT PARENTHESES', 0xB7 ), ( 'P)', 0xB7 ), ( 'KEYPAD RIGHT PARENTHESES', 0xB7 ),
( 'P{', 0xB8 ), ( 'KEYPAD LEFT BRACE', 0xB8 ), ( 'P{', 0xB8 ), ( 'KEYPAD LEFT BRACE', 0xB8 ),
@ -447,40 +447,40 @@ kll_hid_lookup_dictionary = dict([
( 'PXOR', 0xC2 ), ( 'KEYPAD XOR', 0xC2 ), ( 'PXOR', 0xC2 ), ( 'KEYPAD XOR', 0xC2 ),
( 'P^', 0xC3 ), ( 'KEYPAD CHEVRON', 0xC3 ), ( 'P^', 0xC3 ), ( 'KEYPAD CHEVRON', 0xC3 ),
( 'P%', 0xC4 ), ( 'KEYPAD PERCENT', 0xC4 ), ( 'P%', 0xC4 ), ( 'KEYPAD PERCENT', 0xC4 ),
( 'P<', 0xC5 ), ( 'KEYPAD LESSTHAN', 0xC5 ), ( 'P<', 0xC5 ), ( 'KEYPAD LESSTHAN', 0xC5 ), ( 'KEYPAD LESS THAN', 0xC5 ),
( 'P>', 0xC6 ), ( 'KEYPAD GREATERTHAN', 0xC6 ), ( 'P>', 0xC6 ), ( 'KEYPAD GREATERTHAN', 0xC6 ), ( 'KEYPAD GREATER THAN', 0xC6 ),
( 'P&', 0xC7 ), ( 'KEYPAD BITAND', 0xC7 ), ( 'P&', 0xC7 ), ( 'KEYPAD BITAND', 0xC7 ), ( 'KEYPAD BIT AND', 0xC7 ),
( 'P&&', 0xC8 ), ( 'KEYPAD AND', 0xC8 ), ( 'P&&', 0xC8 ), ( 'KEYPAD AND', 0xC8 ),
( 'P|', 0xC9 ), ( 'KEYPAD BITOR', 0xC9 ), ( 'P|', 0xC9 ), ( 'KEYPAD BITOR', 0xC9 ), ( 'KEYPAD BIT OR', 0xC9 ),
( 'P||', 0xCA ), ( 'KEYPAD OR', 0xCA ), ( 'P||', 0xCA ), ( 'KEYPAD OR', 0xCA ),
( 'P:', 0xCB ), ( 'KEYPAD COLON', 0xCB ), ( 'P:', 0xCB ), ( 'KEYPAD COLON', 0xCB ),
( 'P#', 0xCC ), ( 'KEYPAD NUMBER', 0xCC ), ( 'KEYPAD HASH', 0xCC ), ( 'P#', 0xCC ), ( 'KEYPAD NUMBER', 0xCC ), ( 'KEYPAD HASH', 0xCC ),
( 'PSPACE', 0xCD ), ( 'KEYPAD SPACE', 0xCD ), ( 'PSPACE', 0xCD ), ( 'KEYPAD SPACE', 0xCD ),
( 'P@', 0xCE ), ( 'KEYPAD AT', 0xCE ), ( 'P@', 0xCE ), ( 'KEYPAD AT', 0xCE ),
( 'P!', 0xCF ), ( 'KEYPAD EXCLAIM', 0xCF ), ( 'P!', 0xCF ), ( 'KEYPAD EXCLAIM', 0xCF ),
( 'PMEMSTORE', 0xD0 ), ( 'KEYPAD MEMSTORE', 0xD0 ), ( 'PMEMSTORE', 0xD0 ), ( 'KEYPAD MEMSTORE', 0xD0 ), ( 'KEYPAD MEMORY STORE', 0xD0 ),
( 'PMEMRECALL', 0xD1 ), ( 'KEYPAD MEMRECALL', 0xD1 ), ( 'PMEMRECALL', 0xD1 ), ( 'KEYPAD MEMRECALL', 0xD1 ), ( 'KEYPAD MEMORY RECALL', 0xD1 ),
( 'PMEMCLEAR', 0xD2 ), ( 'KEYPAD MEMCLEAR', 0xD2 ), ( 'PMEMCLEAR', 0xD2 ), ( 'KEYPAD MEMCLEAR', 0xD2 ), ( 'KEYPAD MEMORY CLEAR', 0xD2 ),
( 'PMEMADD', 0xD3 ), ( 'KEYPAD MEMADD', 0xD3 ), ( 'PMEMADD', 0xD3 ), ( 'KEYPAD MEMADD', 0xD3 ), ( 'KEYPAD MEMORY ADD', 0xD3 ),
( 'PMEMSUB', 0xD4 ), ( 'KEYPAD MEMSUB', 0xD4 ), ( 'PMEMSUB', 0xD4 ), ( 'KEYPAD MEMSUB', 0xD4 ), ( 'KEYPAD MEMORY SUB', 0xD4 ),
( 'PMEMMULT', 0xD5 ), ( 'KEYPAD MEMMULT', 0xD5 ), ( 'PMEMMULT', 0xD5 ), ( 'KEYPAD MEMMULT', 0xD5 ), ( 'KEYPAD MEMORY MULTIPLY', 0xD5 ),
( 'PMEMDIV', 0xD6 ), ( 'KEYPAD MEMDIV', 0xD6 ), ( 'PMEMDIV', 0xD6 ), ( 'KEYPAD MEMDIV', 0xD6 ), ( 'KEYPAD MEMORY DIVIDE', 0xD6 ),
( 'P+/-', 0xD7 ), ( 'KEYPAD PLUSMINUS', 0xD7 ), ( 'P+/-', 0xD7 ), ( 'KEYPAD PLUSMINUS', 0xD7 ), ( 'KEYPAD PLUS MINUS', 0xD7 ),
( 'PCLEAR', 0xD8 ), ( 'KEYPAD CLEAR', 0xD8 ), ( 'PCLEAR', 0xD8 ), ( 'KEYPAD CLEAR', 0xD8 ),
( 'PCLEARENTRY', 0xD9 ), ( 'KEYPAD CLEARENTRY', 0xD9 ), ( 'PCLEARENTRY', 0xD9 ), ( 'KEYPAD CLEARENTRY', 0xD9 ), ( 'KEYPAD CLEAR ENTRY', 0xD9 ),
( 'PBINARY', 0xDA ), ( 'KEYPAD BINARY', 0xDA ), ( 'PBINARY', 0xDA ), ( 'KEYPAD BINARY', 0xDA ),
( 'POCTAL', 0xDB ), ( 'KEYPAD OCTAL', 0xDB ), ( 'POCTAL', 0xDB ), ( 'KEYPAD OCTAL', 0xDB ),
( 'PDECIMAL', 0xDC ), ( 'KEYPAD DECIMAL', 0xDC ), ( 'PDECIMAL', 0xDC ), ( 'KEYPAD DECIMAL', 0xDC ),
( 'PHEX', 0xDD ), ( 'KEYPAD HEX', 0xDD ), ( 'PHEX', 0xDD ), ( 'KEYPAD HEX', 0xDD ),
( 'LCTRL', 0xE0 ), ( 'LEFT CTRL', 0xE0 ), ( 'CTRL', 0xE0 ), ( 'LCTRL', 0xE0 ), ( 'LEFT CTRL', 0xE0 ), ( 'CTRL', 0xE0 ), ( 'CONTROL', 0xE0 ), ( 'LEFT CONTROL', 0xE0 ),
( 'LSHIFT', 0xE1 ), ( 'LEFT SHIFT', 0xE1 ), ( 'SHIFT', 0xE1 ), ( 'LSHIFT', 0xE1 ), ( 'LEFT SHIFT', 0xE1 ), ( 'SHIFT', 0xE1 ),
( 'LALT', 0xE2 ), ( 'LEFT ALT', 0xE2 ), ( 'ALT', 0xE2 ), ( 'LALT', 0xE2 ), ( 'LEFT ALT', 0xE2 ), ( 'ALT', 0xE2 ), ( 'ALTERNATE', 0xE2 ), ( 'LEFT ALTERNATE', 0xE2 ),
( 'LGUI', 0xE3 ), ( 'LEFT GUI', 0xE3 ), ( 'GUI', 0xE3 ), ( 'LGUI', 0xE3 ), ( 'LEFT GUI', 0xE3 ), ( 'GUI', 0xE3 ), ( 'SUPER', 0xE3 ), ( 'LEFT SUPER', 0xE3 ), ( 'WINDOWS', 0xE3 ), ( 'LEFT WINDOWS', 0xE3 ), ( 'WIN', 0xE3 ), ( 'LEFT WIN', 0xE3 ),
( 'RCTRL', 0xE4 ), ( 'RIGHT CTRL', 0xE4 ), ( 'RCTRL', 0xE4 ), ( 'RIGHT CTRL', 0xE4 ), ( 'RIGHT CONTROL', 0xE4 ),
( 'RSHIFT', 0xE5 ), ( 'RIGHT SHIFT', 0xE5 ), ( 'RSHIFT', 0xE5 ), ( 'RIGHT SHIFT', 0xE5 ),
( 'RALT', 0xE6 ), ( 'RIGHT ALT', 0xE6 ), ( 'RALT', 0xE6 ), ( 'RIGHT ALT', 0xE6 ), ( 'RIGHT ALTERNATE', 0xE6 ),
( 'RGUI', 0xE7 ), ( 'RIGHT GUI', 0xE7 ), ( 'RGUI', 0xE7 ), ( 'RIGHT GUI', 0xE7 ), ( 'RIGHT SUPER', 0xE7 ), ( 'RIGHT WINDOWS', 0xE7 ), ( 'RIGHT WIN', 0xE7 ),
( 'FUN1', 0xF0 ), ( 'FUNCTION1', 0xF0 ), ( 'FUN', 0xF0 ), ( 'FUN1', 0xF0 ), ( 'FUNCTION1', 0xF0 ), ( 'FUN', 0xF0 ),
( 'FUN2', 0xF1 ), ( 'FUNCTION2', 0xF1 ), ( 'FUN2', 0xF1 ), ( 'FUNCTION2', 0xF1 ),