| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# inputlircd -- zeroconf LIRC daemon that reads from /dev/input/event devices |
| 4 |
# Copyright (C) 2006-2009 Guus Sliepen <[email protected]> |
| 5 |
# |
| 6 |
# This program is free software; you can redistribute it and/or modify it |
| 7 |
# under the terms of version 2 of the GNU General Public License as published |
| 8 |
# by the Free Software Foundation. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 |
|
| 19 |
TYPES="KEY BTN" |
| 20 |
|
| 21 |
for type in $TYPES; do |
| 22 |
grep "^#define ${type}_" < $1 | sed 's/\/\*.*//g' |
| 23 |
done |
| 24 |
|
| 25 |
grep "^#define EV_KEY" < $1 | sed 's/\/\*.*//g' |
| 26 |
grep "^#define KEY_MAX" < $1 | sed 's/\/\*.*//g' |
| 27 |
|
| 28 |
echo "static const char *KEY_NAME[KEY_MAX] = {" |
| 29 |
for type in $TYPES; do |
| 30 |
awk " |
| 31 |
/EV_VERSION/ { next }; |
| 32 |
/_MAX/ { next }; |
| 33 |
/#define ${type}_/ { printf(\"\t[ %-16s ] = \\\"%s\\\",\n\", \$2, \$2); } |
| 34 |
" < $1 | tac |
| 35 |
done |
| 36 |
echo "};" |