summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-02-10 09:02:09 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-02-10 09:34:05 +1000
commitc420ede301599fe8bd3c2c0f723515df87565c35 (patch)
tree1722f20089fa3b20a554d72a1590c5e21ac9272d
parent3cc9bd9d21120a5b16091734db33cd84831c7f38 (diff)
Standardise comment style (doxygen/javadoc).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--evtest.c48
1 files changed, 40 insertions, 8 deletions
diff --git a/evtest.c b/evtest.c
index 8671c07..fb09845 100644
--- a/evtest.c
+++ b/evtest.c
@@ -1,8 +1,15 @@
/*
* Copyright (c) 1999-2000 Vojtech Pavlik
* Copyright (c) 2009-2011 Red Hat, Inc
+ */
+
+/**
+ * @file
+ * Event device test program
*
- * Event device test program
+ * evtest prints the capabilities on the kernel devices in /dev/input/eventX
+ * and their events. Its primary purpose is for kernel or X driver
+ * debugging.
*
* See INSTALL for installation details or manually compile with
* gcc -o evtest evtest.c
@@ -426,12 +433,24 @@ char **names[EV_MAX + 1] = {
[EV_SND] = sounds, [EV_REP] = repeats,
};
-/* filter for the AutoDevProbe scandir on /dev/input */
+/**
+ * Filter for the AutoDevProbe scandir on /dev/input.
+ *
+ * @param dir The current directory entry provided by scandir.
+ *
+ * @return Non-zero if the given directory entry starts with "event", or zero
+ * otherwise.
+ */
static int EventDevOnly(const struct dirent *dir) {
return strncmp(EVENT_DEV_NAME, dir->d_name, 5) == 0;
}
-/* Scans all /dev/input/event* and returns the number of the one to open */
+/**
+ * Scans all /dev/input/event*, display them and ask the user which one to
+ * open.
+ *
+ * @return The event device number of the device file selected.
+ */
static int scan_devices(void)
{
struct dirent **namelist;
@@ -470,12 +489,21 @@ static int scan_devices(void)
return devnum;
}
+/**
+ * Print usage information.
+ */
static void usage(void)
{
printf("Usage: evtest /dev/input/eventX\n");
printf("Where X = input device number\n");
}
+/**
+ * Parse the commandline arguments.
+ *
+ * @return The filename of the device file to open, or NULL in case of
+ * error.
+ */
static char* parse_args(int argc, char **argv)
{
char *filename;
@@ -504,9 +532,11 @@ static char* parse_args(int argc, char **argv)
}
/**
- * Print static device information (no events).
+ * Print static device information (no events). This information includes
+ * version numbers, device name and all bits supported by this device.
*
- * Returns 0 on success or 1 otherwise.
+ * @param fd The file descriptor to the device.
+ * @return 0 on success or 1 otherwise.
*/
static int print_device_info(int fd)
{
@@ -557,9 +587,10 @@ static int print_device_info(int fd)
}
/**
- * Print device events.
+ * Print device events as they come in.
*
- * Returns 0 on success or 1 otherwise.
+ * @param fd The file descriptor to the device.
+ * @return 0 on success or 1 otherwise.
*/
static int print_events(int fd)
{
@@ -602,7 +633,8 @@ static int print_events(int fd)
/**
* Grab and immediately ungrab the device.
*
- * Returns 0 if the grab was successful, or 1 otherwise.
+ * @param fd The file descriptor to the device.
+ * @return 0 if the grab was successful, or 1 otherwise.
*/
static int test_grab(int fd)
{