summaryrefslogtreecommitdiff
path: root/make_symbols.sh
blob: 67040023fcced145eecf6c788b8c790bde99490e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh

if [ "$TZ_SYS_RO_SHARE" = "" ]; then
        TZ_SYS_RO_SHARE="/usr/share"
fi

SYMBOLS_PATH="./symbols/inet"
DEFAULT_SYMBOLS_NAME="evdev"
DEFAULT_SYMBOLS_DEFINE="Evdev"
NEW_SYMBOLS_NAME="tizen"
DEFAULT_SYMBOLS_SECTION=false
TEMP_SYMBOLS_FILE="./symbols/inet_tizen"
PLATFORM_BASE_KEYCODE=8

if [ -e ${KEYMAP_FILE_PATH} ]
then
	echo "We have a key layout file: ${KEYMAP_FILE_PATH}"
else
	echo "We don't have a key layout file: ${KEYMAP_FILE_PATH}"
	exit
fi

echo "Generate a tizen symbol file"

if [ -e ${TEMP_SYMBOLS_FILE} ]
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 [ "$DEFAULT_SYMBOLS_SECTION" = true ]
	then
		if [ "$line" = "};" ]
		then
			DEFAULT_SYMBOLS_SECTION=false
		else
			echo "$line" >> ${TEMP_SYMBOLS_FILE}
		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}