summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-01-25 17:23:20 +0000
committerLennart Poettering <lennart@poettering.net>2004-01-25 17:23:20 +0000
commitef3bc3e3aa0b9bf5129bdedf05402f289d768373 (patch)
tree893eb3a1766bc308988bcfaf42bd4929f8f66d56
parent51964b41b60bd6e20b94abca8987b2a73b9251f6 (diff)
initial commit
git-svn-id: file:///home/lennart/svn/public/keyfuzz/trunk@3 e03e4fad-c0d1-0310-aabf-8987f8117c4c
-rw-r--r--LICENSE340
-rw-r--r--Makefile.am40
-rwxr-xr-xbootstrap.sh45
-rw-r--r--conf/Makefile.am40
-rw-r--r--conf/default.keyfuzz515
-rwxr-xr-xconf/keyfuzz.init.in49
-rw-r--r--conf/medion_9580f.keyfuzz13
-rw-r--r--configure.ac145
-rw-r--r--doc/Makefile.am36
-rw-r--r--doc/README.html.in163
-rw-r--r--doc/style.css32
-rw-r--r--man/Makefile.am37
-rw-r--r--man/keyfuzz.8.xml.in106
-rw-r--r--man/xmltoman.css30
-rw-r--r--man/xmltoman.dtd39
-rw-r--r--man/xmltoman.xsl120
-rw-r--r--src/Makefile.am37
-rw-r--r--src/keyfuzz.c220
-rw-r--r--src/keyfuzz.ggo7
19 files changed, 2014 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d60c31a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program 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 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..9560ab5
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,40 @@
+# $Id$
+
+# This file is part of keyfuzz.
+#
+# keyfuzz 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 2 of the License, or
+# (at your option) any later version.
+#
+# keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+EXTRA_DIST=bootstrap.sh README LICENSE
+SUBDIRS=src conf man doc
+
+MAINTAINERCLEANFILES = README
+noinst_DATA = README
+
+README:
+ rm -f README
+ $(MAKE) -C doc README
+ cd $(srcdir) && ln -s doc/README README
+
+homepage:
+ test -d $$HOME/homepage/lennart
+ mkdir -p $$HOME/homepage/lennart/projects/keyfuzz
+ cp *.tar.gz $$HOME/homepage/lennart/projects/keyfuzz
+ cp man/keyfuzz.8.xml man/xmltoman.css man/xmltoman.xsl man/xmltoman.dtd doc/style.css doc/README.html $$HOME/homepage/lennart/projects/keyfuzz
+ cp $$HOME/homepage/lennart/projects/keyfuzz/README.html $$HOME/homepage/lennart/projects/keyfuzz/index.html
+
+distcleancheck:
+ @:
+
+.PHONY: homepage distcleancheck
diff --git a/bootstrap.sh b/bootstrap.sh
new file mode 100755
index 0000000..7eb124b
--- /dev/null
+++ b/bootstrap.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# $Id$
+
+# This file is part of keyfuzz.
+#
+# keyfuzz 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 2 of the License, or
+# (at your option) any later version.
+#
+# keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+run_versioned() {
+ local P
+ type -p "$1-$2" &> /dev/null && P="$1-$2" || local P="$1"
+
+ shift 2
+ "$P" "$@"
+}
+
+if [ "x$1" = "xam" ] ; then
+ set -ex
+ run_versioned automake 1.7 -a -c
+ ./config.status
+else
+ set -ex
+ rm -rf autom4te.cache
+ rm -f config.cache
+
+ run_versioned aclocal 1.7
+ autoheader
+ run_versioned automake 1.7 -a -c
+ autoconf -Wall
+
+ ./configure --sysconfdir=/etc "$@"
+
+ make clean
+fi
diff --git a/conf/Makefile.am b/conf/Makefile.am
new file mode 100644
index 0000000..0d9df15
--- /dev/null
+++ b/conf/Makefile.am
@@ -0,0 +1,40 @@
+# $Id$
+#
+# This file is part of keyfuzz.
+#
+# keyfuzz 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 2 of the License, or
+# (at your option) any later version.
+#
+# keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+pkgsysconfdir=$(sysconfdir)/@PACKAGE@
+sysinitdir=@SYSINITDIR@
+
+pkgsysconf_DATA = default.keyfuzz medion_9580f.keyfuzz
+noinst_DATA = keyfuzz.init
+
+EXTRA_DIST = $(pkgsysconf_DATA) keyfuzz.init.in
+CLEANFILES = keyfuzz.init
+
+if !NOINITSCRIPT
+
+install-data-local: keyfuzz.init
+ $(INSTALL) -b -D -m755 keyfuzz.init ${DESTDIR}${sysinitdir}/keyfuzz
+
+uninstall-local:
+ rm -f ${DESTDIR}${sysconfdir}/init.d/keyfuzz
+
+endif
+
+keyfuzz.init: keyfuzz.init.in Makefile
+ sed -e 's,@pkgsysconfdir\@,$(sysconfdir)/@PACKAGE@,g' -e 's,@sbindir\@,$(sbindir),g' $< > $@
+ chmod 755 $@
diff --git a/conf/default.keyfuzz b/conf/default.keyfuzz
new file mode 100644
index 0000000..7e5e534
--- /dev/null
+++ b/conf/default.keyfuzz
@@ -0,0 +1,515 @@
+### evdev 1.0.0., driver 'AT Translated Set 2 keyboard'
+0x000 0x000
+0x001 0x001
+0x002 0x002
+0x003 0x003
+0x004 0x004
+0x005 0x005
+0x006 0x006
+0x007 0x007
+0x008 0x008
+0x009 0x009
+0x00a 0x00a
+0x00b 0x00b
+0x00c 0x00c
+0x00d 0x00d
+0x00e 0x00e
+0x00f 0x00f
+0x010 0x010
+0x011 0x011
+0x012 0x012
+0x013 0x013
+0x014 0x014
+0x015 0x015
+0x016 0x016
+0x017 0x017
+0x018 0x018
+0x019 0x019
+0x01a 0x01a
+0x01b 0x01b
+0x01c 0x01c
+0x01d 0x01d
+0x01e 0x01e
+0x01f 0x01f
+0x020 0x020
+0x021 0x021
+0x022 0x022
+0x023 0x023
+0x024 0x024
+0x025 0x025
+0x026 0x026
+0x027 0x027
+0x028 0x028
+0x029 0x029
+0x02a 0x02a
+0x02b 0x02b
+0x02c 0x02c
+0x02d 0x02d
+0x02e 0x02e
+0x02f 0x02f
+0x030 0x030
+0x031 0x031
+0x032 0x032
+0x033 0x033
+0x034 0x034
+0x035 0x035
+0x036 0x036
+0x037 0x037
+0x038 0x038
+0x039 0x039
+0x03a 0x03a
+0x03b 0x03b
+0x03c 0x03c
+0x03d 0x03d
+0x03e 0x03e
+0x03f 0x03f
+0x040 0x040
+0x041 0x041
+0x042 0x042
+0x043 0x043
+0x044 0x044
+0x045 0x045
+0x046 0x046
+0x047 0x047
+0x048 0x048
+0x049 0x049
+0x04a 0x04a
+0x04b 0x04b
+0x04c 0x04c
+0x04d 0x04d
+0x04e 0x04e
+0x04f 0x04f
+0x050 0x050
+0x051 0x051
+0x052 0x052
+0x053 0x053
+0x054 0x063
+0x055 0x000
+0x056 0x056
+0x057 0x057
+0x058 0x058
+0x059 0x075
+0x05a 0x000
+0x05b 0x000
+0x05c 0x0ba
+0x05d 0x055
+0x05e 0x059
+0x05f 0x05a
+0x060 0x000
+0x061 0x000
+0x062 0x000
+0x063 0x000
+0x064 0x000
+0x065 0x000
+0x066 0x000
+0x067 0x000
+0x068 0x000
+0x069 0x000
+0x06a 0x000
+0x06b 0x000
+0x06c 0x000
+0x06d 0x000
+0x06e 0x000
+0x06f 0x000
+0x070 0x0b6
+0x071 0x000
+0x072 0x000
+0x073 0x0b5
+0x074 0x000
+0x075 0x000
+0x076 0x0c2
+0x077 0x0c1
+0x078 0x0c0
+0x079 0x0b8
+0x07a 0x000
+0x07b 0x0b9
+0x07c 0x000
+0x07d 0x0b6
+0x07e 0x07c
+0x07f 0x000
+0x080 0x000
+0x081 0x000
+0x082 0x000
+0x083 0x000
+0x084 0x000
+0x085 0x000
+0x086 0x000
+0x087 0x000
+0x088 0x000
+0x089 0x000
+0x08a 0x000
+0x08b 0x000
+0x08c 0x000
+0x08d 0x000
+0x08e 0x000
+0x08f 0x000
+0x090 0x0a5
+0x091 0x000
+0x092 0x000
+0x093 0x000
+0x094 0x000
+0x095 0x000
+0x096 0x000
+0x097 0x000
+0x098 0x000
+0x099 0x0a3
+0x09a 0x000
+0x09b 0x000
+0x09c 0x060
+0x09d 0x061
+0x09e 0x000
+0x09f 0x000
+0x0a0 0x071
+0x0a1 0x08c
+0x0a2 0x0a4
+0x0a3 0x000
+0x0a4 0x0a6
+0x0a5 0x000
+0x0a6 0x000
+0x0a7 0x000
+0x0a8 0x000
+0x0a9 0x000
+0x0aa 0x0ff
+0x0ab 0x000
+0x0ac 0x000
+0x0ad 0x000
+0x0ae 0x072
+0x0af 0x000
+0x0b0 0x073
+0x0b1 0x000
+0x0b2 0x096
+0x0b3 0x000
+0x0b4 0x000
+0x0b5 0x062
+0x0b6 0x0ff
+0x0b7 0x063
+0x0b8 0x064
+0x0b9 0x000
+0x0ba 0x000
+0x0bb 0x000
+0x0bc 0x000
+0x0bd 0x000
+0x0be 0x000
+0x0bf 0x000
+0x0c0 0x000
+0x0c1 0x000
+0x0c2 0x000
+0x0c3 0x000
+0x0c4 0x000
+0x0c5 0x077
+0x0c6 0x077
+0x0c7 0x066
+0x0c8 0x067
+0x0c9 0x068
+0x0ca 0x000
+0x0cb 0x069
+0x0cc 0x070
+0x0cd 0x06a
+0x0ce 0x076
+0x0cf 0x06b
+0x0d0 0x06c
+0x0d1 0x06d
+0x0d2 0x06e
+0x0d3 0x06f
+0x0d4 0x000
+0x0d5 0x000
+0x0d6 0x000
+0x0d7 0x000
+0x0d8 0x000
+0x0d9 0x000
+0x0da 0x000
+0x0db 0x07d
+0x0dc 0x07e
+0x0dd 0x07f
+0x0de 0x074
+0x0df 0x08e
+0x0e0 0x000
+0x0e1 0x000
+0x0e2 0x000
+0x0e3 0x08f
+0x0e4 0x000
+0x0e5 0x0d9
+0x0e6 0x09c
+0x0e7 0x0ad
+0x0e8 0x080
+0x0e9 0x09f
+0x0ea 0x09e
+0x0eb 0x09d
+0x0ec 0x09b
+0x0ed 0x0e2
+0x0ee 0x000
+0x0ef 0x070
+0x0f0 0x000
+0x0f1 0x000
+0x0f2 0x000
+0x0f3 0x000
+0x0f4 0x000
+0x0f5 0x000
+0x0f6 0x000
+0x0f7 0x000
+0x0f8 0x000
+0x0f9 0x000
+0x0fa 0x000
+0x0fb 0x000
+0x0fc 0x000
+0x0fd 0x000
+0x0fe 0x000
+0x0ff 0x000
+0x100 0x000
+0x101 0x000
+0x102 0x000
+0x103 0x000
+0x104 0x000
+0x105 0x000
+0x106 0x000
+0x107 0x000
+0x108 0x000
+0x109 0x000
+0x10a 0x000
+0x10b 0x000
+0x10c 0x000
+0x10d 0x000
+0x10e 0x000
+0x10f 0x000
+0x110 0x000
+0x111 0x000
+0x112 0x000
+0x113 0x000
+0x114 0x000
+0x115 0x000
+0x116 0x000
+0x117 0x000
+0x118 0x000
+0x119 0x000
+0x11a 0x000
+0x11b 0x000
+0x11c 0x000
+0x11d 0x000
+0x11e 0x000
+0x11f 0x000
+0x120 0x000
+0x121 0x000
+0x122 0x000
+0x123 0x000
+0x124 0x000
+0x125 0x000
+0x126 0x000
+0x127 0x000
+0x128 0x000
+0x129 0x000
+0x12a 0x000
+0x12b 0x000
+0x12c 0x000
+0x12d 0x000
+0x12e 0x000
+0x12f 0x000
+0x130 0x000
+0x131 0x000
+0x132 0x000
+0x133 0x000
+0x134 0x000
+0x135 0x000
+0x136 0x000
+0x137 0x000
+0x138 0x000
+0x139 0x000
+0x13a 0x000
+0x13b 0x000
+0x13c 0x000
+0x13d 0x000
+0x13e 0x000
+0x13f 0x000
+0x140 0x000
+0x141 0x000
+0x142 0x000
+0x143 0x000
+0x144 0x000
+0x145 0x000
+0x146 0x000
+0x147 0x000
+0x148 0x000
+0x149 0x000
+0x14a 0x000
+0x14b 0x000
+0x14c 0x000
+0x14d 0x000
+0x14e 0x000
+0x14f 0x000
+0x150 0x000
+0x151 0x000
+0x152 0x000
+0x153 0x000
+0x154 0x000
+0x155 0x000
+0x156 0x000
+0x157 0x000
+0x158 0x000
+0x159 0x000
+0x15a 0x000
+0x15b 0x000
+0x15c 0x000
+0x15d 0x000
+0x15e 0x000
+0x15f 0x000
+0x160 0x000
+0x161 0x000
+0x162 0x000
+0x163 0x000
+0x164 0x000
+0x165 0x000
+0x166 0x000
+0x167 0x000
+0x168 0x000
+0x169 0x000
+0x16a 0x000
+0x16b 0x000
+0x16c 0x000
+0x16d 0x000
+0x16e 0x000
+0x16f 0x000
+0x170 0x000
+0x171 0x000
+0x172 0x000
+0x173 0x000
+0x174 0x000
+0x175 0x000
+0x176 0x000
+0x177 0x000
+0x178 0x000
+0x179 0x000
+0x17a 0x000
+0x17b 0x000
+0x17c 0x000
+0x17d 0x000
+0x17e 0x000
+0x17f 0x000
+0x180 0x000
+0x181 0x000
+0x182 0x000
+0x183 0x000
+0x184 0x000
+0x185 0x000
+0x186 0x000
+0x187 0x000
+0x188 0x000
+0x189 0x000
+0x18a 0x000
+0x18b 0x000
+0x18c 0x000
+0x18d 0x000
+0x18e 0x000
+0x18f 0x000
+0x190 0x000
+0x191 0x000
+0x192 0x000
+0x193 0x000
+0x194 0x000
+0x195 0x000
+0x196 0x000
+0x197 0x000
+0x198 0x000
+0x199 0x000
+0x19a 0x000
+0x19b 0x000
+0x19c 0x000
+0x19d 0x000
+0x19e 0x000
+0x19f 0x000
+0x1a0 0x000
+0x1a1 0x000
+0x1a2 0x000
+0x1a3 0x000
+0x1a4 0x000
+0x1a5 0x000
+0x1a6 0x000
+0x1a7 0x000
+0x1a8 0x000
+0x1a9 0x000
+0x1aa 0x000
+0x1ab 0x000
+0x1ac 0x000
+0x1ad 0x000
+0x1ae 0x000
+0x1af 0x000
+0x1b0 0x000
+0x1b1 0x000
+0x1b2 0x000
+0x1b3 0x000
+0x1b4 0x000
+0x1b5 0x000
+0x1b6 0x000
+0x1b7 0x000
+0x1b8 0x000
+0x1b9 0x000
+0x1ba 0x000
+0x1bb 0x000
+0x1bc 0x000
+0x1bd 0x000
+0x1be 0x000
+0x1bf 0x000
+0x1c0 0x000
+0x1c1 0x000
+0x1c2 0x000
+0x1c3 0x000
+0x1c4 0x000
+0x1c5 0x000
+0x1c6 0x000
+0x1c7 0x000
+0x1c8 0x000
+0x1c9 0x000
+0x1ca 0x000
+0x1cb 0x000
+0x1cc 0x000
+0x1cd 0x000
+0x1ce 0x000
+0x1cf 0x000
+0x1d0 0x000
+0x1d1 0x000
+0x1d2 0x000
+0x1d3 0x000
+0x1d4 0x000
+0x1d5 0x000
+0x1d6 0x000
+0x1d7 0x000
+0x1d8 0x000
+0x1d9 0x000
+0x1da 0x000
+0x1db 0x000
+0x1dc 0x000
+0x1dd 0x000
+0x1de 0x000
+0x1df 0x000
+0x1e0 0x000
+0x1e1 0x000
+0x1e2 0x000
+0x1e3 0x000
+0x1e4 0x000
+0x1e5 0x000
+0x1e6 0x000
+0x1e7 0x000
+0x1e8 0x000
+0x1e9 0x000
+0x1ea 0x000
+0x1eb 0x000
+0x1ec 0x000
+0x1ed 0x000
+0x1ee 0x000
+0x1ef 0x000
+0x1f0 0x000
+0x1f1 0x000
+0x1f2 0x000
+0x1f3 0x000
+0x1f4 0x000
+0x1f5 0x000
+0x1f6 0x000
+0x1f7 0x000
+0x1f8 0x000
+0x1f9 0x000
+0x1fa 0x000
+0x1fb 0x000
+0x1fc 0x000
+0x1fd 0x000
+0x1fe 0x000
+0x1ff 0x000
+0x200 0x000
+### EOF
diff --git a/conf/keyfuzz.init.in b/conf/keyfuzz.init.in
new file mode 100755
index 0000000..0d908c8
--- /dev/null
+++ b/conf/keyfuzz.init.in
@@ -0,0 +1,49 @@
+#!/bin/bash
+# $Id$
+
+# This file is part of keyfuzz.
+#
+# keyfuzz 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 2 of the License, or (at your
+# option) any later version.
+#
+# keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+KEYFUZZ="@sbindir@/keyfuzz"
+test -x "$KEYFUZZ" || exit 0
+
+if [ `id -u` != "0" ] && [ "$1" = "start" -o "$1" = "stop" ] ; then
+ echo "You must be root to runkeyfuzz."
+ exit 1
+fi
+
+case "$1" in
+ start|reload|force-reload|restart)
+ echo -n "Loading input layer scancode tables: "
+ cd "@pkgsysconfdir@"
+ for E in event? ; do
+ if test -r "$E" ; then
+ "$KEYFUZZ" -s -d "$E" < "$E"
+ echo -n "$E "
+ fi
+ done
+ echo
+ ;;
+
+ stop)
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop|restart|reload|force-reload}"
+ exit 1
+esac
+
+exit 0
diff --git a/conf/medion_9580f.keyfuzz b/conf/medion_9580f.keyfuzz
new file mode 100644
index 0000000..6aba54b
--- /dev/null
+++ b/conf/medion_9580f.keyfuzz
@@ -0,0 +1,13 @@
+### keyfuzz file for the Medion 9580F special keys
+
+# Mail
+0x67 155
+
+# World Wide Web
+0x63 150
+
+# Program #1
+0x66 148
+
+# Program #2
+0x69 149
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..7bc18e7
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,145 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+# $Id$
+
+# This file is part of keyfuzz.
+#
+# keyfuzz 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 2 of the License, or
+# (at your option) any later version.
+#
+# keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+AC_PREREQ(2.59)
+AC_INIT([keyfuzz],[0.1],[mzxrlshmm (at) 0pointer (dot) de])
+AC_CONFIG_SRCDIR([src/keyfuzz.c])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([foreign -Wall])
+
+AC_SUBST(PACKAGE_URL, [http://0pointer.de/lennart/projects/keyfuzz/])
+
+if type -p stow > /dev/null && test -d /usr/local/stow ; then
+ AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
+ ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
+fi
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+# If using GCC specifiy some additional parameters
+if test "x$GCC" = "xyes" ; then
+ CFLAGS="$CFLAGS -pipe -Wall"
+fi
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/ioctl.h unistd.h linux/input.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_SIZE_T
+
+# Checks for library functions.
+AC_PROG_GCC_TRADITIONAL
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS([strchr strerror strspn])
+
+# Init script location
+AC_ARG_WITH(initdir, AS_HELP_STRING(--with-initdir=DIR,Install init script in DIR (system dependent default)))
+
+if test "x$with_initdir" = xno ; then
+ SYSINITDIR=no
+ AC_MSG_NOTICE([*** No init script will be installed ***])
+else
+ test "x$with_initdir" = xyes && with_initdir=
+
+ if test "x$with_initdir" = x ; then
+ if test -d /etc/init.d ; then
+ SYSINITDIR=/etc/init.d
+ else
+ if test -d /etc/rc.d/init.d ; then
+ SYSINITDIR=/etc/rc.d/init.d
+ else
+ AC_MSG_ERROR([missing --with-initdir=DIR])
+ fi
+ fi
+ else
+ SYSINITDIR="$with_initdir"
+ fi
+ AC_MSG_NOTICE([*** Init script will be installed in $SYSINITDIR ***])
+fi
+AC_SUBST(SYSINITDIR)
+AM_CONDITIONAL(NOINITSCRIPT, test x$SYSINITDIR = xno)
+
+# LYNX documentation generation
+AC_ARG_ENABLE(lynx,
+ AS_HELP_STRING(--disable-lynx,Turn off lynx usage for documentation generation),
+[case "${enableval}" in
+ yes) lynx=yes ;;
+ no) lynx=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --disable-lynx) ;;
+esac],[lynx=yes])
+
+if test x$lynx = xyes ; then
+ AC_CHECK_PROG(have_lynx, lynx, yes, no)
+
+ if test x$have_lynx = xno ; then
+ AC_MSG_ERROR([*** Sorry, you have to install lynx or use --disable-lynx ***])
+ fi
+fi
+
+AM_CONDITIONAL([USE_LYNX], [test "x$lynx" = xyes])
+
+# XMLTOMAN manpage generation
+AC_ARG_ENABLE(xmltoman,
+ AS_HELP_STRING(--disable-xmltoman,Disable rebuilding of man pages with xmltoman),
+[case "${enableval}" in
+ yes) xmltoman=yes ;;
+ no) xmltoman=no ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --disable-xmltoman]) ;;
+esac],[xmltoman=yes])
+
+if test x$xmltoman = xyes ; then
+ AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no)
+
+ if test x$have_xmltoman = xno ; then
+ AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***])
+ xmltoman=no
+ fi
+fi
+
+AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes])
+
+# gengetopt command line parser generation
+AC_ARG_ENABLE(gengetopt,
+ AS_HELP_STRING(--disable-gengetopt,Disable rebuilding of command line parser with gengetopt),
+[case "${enableval}" in
+ yes) gengetopt=yes ;;
+ no) gengetopt=no ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --disable-gengetopt]) ;;
+esac],[gengetopt=yes])
+
+if test x$gengetopt = xyes ; then
+ AC_CHECK_PROG(have_gengetopt, gengetopt, yes, no)
+
+ if test x$have_gengetopt = xno ; then
+ AC_MSG_WARN([*** Not rebuilding command line parser as gengetopt is not found ***])
+ gengetopt=no
+ fi
+fi
+
+AM_CONDITIONAL([USE_GENGETOPT], [test "x$gengetopt" = xyes])
+
+AC_CONFIG_FILES([src/Makefile Makefile conf/Makefile man/Makefile doc/Makefile doc/README.html])
+AC_OUTPUT
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..52c789e
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,36 @@
+# $Id$
+
+# This file is part of keyfuzz.
+#
+# keyfuzz 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 2 of the License, or
+# (at your option) any later version.
+#
+# keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+noinst_DATA = README.html README
+EXTRA_DIST = $(noinst_DATA) style.css README.html.in NEWDRIVERS
+
+MAINTAINERCLEANFILES = README README.html
+CLEANFILES =
+
+if USE_LYNX
+README: README.html
+ lynx --dump $^ | sed 's,file://localhost/.*/doc/README.html,README,' > $@
+
+CLEANFILES += README
+endif
+
+tidy: README.html
+ tidy -e < README.html
+
+.PHONY: tidy
+
diff --git a/doc/README.html.in b/doc/README.html.in
new file mode 100644
index 0000000..6795046
--- /dev/null
+++ b/doc/README.html.in
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="iso-8859-1"?> <!-- -*-html-helper-*- -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<title>keyfuzz @PACKAGE_VERSION@</title>
+<link rel="stylesheet" type="text/css" href="style.css" />
+</head>
+
+<body>
+<h1><a name="top">keyfuzz @PACKAGE_VERSION@</a></h1>
+
+<p><i>Copyright 2004 Lennart Poettering &lt;@PACKAGE_BUGREPORT@&gt;</i></p>
+
+<ul class="toc">
+ <li><a href="#license">License</a></li>
+ <li><a href="#news">News</a></li>
+ <li><a href="#overview">Overview</a></li>
+ <li><a href="#status">Status</a></li>
+ <li><a href="#documentation">Documentation</a></li>
+ <li><a href="#requirements">Requirements</a></li>
+ <li><a href="#installation">Installation</a></li>
+ <li><a href="#acks">Acknowledgements</a></li>
+ <li><a href="#download">Download</a></li>
+</ul>
+
+<h2><a name="license">License</a></h2>
+
+<p>This program 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 2 of the
+License, or (at your option) any later version.</p>
+
+<p>This program 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.</p>
+
+<p>You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</p>
+
+<h2><a name="news">News</a></h2>
+
+<div class="news-date">Sun Jan 25 2004: </div>
+
+<p class="news-text"><a href="@PACKAGE_URL@keyfuzz-0.1.tar.gz">Version 0.1</a> released, initial release.</b></p>
+
+<h2><a name="overview">Overview</a></h2>
+
+<p>You may use <tt>keyfuzz</tt> to manipulate the scancode/keycode
+translation tables of keyboard drivers supporting the Linux input
+layer API (as included in Linux 2.6). This is useful for fixing the
+translation tables of multimedia keyboards or laptop keyboards with
+special keys. <tt>keyfuzz</tt> is not a daemon like Gnome
+<tt>acme</tt> which reacts on special hotkeys but a tool to make
+non-standard keyboards compatible with such daemons. <tt>keyfuzz</tt>
+should be run once at boot time, the modifications it makes stay
+active after the tool quits until reboot. <tt>keyfuzz</tt> does not interact
+directly with XFree86. However, newer releases of the latter (4.1 and
+above) rely on the Linux input API, so they take advantage of the
+fixed translation tables.</p>
+
+<p>The distribution includes a scancode table for the Medion 9580F
+laptop, which maps the four special keys to XFree86 compatible
+keycodes.</p>
+
+<h2><a name="status">Status</a></h2>
+
+<p>Version @PACKAGE_VERSION@ is more or less stable and feature complete.</p>
+
+<h2><a name="documentation">Documentation</a></h2>
+
+<p>Have a look on the man page <a href="@PACKAGE_URL@keyfuzz.8.xml"><tt>keyfuzz(8)</tt></a>. (An XSLT capable browser is required)</p>
+
+<p>Scancode tables assign scancodes to keycodes. If you don't now what
+scancodes or keycodes are, read about it in the relevant HOWTOs or FAQs
+available from the <a href="http://www.tldp.org/">Linux
+Documentation Project</a>.</p>
+
+<p>The primary target of <tt>keyfuzz</tt> is to patch scancode/keycode
+definitions for special multimedia keys into the current scancode
+table of a device. An example for such a patch table is the following
+file <tt>medion_9580f.keyfuzz</tt>, which is relevant for the Medion
+9580F laptop which has four special multimedia keys:</p>
+
+<pre># Mail
+0x67 155
+
+# World Wide Web
+0x63 150
+
+# Program #1
+0x66 148
+
+# Program #2
+0x69 149
+</pre>
+
+<p>Activate this file with the following command:</p>
+
+<pre>keyfuzz -s < medion_9580f.keyfuzz</pre>
+
+<p>This assigns the scancode <tt>0x67</tt> to the keycode <tt>155</tt>
+and so on. For a list of available keycodes have look on the
+<tt>KEY_xxx</tt> constant definitions in <tt>/usr/include/linux/input.h</tt>. The
+scancodes are keyboard specific. You may use the (console specific)
+utility <tt>showkey(1)</tt> to examine the scancode/keycode of a
+key. Another way to get the scancodes of special keys is to look for
+kernel debug messages like these if you press the relevant keys:</p>
+
+<pre>atkbd.c: Unknown key pressed (translated set 2, code 0x66 on isa0060/serio0).
+atkbd.c: Unknown key released (translated set 2, code 0x66 on isa0060/serio0).</pre>
+
+<p>Feel free to to send me patch tables for your hardware. I'll add them to my to distribution.</p>
+
+<p>The <tt>keyfuzz</tt> distribution includes a SysV init script which
+runs <tt>keyfuzz -s</tt> for all configured input devices depending on
+files or symbolics links named after the devices in
+<tt>/etc/keyfuzz</tt>. If you want to use this script, just create a symlink
+<tt>/etc/keyfuzz/event0</tt> to a scancode table file
+(e.g. <tt>/etc/keyfuzz/medion_9580f.keyfuzz</tt>). The scancode
+table of the device <tt>/dev/input/event0</tt> is modified according
+to the contents of that file on each boot:</p>
+
+<pre>cd /etc/keyfuzz
+ln -s medion_9580f.keyfuzz event0</pre>
+
+<p>The virtual file <tt>/proc/bus/input/devices</tt> lists all available input devices.</p>
+
+<h2><a name="requirements">Requirements</a></h2>
+
+<p><tt>keyfuzz</tt> requires a kernel supporting the Linux input layer, such as 2.6.1.</p>
+
+<h2><a name="installation">Installation</a></h2>
+
+<p>As this package is made with the GNU <tt>autotools</tt> you should run
+<tt>./configure</tt> inside the distribution directory for configuring
+the source tree. After that you should run <tt>make</tt> for
+compilation and <tt>make install</tt> (as root) for installation of
+<tt>keyfuzz</tt>.</p>
+
+<h2><a name="acks">Acknowledgements</a></h2>
+
+<p>None so far</p>
+
+<h2><a name="download">Download</a></h2>
+
+<p>The newest release is always available from <a href="@PACKAGE_URL@">@PACKAGE_URL@</a></p>
+
+<p>The current release is <a href="@PACKAGE_URL@keyfuzz-@PACKAGE_VERSION@.tar.gz">@PACKAGE_VERSION@</a></p>
+
+<p>Get <tt>keyfuzz</tt>'s development sources from the <a href="http://subversion.tigris.org/">Subversion</a> <a href="https://seth.intheinter.net:8081/svn/keyfuzz/">repository</a>.</p>
+
+<p>If you want to be notified whenever I release a new version of this software use the subscription feature of <a href="http://freshmeat.net/projects/keyfuzz/">Freshmeat</a>.</p>
+
+<hr/>
+<address class="grey">Lennart Poettering &lt;@PACKAGE_BUGREPORT@&gt;, January 2004</address>
+
+<div class="grey"><i>$Id$</i></div>
+
+</body>
+</html>
diff --git a/doc/style.css b/doc/style.css
new file mode 100644
index 0000000..997129d
--- /dev/null
+++ b/doc/style.css
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/***
+ * This file is part of keyfuzz.
+ *
+ * keyfuzz 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ ***/
+
+body { color: black; background-color: white; margin: 0.5cm; }
+a:link, a:visited { color: #900000; }
+p { margin-left: 0.5cm; margin-right: 0.5cm; }
+div.news-date { margin-left: 0.5cm; font-size: 80%; color: #4f0000; }
+p.news-text { margin-left: 1cm; }
+h1 { color: #00009F; }
+h2 { color: #00009F; }
+h3 { color: #00004F; margin-left: 0.5cm; }
+ul { margin-left: .5cm; }
+ol { margin-left: .5cm; }
+pre { margin-left: .5cm; background-color: #f0f0f0; padding: 0.4cm;}
+.grey { color: #afafaf; }
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100644
index 0000000..17b9bc6
--- /dev/null
+++ b/man/Makefile.am
@@ -0,0 +1,37 @@
+# $Id$
+
+# This file is part of keyfuzz.
+#
+# keyfuzz 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 2 of the License, or
+# (at your option) any later version.
+#
+# keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+man_MANS = keyfuzz.8
+
+noinst_DATA = keyfuzz.8.xml
+
+EXTRA_DIST = $(man_MANS) keyfuzz.8.xml.in xmltoman.css xmltoman.xsl xmltoman.dtd
+
+CLEANFILES = keyfuzz.8.xml
+
+keyfuzz.8.xml: keyfuzz.8.xml.in Makefile
+ sed -e 's,@sysconfdir\@,$(sysconfdir),g' -e 's,@sbindir\@,$(sbindir),g' -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
+
+if USE_XMLTOMAN
+
+CLEANFILES += $(man_MANS)
+
+keyfuzz.8: keyfuzz.8.xml Makefile
+ xmltoman $< > $@
+
+endif
diff --git a/man/keyfuzz.8.xml.in b/man/keyfuzz.8.xml.in
new file mode 100644
index 0000000..60a3180
--- /dev/null
+++ b/man/keyfuzz.8.xml.in
@@ -0,0 +1,106 @@
+<?xml version="1.0" standalone='no'?> <!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!-- $Id$ -->
+
+<!--
+ This file is part of keyfuzz.
+
+ keyfuzz 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 2 of the License, or (at your
+ option) any later version.
+
+ keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+-->
+
+ <manpage name="keyfuzz" section="8" desc="Modify keyboard scancode tables of the Linux input layer">
+
+ <synopsis>
+ <cmd>keyfuzz [<arg>options</arg>]</cmd>
+ </synopsis>
+
+ <description>
+
+ <p>You may use keyfuzz to manipulate the scancode/keycode
+ translation tables of keyboard drivers supporting the Linux
+ input layer API. ("evdev API") </p>
+
+ </description>
+
+ <options>
+
+ <option>
+ <p><opt>-g | --get</opt></p>
+ <optdesc><p>Dump the current scancode translation table of the device to STDOUT.</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-s | --set</opt></p>
+ <optdesc><p>Merge the translation table passed through STDIN into the current translation table of the device.</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-i | --info</opt></p>
+ <optdesc><p>Show some information about the specified device.</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-d | --device=</opt>DEVICE</p>
+ <optdesc><p>Use the specified event device. The virtual file
+ /proc/bus/input/devices lists all input devices available on
+ the local system. (Default: /dev/input/event0)</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-v | --vebose</opt></p>
+ <optdesc><p>Enable verbose mode. If used together with <opt>--set</opt> all translation tables changes are printed to STDERR.</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-h | --help</opt></p>
+ <optdesc><p>Show help</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-v | --version</opt></p>
+ <optdesc><p>Show version</p></optdesc>
+ </option>
+
+ </options>
+
+ <section name="Translation tables">
+ <p>The scancode/keycode translation tables as read from STDIN or
+ written to STDOUT are formatted as follows: lines beginning with
+ a hashmark and empty lines are ignored. All other lines have to
+ contain a scancode and a keycode number separated by white
+ space. The numbers may be specified either in decimal or in
+ hexadecimal notation. In the latter case, a 0x as to be
+ prepended. You may save the current table by passing
+ <opt>--get</opt> to keyfuzz and storing its output in a
+ file. Then, you may restore the table by passing the contents of
+ that file back to keyfuzz with <opt>--set</opt>.</p>
+ </section>
+
+ <section name="Author">
+ <p>keyfuzz was written by Lennart Poettering
+ &lt;@PACKAGE_BUGREPORT@&gt;. keyfuzz is available
+ at <url
+ href="@PACKAGE_URL@"/>
+ </p>
+ </section>
+
+ <section name="Comments">
+ <p>This man page was written using <manref name="xmltoman" section="1"
+ href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
+ </section>
+
+ </manpage>
diff --git a/man/xmltoman.css b/man/xmltoman.css
new file mode 100644
index 0000000..9ff836c
--- /dev/null
+++ b/man/xmltoman.css
@@ -0,0 +1,30 @@
+/* $Id$ */
+
+/***
+ This file is part of keyfuzz.
+
+ keyfuzz 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 2 of the License, or (at your
+ option) any later version.
+
+ keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+***/
+
+body { color: black; background-color: white; margin: 0.5cm; }
+a:link, a:visited { color: #900000; }
+h1 { text-transform:uppercase; font-size: 18pt; color: #00009F; }
+p { margin-left:1cm; margin-right:1cm; }
+.cmd { font-family:monospace; }
+.file { font-family:monospace; }
+.arg { text-transform:uppercase; font-family:monospace; font-style: italic; }
+.opt { font-family:monospace; font-weight: bold; }
+.manref { font-family:monospace; }
+.option .optdesc { margin-left:2cm; }
diff --git a/man/xmltoman.dtd b/man/xmltoman.dtd
new file mode 100644
index 0000000..f2ce548
--- /dev/null
+++ b/man/xmltoman.dtd
@@ -0,0 +1,39 @@
+<!-- $Id$ -->
+
+<!--
+ This file is part of keyfuzz.
+
+ keyfuzz 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 2 of the License, or (at your
+ option) any later version.
+
+ keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+-->
+
+<!ELEMENT manpage (synopsis | description | section | options | seealso)*>
+<!ATTLIST manpage name CDATA #REQUIRED section CDATA #REQUIRED desc CDATA #IMPLIED>
+<!ELEMENT arg (#PCDATA)>
+<!ELEMENT p (#PCDATA | arg | url | manref | opt | file )*>
+<!ELEMENT synopsis (cmd | p)+>
+<!ELEMENT description (p)+>
+<!ELEMENT section (p | option)*>
+<!ATTLIST section name CDATA #REQUIRED>
+<!ELEMENT option (#PCDATA | p | optdesc)*>
+<!ELEMENT optdesc (#PCDATA | p )*>
+<!ELEMENT cmd (#PCDATA | arg)*>
+<!ELEMENT options (p | option)*>
+<!ELEMENT seealso (p)*>
+<!ELEMENT opt (#PCDATA)>
+<!ELEMENT file (#PCDATA)>
+<!ELEMENT manref EMPTY>
+<!ATTLIST manref name CDATA #REQUIRED section CDATA #REQUIRED href CDATA #IMPLIED>
+<!ELEMENT url EMPTY>
+<!ATTLIST url href CDATA #REQUIRED>
diff --git a/man/xmltoman.xsl b/man/xmltoman.xsl
new file mode 100644
index 0000000..10ad607
--- /dev/null
+++ b/man/xmltoman.xsl
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
+
+<!--
+ This file is part of keyfuzz.
+
+ keyfuzz 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 2 of the License, or (at your
+ option) any later version.
+
+ keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+-->
+
+<xsl:template match="/manpage">
+ <xsl:text disable-output-escaping="yes">
+ &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
+ </xsl:text>
+ <html>
+
+ <head>
+ <title>
+ <xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)
+ </title>
+ <link rel="stylesheet" type="text/css" href="xmltoman.css"/>
+ </head>
+ <body>
+ <h1>Name</h1>
+ <p><xsl:value-of select="@name"/>
+ <xsl:if test="string-length(@desc) &gt; 0">
+ - <xsl:value-of select="@desc"/>
+ </xsl:if>
+ </p>
+ <xsl:apply-templates />
+ </body>
+ </html>
+</xsl:template>
+
+<xsl:template match="p">
+ <p>
+ <xsl:apply-templates/>
+ </p>
+</xsl:template>
+
+<xsl:template match="cmd">
+ <p class="cmd">
+ <xsl:apply-templates/>
+ </p>
+</xsl:template>
+
+<xsl:template match="arg">
+ <span class="arg"><xsl:apply-templates/></span>
+</xsl:template>
+
+<xsl:template match="opt">
+ <span class="opt"><xsl:apply-templates/></span>
+</xsl:template>
+
+<xsl:template match="file">
+ <span class="file"><xsl:apply-templates/></span>
+</xsl:template>
+
+<xsl:template match="optdesc">
+ <div class="optdesc">
+ <xsl:apply-templates/>
+ </div>
+</xsl:template>
+
+<xsl:template match="synopsis">
+ <h1>Synopsis</h1>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="seealso">
+ <h1>Synopsis</h1>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="description">
+ <h1>Description</h1>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="options">
+ <h1>Options</h1>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="section">
+ <h1><xsl:value-of select="@name"/></h1>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="option">
+ <div class="option"><xsl:apply-templates/></div>
+</xsl:template>
+
+<xsl:template match="manref">
+ <xsl:choose>
+ <xsl:when test="string-length(@href) &gt; 0">
+ <a class="manref"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</a>
+ </xsl:when>
+ <xsl:otherwise>
+ <span class="manref"><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</span>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="url">
+ <a class="url"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@href"/></a>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..c0b154a
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,37 @@
+# $Id$
+#
+# This file is part of keyfuzz.
+#
+# keyfuzz 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 2 of the License, or
+# (at your option) any later version.
+#
+# keyfuzz 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 keyfuzz; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+sbin_PROGRAMS = keyfuzz
+
+keyfuzz_SOURCES = keyfuzz.c cmdline.c cmdline.h
+keyfuzz_CFLAGS = $(AM_CFLAGS) -DPKGSYSCONFDIR="\"${sysconfdir}/@PACKAGE@\""
+
+EXTRA_DIST = keyfuzz.ggo
+MAINTAINERCLEANFILES =
+BUILT_SOURCES =
+CLEANFILES =
+
+if USE_GENGETOPT
+
+CLEANFILES += cmdline.c cmdline.h
+BUILT_SOURCES += cmdline.c cmdline.h
+
+cmdline.c cmdline.h: keyfuzz.ggo Makefile
+ gengetopt < $<
+
+endif
diff --git a/src/keyfuzz.c b/src/keyfuzz.c
new file mode 100644
index 0000000..e2857ba
--- /dev/null
+++ b/src/keyfuzz.c
@@ -0,0 +1,220 @@
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <limits.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/input.h>
+
+#include "cmdline.h"
+
+#define MAX_SCANCODES 1024
+
+static struct gengetopt_args_info args;
+
+int evdev_open(const char *dev) {
+ int fd;
+ char fn[PATH_MAX];
+
+ if (!strchr(dev, '/')) {
+ snprintf(fn, sizeof(fn), "/dev/input/%s", dev);
+ dev = fn;
+ }
+
+ if ((fd = open(dev, O_RDWR)) < 0) {
+ fprintf(stderr, "open('%s'): %s\n", dev, strerror(errno));
+ return -1;
+ }
+
+ return fd;
+}
+
+int evdev_driver_version(int fd, char *v, size_t l) {
+ int version;
+
+ if (ioctl(fd, EVIOCGVERSION, &version)) {
+ fprintf(stderr, "EVIOCGVERSION: %s\n", strerror(errno));
+ return -1;
+ }
+
+ snprintf(v, l,
+ "%i.%i.%i.",
+ version >> 16,
+ (version >> 8) & 0xff,
+ version & 0xff);
+
+ return 0;
+}
+
+int evdev_device_name(int fd, char *n, size_t l) {
+
+ if (ioctl(fd, EVIOCGNAME(l), n) < 0) {
+ fprintf(stderr, "EVIOCGNAME: %s\n", strerror(errno));
+ return -1;
+ }
+
+ return 0;
+}
+
+int evdev_get_keycode(int fd, int scancode, int e) {
+ int codes[2];
+
+ codes[0] = scancode;
+ if (ioctl(fd, EVIOCGKEYCODE, codes) < 0) {
+ if (e && errno == EINVAL)
+ return -2;
+ else {
+ fprintf(stderr, "EVIOCGKEYCODE: %s\n", strerror(errno));
+ return -1;
+ }
+ }
+
+ return codes[1];
+}
+
+int evdev_set_keycode(int fd, int scancode, int keycode) {
+ int codes[2];
+
+ codes[0] = scancode;
+ codes[1] = keycode;
+
+ if (ioctl(fd, EVIOCSKEYCODE, codes) < 0) {
+ fprintf(stderr, "EVIOCSKEYCODE: %s\n", strerror(errno));
+ return -1;
+ }
+
+ return 0;
+}
+
+int print_info(int fd) {
+ char version[256], name[256];
+ int r = -1;
+
+ if (evdev_driver_version(fd, version, sizeof(version)) < 0)
+ goto fail;
+
+ if (evdev_device_name(fd, name, sizeof(name)) < 0)
+ goto fail;
+
+ printf("evdev driver version %s\n"
+ "device name: %s\n",
+ version, name);
+
+ r = 0;
+
+fail:
+ return r;
+}
+
+int dump_table(int fd) {
+ char version[256], name[256];
+ int scancode, r = -1;
+
+ if (evdev_driver_version(fd, version, sizeof(version)) < 0)
+ goto fail;
+
+ if (evdev_device_name(fd, name, sizeof(name)) < 0)
+ goto fail;
+
+ printf("### evdev %s, driver '%s'\n", version, name);
+
+ r = 0;
+
+ for (scancode = 0; scancode < MAX_SCANCODES; scancode++) {
+ int keycode;
+
+ if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) {
+ if (keycode != -2)
+ r = -1;
+
+ break;
+ }
+
+ printf("0x%03x\t0x%03x\n", scancode, keycode);
+ }
+
+ if (!r)
+ printf("### EOF\n");
+
+fail:
+ return r;
+}
+
+int merge_table(int fd) {
+ int r = -1;
+ int line = 0;
+
+ while (!feof(stdin)) {
+ char s[256], *p;
+ int scancode, new_keycode, old_keycode;
+
+ if (!fgets(s, sizeof(s), stdin))
+ break;
+
+ line++;
+
+ p = s+strspn(s, "\t ");
+
+ if (*p == '#' || *p == '\n')
+ continue;
+
+ if (sscanf(p, "%i %i", &scancode, &new_keycode) != 2) {
+ fprintf(stderr, "Parse failure at line %i\n", line);
+ goto fail;
+ }
+
+ if ((old_keycode = evdev_get_keycode(fd, scancode, 0)) < 0)
+ goto fail;
+
+ if (evdev_set_keycode(fd, scancode, new_keycode) < 0)
+ goto fail;
+
+ if (args.verbose_flag && new_keycode != old_keycode)
+ fprintf(stderr, "Remapped scancode 0x%02x to 0x%02x. (prior: 0x%02x)\n", scancode, new_keycode, old_keycode);
+ }
+
+ r = 0;
+
+fail:
+
+ return r;
+}
+
+int main(int argc, char *argv[]) {
+ int fd = -1, r = 1;
+
+ cmdline_parser(argc, argv, &args);
+
+ if (!args.get_flag && !args.set_flag && !args.info_flag) {
+ cmdline_parser_print_help();
+ goto fail;
+ }
+
+ if ((fd = evdev_open(args.device_arg ? args.device_arg : "event0")) < 0)
+ goto fail;
+
+ if (args.get_flag) {
+
+ if (dump_table(fd) < 0)
+ goto fail;
+
+ } else if (args.set_flag) {
+
+ if (merge_table(fd) < 0)
+ goto fail;
+
+ } else if (args.info_flag) {
+
+ if (print_info(fd) < 0)
+ goto fail;
+ }
+
+ r = 0;
+
+fail:
+ if (fd >= 0)
+ close(fd);
+
+ return r;
+}
diff --git a/src/keyfuzz.ggo b/src/keyfuzz.ggo
new file mode 100644
index 0000000..8e66e1c
--- /dev/null
+++ b/src/keyfuzz.ggo
@@ -0,0 +1,7 @@
+purpose "Linux input layer scancode remapper"
+
+option "set" s "Set/merge the maping table" flag off
+option "get" g "Get the key mapping table" flag off
+option "info" i "Show driver information" flag off
+option "device" d "Specify the device to use" string no
+option "verbose" v "Enable verbose mode" flag off