summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/input/input-programming.txt125
-rw-r--r--arch/mips/cobalt/Makefile2
-rw-r--r--arch/mips/cobalt/buttons.c54
-rw-r--r--drivers/char/keyboard.c101
-rw-r--r--drivers/input/Makefile1
-rw-r--r--drivers/input/evbug.c32
-rw-r--r--drivers/input/evdev.c233
-rw-r--r--drivers/input/input.c266
-rw-r--r--drivers/input/joydev.c185
-rw-r--r--drivers/input/joystick/a3d.c9
-rw-r--r--drivers/input/joystick/adi.c9
-rw-r--r--drivers/input/joystick/analog.c9
-rw-r--r--drivers/input/joystick/cobra.c9
-rw-r--r--drivers/input/joystick/db9.c7
-rw-r--r--drivers/input/joystick/gamecon.c7
-rw-r--r--drivers/input/joystick/gf2k.c10
-rw-r--r--drivers/input/joystick/grip.c9
-rw-r--r--drivers/input/joystick/grip_mp.c11
-rw-r--r--drivers/input/joystick/guillemot.c9
-rw-r--r--drivers/input/joystick/iforce/iforce-ff.c10
-rw-r--r--drivers/input/joystick/iforce/iforce-main.c26
-rw-r--r--drivers/input/joystick/iforce/iforce-packets.c22
-rw-r--r--drivers/input/joystick/iforce/iforce-serio.c2
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c13
-rw-r--r--drivers/input/joystick/iforce/iforce.h2
-rw-r--r--drivers/input/joystick/interact.c8
-rw-r--r--drivers/input/joystick/magellan.c3
-rw-r--r--drivers/input/joystick/sidewinder.c9
-rw-r--r--drivers/input/joystick/spaceball.c3
-rw-r--r--drivers/input/joystick/spaceorb.c3
-rw-r--r--drivers/input/joystick/stinger.c3
-rw-r--r--drivers/input/joystick/tmdc.c9
-rw-r--r--drivers/input/joystick/turbografx.c7
-rw-r--r--drivers/input/joystick/twidjoy.c4
-rw-r--r--drivers/input/joystick/warrior.c3
-rw-r--r--drivers/input/keyboard/Kconfig9
-rw-r--r--drivers/input/keyboard/Makefile1
-rw-r--r--drivers/input/keyboard/aaed2000_kbd.c9
-rw-r--r--drivers/input/keyboard/atkbd.c7
-rw-r--r--drivers/input/keyboard/corgikbd.c3
-rw-r--r--drivers/input/keyboard/gpio_keys.c22
-rw-r--r--drivers/input/keyboard/hil_kbd.c89
-rw-r--r--drivers/input/keyboard/hilkbd.c6
-rw-r--r--drivers/input/keyboard/lkkbd.c7
-rw-r--r--drivers/input/keyboard/locomokbd.c2
-rw-r--r--drivers/input/keyboard/newtonkbd.c3
-rw-r--r--drivers/input/keyboard/omap-keypad.c3
-rw-r--r--drivers/input/keyboard/pxa27x_keyboard.c258
-rw-r--r--drivers/input/keyboard/spitzkbd.c3
-rw-r--r--drivers/input/keyboard/stowaway.c3
-rw-r--r--drivers/input/keyboard/sunkbd.c8
-rw-r--r--drivers/input/keyboard/xtkbd.c3
-rw-r--r--drivers/input/misc/Kconfig23
-rw-r--r--drivers/input/misc/Makefile2
-rw-r--r--drivers/input/misc/cobalt_btns.c172
-rw-r--r--drivers/input/misc/input-polldev.c171
-rw-r--r--drivers/input/misc/ixp4xx-beeper.c11
-rw-r--r--drivers/input/misc/m68kspkr.c2
-rw-r--r--drivers/input/misc/pcspkr.c2
-rw-r--r--drivers/input/misc/sparcspkr.c6
-rw-r--r--drivers/input/misc/uinput.c10
-rw-r--r--drivers/input/misc/wistron_btns.c685
-rw-r--r--drivers/input/mouse/Kconfig61
-rw-r--r--drivers/input/mouse/Makefile8
-rw-r--r--drivers/input/mouse/alps.c13
-rw-r--r--drivers/input/mouse/alps.h18
-rw-r--r--drivers/input/mouse/hil_ptr.c97
-rw-r--r--drivers/input/mouse/lifebook.c195
-rw-r--r--drivers/input/mouse/lifebook.h11
-rw-r--r--drivers/input/mouse/logips2pp.c7
-rw-r--r--drivers/input/mouse/logips2pp.h7
-rw-r--r--drivers/input/mouse/psmouse-base.c50
-rw-r--r--drivers/input/mouse/psmouse.h1
-rw-r--r--drivers/input/mouse/sermouse.c19
-rw-r--r--drivers/input/mouse/synaptics.c109
-rw-r--r--drivers/input/mouse/synaptics.h18
-rw-r--r--drivers/input/mouse/touchkit_ps2.c100
-rw-r--r--drivers/input/mouse/touchkit_ps2.h24
-rw-r--r--drivers/input/mouse/trackpoint.h9
-rw-r--r--drivers/input/mouse/vsxxxaa.c3
-rw-r--r--drivers/input/mousedev.c439
-rw-r--r--drivers/input/power.c166
-rw-r--r--drivers/input/serio/hil_mlc.c505
-rw-r--r--drivers/input/serio/hp_sdc.c427
-rw-r--r--drivers/input/serio/hp_sdc_mlc.c227
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h24
-rw-r--r--drivers/input/serio/i8042.c7
-rw-r--r--drivers/input/touchscreen/ads7846.c30
-rw-r--r--drivers/input/touchscreen/corgi_ts.c3
-rw-r--r--drivers/input/touchscreen/elo.c3
-rw-r--r--drivers/input/touchscreen/gunze.c2
-rw-r--r--drivers/input/touchscreen/h3600_ts_input.c9
-rw-r--r--drivers/input/touchscreen/mtouch.c2
-rw-r--r--drivers/input/touchscreen/penmount.c3
-rw-r--r--drivers/input/touchscreen/touchright.c2
-rw-r--r--drivers/input/touchscreen/touchwin.c2
-rw-r--r--drivers/input/touchscreen/ucb1400_ts.c26
-rw-r--r--drivers/input/tsdev.c175
-rw-r--r--drivers/usb/input/Makefile5
-rw-r--r--drivers/usb/input/acecad.c28
-rw-r--r--drivers/usb/input/aiptek.c38
-rw-r--r--drivers/usb/input/appletouch.c29
-rw-r--r--drivers/usb/input/ati_remote.c42
-rw-r--r--drivers/usb/input/ati_remote2.c16
-rw-r--r--drivers/usb/input/gtco.c634
-rw-r--r--drivers/usb/input/itmtouch.c271
-rw-r--r--drivers/usb/input/kbtab.c22
-rw-r--r--drivers/usb/input/keyspan_remote.c29
-rw-r--r--drivers/usb/input/mtouchusb.c332
-rw-r--r--drivers/usb/input/powermate.c27
-rw-r--r--drivers/usb/input/touchkitusb.c392
-rw-r--r--drivers/usb/input/usbtouchscreen.c10
-rw-r--r--drivers/usb/input/wacom_sys.c22
-rw-r--r--drivers/usb/input/xpad.c22
-rw-r--r--drivers/usb/input/yealink.c13
-rw-r--r--include/asm-arm/arch-pxa/pxa27x_keyboard.h13
-rw-r--r--include/linux/gpio_keys.h3
-rw-r--r--include/linux/hp_sdc.h1
-rw-r--r--include/linux/input-polldev.h46
-rw-r--r--include/linux/input.h52
120 files changed, 4334 insertions, 3250 deletions
diff --git a/Documentation/input/input-programming.txt b/Documentation/input/input-programming.txt
index 180e0689676c..d9d523099bb7 100644
--- a/Documentation/input/input-programming.txt
+++ b/Documentation/input/input-programming.txt
@@ -1,5 +1,3 @@
-$Id: input-programming.txt,v 1.4 2001/05/04 09:47:14 vojtech Exp $
-
Programming input drivers
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -20,28 +18,51 @@ pressed or released a BUTTON_IRQ happens. The driver could look like:
#include <asm/irq.h>
#include <asm/io.h>
+static struct input_dev *button_dev;
+
static void button_interrupt(int irq, void *dummy, struct pt_regs *fp)
{
- input_report_key(&button_dev, BTN_1, inb(BUTTON_PORT) & 1);
- input_sync(&button_dev);
+ input_report_key(button_dev, BTN_1, inb(BUTTON_PORT) & 1);
+ input_sync(button_dev);
}
static int __init button_init(void)
{
+ int error;
+
if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) {
printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq);
return -EBUSY;
}
-
- button_dev.evbit[0] = BIT(EV_KEY);
- button_dev.keybit[LONG(BTN_0)] = BIT(BTN_0);
-
- input_register_device(&button_dev);
+
+ button_dev = input_allocate_device();
+ if (!button_dev) {
+ printk(KERN_ERR "button.c: Not enough memory\n");
+ error = -ENOMEM;
+ goto err_free_irq;
+ }
+
+ button_dev->evbit[0] = BIT(EV_KEY);
+ button_dev->keybit[LONG(BTN_0)] = BIT(BTN_0);
+
+ error = input_register_device(button_dev);
+ if (error) {
+ printk(KERN_ERR "button.c: Failed to register device\n");
+ goto err_free_dev;
+ }
+
+ return 0;
+
+ err_free_dev:
+ input_free_device(button_dev);
+ err_free_irq:
+ free_irq(BUTTON_IRQ, button_interrupt);
+ return error;
}
static void __exit button_exit(void)
{
- input_unregister_device(&button_dev);
+ input_unregister_device(button_dev);
free_irq(BUTTON_IRQ, button_interrupt);
}
@@ -58,17 +79,18 @@ In the _init function, which is called either upon module load or when
booting the kernel, it grabs the required resources (it should also check
for the presence of the device).
-Then it sets the input bitfields. This way the device driver tells the other
+Then it allocates a new input device structure with input_aloocate_device()
+and sets up input bitfields. This way the device driver tells the other
parts of the input systems what it is - what events can be generated or
-accepted by this input device. Our example device can only generate EV_KEY type
-events, and from those only BTN_0 event code. Thus we only set these two
-bits. We could have used
+accepted by this input device. Our example device can only generate EV_KEY
+type events, and from those only BTN_0 event code. Thus we only set these
+two bits. We could have used
set_bit(EV_KEY, button_dev.evbit);
set_bit(BTN_0, button_dev.keybit);
as well, but with more than single bits the first approach tends to be
-shorter.
+shorter.
Then the example driver registers the input device structure by calling
@@ -76,16 +98,15 @@ Then the example driver registers the input device structure by calling
This adds the button_dev structure to linked lists of the input driver and
calls device handler modules _connect functions to tell them a new input
-device has appeared. Because the _connect functions may call kmalloc(,
-GFP_KERNEL), which can sleep, input_register_device() must not be called
-from an interrupt or with a spinlock held.
+device has appeared. input_register_device() may sleep and therefore must
+not be called from an interrupt or with a spinlock held.
While in use, the only used function of the driver is
button_interrupt()
which upon every interrupt from the button checks its state and reports it
-via the
+via the
input_report_key()
@@ -113,16 +134,10 @@ can use the open and close callback to know when it can stop polling or
release the interrupt and when it must resume polling or grab the interrupt
again. To do that, we would add this to our example driver:
-int button_used = 0;
-
static int button_open(struct input_dev *dev)
{
- if (button_used++)
- return 0;
-
if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) {
printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq);
- button_used--;
return -EBUSY;
}
@@ -131,20 +146,21 @@ static int button_open(struct input_dev *dev)
static void button_close(struct input_dev *dev)
{
- if (!--button_used)
- free_irq(IRQ_AMIGA_VERTB, button_interrupt);
+ free_irq(IRQ_AMIGA_VERTB, button_interrupt);
}
static int __init button_init(void)
{
...
- button_dev.open = button_open;
- button_dev.close = button_close;
+ button_dev->open = button_open;
+ button_dev->close = button_close;
...
}
-Note the button_used variable - we have to track how many times the open
-function was called to know when exactly our device stops being used.
+Note that input core keeps track of number of users for the device and
+makes sure that dev->open() is called only when the first user connects
+to the device and that dev->close() is called when the very last user
+disconnects. Calls to both callbacks are serialized.
The open() callback should return a 0 in case of success or any nonzero value
in case of failure. The close() callback (which is void) must always succeed.
@@ -175,7 +191,7 @@ set the corresponding bits and call the
input_report_rel(struct input_dev *dev, int code, int value)
-function. Events are generated only for nonzero value.
+function. Events are generated only for nonzero value.
However EV_ABS requires a little special care. Before calling
input_register_device, you have to fill additional fields in the input_dev
@@ -187,6 +203,10 @@ the ABS_X axis:
button_dev.absfuzz[ABS_X] = 4;
button_dev.absflat[ABS_X] = 8;
+Or, you can just say:
+
+ input_set_abs_params(button_dev, ABS_X, 0, 255, 4, 8);
+
This setting would be appropriate for a joystick X axis, with the minimum of
0, maximum of 255 (which the joystick *must* be able to reach, no problem if
it sometimes reports more, but it must be able to always reach the min and
@@ -197,14 +217,7 @@ If you don't need absfuzz and absflat, you can set them to zero, which mean
that the thing is precise and always returns to exactly the center position
(if it has any).
-1.4 The void *private field
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-This field in the input stru