diff options
-rwxr-xr-x | make_keycodes.sh | 52 | ||||
-rwxr-xr-x | make_symbols.sh | 122 |
2 files changed, 130 insertions, 44 deletions
diff --git a/make_keycodes.sh b/make_keycodes.sh index 176c3aa9..d76d99fd 100755 --- a/make_keycodes.sh +++ b/make_keycodes.sh @@ -10,6 +10,20 @@ NEW_KEYCODES_NAME="tizen" FULL_KEY_LIST="\/\/ For Tizen Keycodes" CHANGE_STRING="\/\/ @For Tizen Keycodes@" PLATFORM_BASE_KEYCODE=8 +RULE_FILE=${RULE_FILE_PATH} + +function generate_light_keycodes(){ + echo "default xkb_keycodes \"evdev\" {" > ${KEYCODES_PATH}${NEW_KEYCODES_NAME} + echo " minimum = 8;" >> ${KEYCODES_PATH}${NEW_KEYCODES_NAME} + echo " maximum = 255;" >> ${KEYCODES_PATH}${NEW_KEYCODES_NAME} + echo "" >> ${KEYCODES_PATH}${NEW_KEYCODES_NAME} + echo " // @For Tizen Keycodes@" >> ${KEYCODES_PATH}${NEW_KEYCODES_NAME} + echo "};" >> ${KEYCODES_PATH}${NEW_KEYCODES_NAME} + echo "" >> ${KEYCODES_PATH}${NEW_KEYCODES_NAME} + echo "xkb_keycodes "pc98" {" >> ${KEYCODES_PATH}${NEW_KEYCODES_NAME} + echo " include \"evdev(evdev)\"" >> ${KEYCODES_PATH}${NEW_KEYCODES_NAME} + echo "};" >> ${KEYCODES_PATH}${NEW_KEYCODES_NAME} +} if [ -e ${KEYMAP_FILE_PATH} ] then @@ -20,14 +34,48 @@ else fi echo "Generate a tizen keycodes file" +_light_keymap_mode=false +_light_locale_mode=false -cp ${KEYCODES_PATH}${DEFAULT_KEYCODES_NAME} ${KEYCODES_PATH}${NEW_KEYCODES_NAME} +if [ -e ${RULE_FILE} ] +then + while read STRING + do + if [[ $STRING == *"light_keymap="* ]]; then + _light_keymap_mode=${STRING#*=} + fi + if [[ $STRING == *"light_locale="* ]]; then + _light_locale_mode=${STRING#*=} + fi + done < ${RULE_FILE} +fi +echo "light keymap mode: "${_light_keymap_mode}", light locale mode: "${_light_locale_mode} + +if [ "${_light_keymap_mode}" == "true" ]; then + generate_light_keycodes +else + cp ${KEYCODES_PATH}${DEFAULT_KEYCODES_NAME} ${KEYCODES_PATH}${NEW_KEYCODES_NAME} +fi + +LOCALE_PATH=${TZ_SYS_RO_SHARE}/X11/locale/ +LOCALE_LIGHT_PATH=${TZ_SYS_RO_SHARE}/X11/locale-light/ + +if [ -e ${LOCALE_LIGHT_PATH} ]; then + if [ "${_light_locale_mode}" == "true" ]; then + rm -rf ${LOCALE_PATH} + mv ${LOCALE_LIGHT_PATH} ${LOCALE_PATH} + else + rm -rf ${LOCALE_LIGHT_PATH} + fi +fi echo ${KEYCODES_PATH}${NEW_KEYCODES_NAME} while read KEYNAME KERNEL_KEYCODE KEYBOARD_OPTS do - [[ $KEYBOARD_OPTS == *"keyboard"* ]] && continue + if [ "${_light_keymap_mode}" == "false" ]; then + [[ $KEYBOARD_OPTS == *"keyboard"* ]] && continue + fi KERNEL_KEYCODE=$(echo $KERNEL_KEYCODE $PLATFORM_BASE_KEYCODE | awk '{print $1 + $2}') KEYCODE="${KERNEL_KEYCODE}" FULL_KEY_LIST=${FULL_KEY_LIST}"\n\t<I${KEYCODE}>=${KEYCODE}; \/\/ ${KEYNAME}" diff --git a/make_symbols.sh b/make_symbols.sh index 67040023..a3bfae01 100755 --- a/make_symbols.sh +++ b/make_symbols.sh @@ -1,7 +1,7 @@ #!/bin/sh if [ "$TZ_SYS_RO_SHARE" = "" ]; then - TZ_SYS_RO_SHARE="/usr/share" + TZ_SYS_RO_SHARE="/usr/share" fi SYMBOLS_PATH="./symbols/inet" @@ -11,6 +11,7 @@ NEW_SYMBOLS_NAME="tizen" DEFAULT_SYMBOLS_SECTION=false TEMP_SYMBOLS_FILE="./symbols/inet_tizen" PLATFORM_BASE_KEYCODE=8 +RULE_FILE=${RULE_FILE_PATH} if [ -e ${KEYMAP_FILE_PATH} ] then @@ -20,6 +21,22 @@ else exit fi +_light_keymap_mode=false +_light_locale_mode=false + +if [ -e ${RULE_FILE} ] +then + while read STRING + do + if [[ $STRING == *"light_keymap="* ]]; then + _light_keymap_mode=${STRING#*=} + fi + if [[ $STRING == *"light_locale="* ]]; then + _light_locale_mode=${STRING#*=} + fi + done < ${RULE_FILE} +fi + echo "Generate a tizen symbol file" if [ -e ${TEMP_SYMBOLS_FILE} ] @@ -27,47 +44,68 @@ then rm ${TEMP_SYMBOLS_FILE} fi -while read line -do - if echo ${line} | grep -q ${DEFAULT_SYMBOLS_DEFINE}; - then - DEFAULT_SYMBOLS_SECTION=true - fi +if [ "${_light_keymap_mode}" == "true" ]; then + echo "// Tizen Standardized Keycodes" >> ${TEMP_SYMBOLS_FILE} + echo "partial alphanumeric_keys" >> ${TEMP_SYMBOLS_FILE} + echo "xkb_symbols \"tizen\" {" >> ${TEMP_SYMBOLS_FILE} + + while read KEYNAME KERNEL_KEYCODE OPTS + do + EXTRA_OPTS=", repeat=False" + [[ $OPTS == *"repeat"* ]] && EXTRA_OPTS=", repeat=True" + + KERNEL_KEYCODE=$(echo $(($KERNEL_KEYCODE+$PLATFORM_BASE_KEYCODE))) + KEYCODE="${KERNEL_KEYCODE}" + echo "key <I$KEYCODE> { [ ${KEYNAME} ] ${EXTRA_OPTS} };" >> ${TEMP_SYMBOLS_FILE} + done < ${KEYMAP_FILE_PATH} + + echo "};" >> ${TEMP_SYMBOLS_FILE} + + mv ${TEMP_SYMBOLS_FILE} ${SYMBOLS_PATH} +else + while read line + do + if echo ${line} | grep -q ${DEFAULT_SYMBOLS_DEFINE}; + then + DEFAULT_SYMBOLS_SECTION=true + fi - if [ "$DEFAULT_SYMBOLS_SECTION" = true ] - then - if [ "$line" = "};" ] + if [ "$DEFAULT_SYMBOLS_SECTION" = true ] then - DEFAULT_SYMBOLS_SECTION=false - else - echo "$line" >> ${TEMP_SYMBOLS_FILE} + if [ "$line" = "};" ] + then + DEFAULT_SYMBOLS_SECTION=false + else + echo "$line" >> ${TEMP_SYMBOLS_FILE} + fi fi - fi -done < ${SYMBOLS_PATH} - -echo "" >> ${TEMP_SYMBOLS_FILE} -echo "// Tizen common keys" >> ${TEMP_SYMBOLS_FILE} -while read KEYNAME KERNEL_KEYCODE OPTS -do - [[ $OPTS == *"keyboard"* ]] && continue - - EXTRA_OPTS=", repeat=False" - [[ $OPTS == *"repeat"* ]] && EXTRA_OPTS=", repeat=True" - - KERNEL_KEYCODE=$(echo $(($KERNEL_KEYCODE+$PLATFORM_BASE_KEYCODE))) - KEYCODE="${KERNEL_KEYCODE}" - echo "key <I$KEYCODE> { [ ${KEYNAME} ] ${EXTRA_OPTS} };" >> ${TEMP_SYMBOLS_FILE} -done < ${KEYMAP_FILE_PATH} -echo "};" >> ${TEMP_SYMBOLS_FILE} - -sed -i "s/${DEFAULT_SYMBOLS_NAME}/${NEW_SYMBOLS_NAME}/g" ${TEMP_SYMBOLS_FILE} -sed -i 's/Evdev/Tizen/g' ${TEMP_SYMBOLS_FILE} - -echo "" >> ${SYMBOLS_PATH} -echo "" >> ${SYMBOLS_PATH} -while read line -do - echo "$line" >> ${SYMBOLS_PATH} -done < ${TEMP_SYMBOLS_FILE} - -rm ${TEMP_SYMBOLS_FILE} + done < ${SYMBOLS_PATH} + + echo "" >> ${TEMP_SYMBOLS_FILE} + echo "// Tizen common keys" >> ${TEMP_SYMBOLS_FILE} + while read KEYNAME KERNEL_KEYCODE OPTS + do + [[ $OPTS == *"keyboard"* ]] && continue + + EXTRA_OPTS=", repeat=False" + [[ $OPTS == *"repeat"* ]] && EXTRA_OPTS=", repeat=True" + + KERNEL_KEYCODE=$(echo $(($KERNEL_KEYCODE+$PLATFORM_BASE_KEYCODE))) + KEYCODE="${KERNEL_KEYCODE}" + echo "key <I$KEYCODE> { [ ${KEYNAME} ] ${EXTRA_OPTS} };" >> ${TEMP_SYMBOLS_FILE} + done < ${KEYMAP_FILE_PATH} + + echo "};" >> ${TEMP_SYMBOLS_FILE} + sed -i "s/${DEFAULT_SYMBOLS_NAME}/${NEW_SYMBOLS_NAME}/g" ${TEMP_SYMBOLS_FILE} + sed -i 's/Evdev/Tizen/g' ${TEMP_SYMBOLS_FILE} + + echo "" >> ${SYMBOLS_PATH} + echo "" >> ${SYMBOLS_PATH} + + while read line + do + echo "$line" >> ${SYMBOLS_PATH} + done < ${TEMP_SYMBOLS_FILE} + + rm ${TEMP_SYMBOLS_FILE} +fi |