diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/input/evbug.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/input/evbug.c')
-rw-r--r-- | drivers/input/evbug.c | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/drivers/input/evbug.c b/drivers/input/evbug.c new file mode 100644 index 000000000000..d7828936fd8f --- /dev/null +++ b/drivers/input/evbug.c | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | * $Id: evbug.c,v 1.10 2001/09/25 10:12:07 vojtech Exp $ | ||
3 | * | ||
4 | * Copyright (c) 1999-2001 Vojtech Pavlik | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * Input driver event debug module - dumps all events into syslog | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2 of the License, or | ||
15 | * (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
25 | * | ||
26 | * Should you need to contact me, the author, you can do so either by | ||
27 | * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: | ||
28 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic | ||
29 | */ | ||
30 | |||
31 | #include <linux/slab.h> | ||
32 | #include <linux/module.h> | ||
33 | #include <linux/input.h> | ||
34 | #include <linux/init.h> | ||
35 | #include <linux/device.h> | ||
36 | |||
37 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | ||
38 | MODULE_DESCRIPTION("Input driver event debug module"); | ||
39 | MODULE_LICENSE("GPL"); | ||
40 | |||
41 | static char evbug_name[] = "evbug"; | ||
42 | |||
43 | static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) | ||
44 | { | ||
45 | printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", handle->dev->phys, type, code, value); | ||
46 | } | ||
47 | |||
48 | static struct input_handle *evbug_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id) | ||
49 | { | ||
50 | struct input_handle *handle; | ||
51 | |||
52 | if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL))) | ||
53 | return NULL; | ||
54 | memset(handle, 0, sizeof(struct input_handle)); | ||
55 | |||
56 | handle->dev = dev; | ||
57 | handle->handler = handler; | ||
58 | handle->name = evbug_name; | ||
59 | |||
60 | input_open_device(handle); | ||
61 | |||
62 | printk(KERN_DEBUG "evbug.c: Connected device: \"%s\", %s\n", dev->name, dev->phys); | ||
63 | |||
64 | return handle; | ||
65 | } | ||
66 | |||
67 | static void evbug_disconnect(struct input_handle *handle) | ||
68 | { | ||
69 | printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", handle->dev->phys); | ||
70 | |||
71 | input_close_device(handle); | ||
72 | |||
73 | kfree(handle); | ||
74 | } | ||
75 | |||
76 | static struct input_device_id evbug_ids[] = { | ||
77 | { .driver_info = 1 }, /* Matches all devices */ | ||
78 | { }, /* Terminating zero entry */ | ||
79 | }; | ||
80 | |||
81 | MODULE_DEVICE_TABLE(input, evbug_ids); | ||
82 | |||
83 | static struct input_handler evbug_handler = { | ||
84 | .event = evbug_event, | ||
85 | .connect = evbug_connect, | ||
86 | .disconnect = evbug_disconnect, | ||
87 | .name = "evbug", | ||
88 | .id_table = evbug_ids, | ||
89 | }; | ||
90 | |||
91 | static int __init evbug_init(void) | ||
92 | { | ||
93 | input_register_handler(&evbug_handler); | ||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | static void __exit evbug_exit(void) | ||
98 | { | ||
99 | input_unregister_handler(&evbug_handler); | ||
100 | } | ||
101 | |||
102 | module_init(evbug_init); | ||
103 | module_exit(evbug_exit); | ||