Commit Graph

81 Commits (1ec5584e3edf9c4bf2c88c846534d19cf986ba11)

Author SHA1 Message Date
Dmitry Torokhov 448cd1664a Input: evdev - rearrange ioctl handling
Split ioctl handling into 3 separate sections: fixed-length ioctls,
variable-length ioctls and multi-number variable length handlers.
This reduces identation and makes the code a bit clearer.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-08-02 20:30:44 -07:00
Daniel Mack d31b2865a4 Input: dynamically allocate ABS information
As all callers are now changed to only use the input_abs_*() access
helpers, switching over to dynamically allocated ABS information is
easy. This reduces size of struct input_dev from 3152 to 1640 on
64 bit architectures.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-08-02 20:30:04 -07:00
Daniel Mack 987a6c0298 Input: switch to input_abs_*() access functions
Change all call sites in drivers/input to not access the ABS axis
information directly anymore. Make them use the access helpers instead.

Also use input_set_abs_params() when possible.
Did some code refactoring as I was on it.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-08-02 20:29:56 -07:00
Dmitry Torokhov c18fb1396e Input: evdev - signal that device is writable in evdev_poll()
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-07-15 23:53:00 -07:00
Dmitry Torokhov 20da92de8e Input: change input handlers to use bool when possible
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-07-15 23:52:33 -07:00
Henrik Rydberg 40d007e7df Input: introduce MT event slots
With the rapidly increasing number of intelligent multi-contact and
multi-user devices, the need to send digested, filtered information
from a set of different sources within the same device is imminent.
This patch adds the concept of slots to the MT protocol. The slots
enumerate a set of identified sources, such that all MT events
can be passed independently and selectively per identified source.

The protocol works like this: Instead of sending a SYN_MT_REPORT
event immediately after the contact data, one sends an ABS_MT_SLOT
event immediately before the contact data. The input core will only
emit events for slots with modified MT events. It is assumed that
the same slot is used for the duration of an initiated contact.

Acked-by: Ping Cheng <pingc@wacom.com>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Rafi Rubin <rafi@seas.upenn.edu>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-07-15 23:52:03 -07:00
Henrik Rydberg e725a4945d Input: evdev - never leave the client buffer empty after write
When the client buffer is very small and wraps around a lot, it may
well be that a write increases the head such that head == tail. If
this happens between the point where a poll is triggered and the
actual data is being read, there will be no data to read. This is
confusing to applications, which might end up closing the file.

This patch solves the problem by making sure the client buffer is
never empty after writing to it.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-06-23 13:05:27 -07:00
Henrik Rydberg 63a6404d8a Input: evdev - use driver hint to compute size of event buffer
Some devices, in particular MT devices, produce a lot of data.  This
may lead to overflowing of the event queues in evdev driver, which
by default are fairly small. Let the drivers hint the average number
of events per packet generated by the device, and use that information
when computing the buffer size evdev should use for the device.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-06-23 13:05:25 -07:00
Henrik Rydberg b58f7086d5 Input: evdev - convert to dynamic event buffer
Allocate the event buffer dynamically, and prepare to compute the
buffer size in a separate function. This patch defines the size
computation to be identical to the current code, and does not contain
any logical changes.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-06-23 13:04:42 -07:00
Dmitry Torokhov 58b939959d Input: scancode in get/set_keycodes should be unsigned
The HID layer has some scan codes of the form 0xffbc0000 for logitech
devices which do not work if scancode is typed as signed int, so we need
to switch to unsigned it instead. While at it keycode being signed does
not make much sense either.

Acked-by: Márton Németh <nm127@freemail.hu>
Acked-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-03-08 23:19:15 -08:00
Dmitry Torokhov 3d7bbd4575 Input: mark input interfaces as non-seekable
Seeking does not make sense for input interfaces such as evdev and joydev
so let's use nonseekable_open to mark them non-seekable.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-02-04 00:31:44 -08:00
Adam Jackson 30a589fde0 Input: evdev - be less aggressive about sending SIGIO notifies
When using realtime signals, we'll enqueue one signal for every event.
This is unfortunate, because (for example) keyboard presses are three
events: key, msc scancode, and syn.  They'll be enqueued fast enough in
kernel space that all three events will be ready to read by the time
userspace runs, so the first invocation of the signal handler will read
all three events, but then the second two invocations still have to run
to do no work.

Instead, only send the SIGIO notification on syn events.  This is a
slight abuse of SIGIO semantics, in principle it ought to fire as soon
as any events are readable.  But it matches evdev semantics, which is
more important since SIGIO is rather vaguely defined to begin with.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-01-06 00:17:04 -08:00
Alexey Dobriyan a99bbaf5ee headers: remove sched.h from poll.h
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-10-04 15:05:10 -07:00
Daniel Mack f936601471 Input: fix EVIOCGNAME/JSIOCGNAME regression
Commit 3d5cb60e ("Input: simplify name handling for certain input
handles") introduced a regression for the EVIOCGNAME/JSIOCGNAME
ioctl.

Before this, patch, the platform device's name was given back to
userspace which was good to identify devices. After this patch, the
device is ("event%d", minor) which is not descriptive at all.

This fixes the behaviour by taking dev->name.

Reported-by: Sven Neumann <s.neumann@raumfeld.com>
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Reviewed-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-07-13 22:24:29 -07:00
Tero Saarni ec20a022aa Input: synaptics - add support for reporting x/y resolution
Synaptics uses anisotropic coordinate system.  On some wide touchpads
vertical resolution can be twice as high as horizontal which causes
unequal sensitivity on x/y directions.  Add support for reading the
resolution with EVIOCGABS ioctl.

Signed-off-by: Tero Saarni <tero.saarni@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-06-19 22:55:17 -07:00
Thadeu Lima de Souza Cascardo 3d5cb60ef3 Input: simplify name handling for certain input handles
For evdev, joydev and mousedev, instead of having a separate character array
holding name of the handle, use struct devce's name which is the same.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-05-11 00:11:43 -07:00
Jonathan Corbet 60aa49243d Rationalize fasync return values
Most fasync implementations do something like:

     return fasync_helper(...);

But fasync_helper() will return a positive value at times - a feature used
in at least one place.  Thus, a number of other drivers do:

     err = fasync_helper(...);
     if (err < 0)
             return err;
     return 0;

In the interests of consistency and more concise code, it makes sense to
map positive return values onto zero where ->fasync() is called.

Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2009-03-16 08:34:35 -06:00
Dmitry Torokhov 93b8eef1c0 Merge commit 'v2.6.28-rc9' into next 2008-12-20 04:54:54 -05:00
Al Viro 233e70f422 saner FASYNC handling on file close
As it is, all instances of ->release() for files that have ->fasync()
need to remember to evict file from fasync lists; forgetting that
creates a hole and we actually have a bunch that *does* forget.

So let's keep our lives simple - let __fput() check FASYNC in
file->f_flags and call ->fasync() there if it's been set.  And lose that
crap in ->release() instances - leaving it there is still valid, but we
don't have to bother anymore.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-11-01 09:49:46 -07:00
Kay Sievers a6c2490f01 Input: struct device - replace bus_id with dev_name(), dev_set_name()
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-10-30 09:29:05 -04:00
Philip Langdale 2d56f3a32c Input: refactor evdev 32bit compat to be shareable with uinput
Currently, evdev has working 32bit compatibility and uinput does not. uinput
needs the input_event code that evdev uses, so let's refactor it so it can
be shared.

[dtor@mail.ru: add fix for force feedback compat issues]
Signed-off-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-10-27 22:03:42 -04:00
Geert Uytterhoeven c85e2031eb Input: evdev - fix printf() format for sizeof
commit f2afa7711f ("Input: paper over a bug in
Synaptics X driver") introduced a compiler warning on 64-bit platforms, as
sizeof() returns a size_t, not an (unsigned) int:

| drivers/input/evdev.c: In function 'handle_eviocgbit':
| drivers/input/evdev.c:684: warning: format '%d' expects type 'int', but argument 3 has type 'long unsigned int'

Use the proper `z' modifier for size_t, and make the printf() formats for the
sizes unsigned while we're at it.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-08-19 11:35:27 -04:00
Dmitry Torokhov f2afa7711f Input: paper over a bug in Synaptics X driver
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-08-08 14:54:59 -04:00
Linus Torvalds 5402a7349d Input: evdev - split EVIOCGBIT handlig into a separate function
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-08-08 11:54:58 -04:00
Adam Dawidowski f2278f31d6 Input: fix force feedback upload issue in compat mode
Force feedback upload of effects through the event device (ioctl
EVIOCSFF) is not working in 32 bit applications running on 64-bit
kernel due to the fact that struct ff_effect contains a pointer,
resulting in the structure having different sizes in 64 and 32 bit
programs and causing difference in ioctl numbers.

[dtor@mail.ru: refactor to keep all ugliness in evdev]

Signed-off-by: Adam Dawidowski <drake_ster@wp.pl>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-06-30 09:37:06 -04:00
Dmitry Torokhov a7097ff89c Input: make sure input interfaces pin parent input devices
Recent driver core change causes references to parent devices being
dropped early, at device_del() time, as opposed to when all children
are freed. This causes oops in evdev with grabbed devices. Take the
reference to the parent input device ourselves to ensure that it
stays around long enough.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-04-01 00:22:53 -04:00
Björn Steinbrink eb08b6b973 evdev: Release eventual input device grabs when getting disconnected
When getting disconnected we need to release eventual grabs on the
underlying input device as we also release the input device itself.
Otherwise, we would try to release the grab when the client that
requested it closes its handle, accessing the input device which
might already be freed.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-03-30 14:47:49 -07:00
Dmitry Torokhov f4f37c8ec7 Input: Add proper locking when changing device's keymap
Take dev->event_lock to make sure that we don't race with input_event() and
also force key up event when removing a key from keymap table.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2008-01-21 01:11:06 -05:00
Jiri Slaby 7b19ada2ed get rid of input BIT* duplicate defines
get rid of input BIT* duplicate defines

use newly global defined macros for input layer. Also remove includes of
input.h from non-input sources only for BIT macro definiton. Define the
macro temporarily in local manner, all those local definitons will be
removed further in this patchset (to not break bisecting).
BIT macro will be globally defined (1<<x)

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: <dtor@mail.ru>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Cc: <lenb@kernel.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Cc: <perex@suse.cz>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: <vernux@us.ibm.com>
Cc: <malattia@linux.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-19 11:53:42 -07:00
Dmitry Torokhov 82ba56c273 Input: use full RCU API
RT guys alerted me to the fact that in their tree spinlocks
are preemptible and it is better to use full RCU API
(rcu_read_lock()/rcu_read_unlock()) to be safe.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-10-13 15:46:55 -04:00
Dmitry Torokhov b981d8b3f5 Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:

	drivers/macintosh/adbhid.c
2007-10-12 21:27:47 -04:00
Oliver Neukum 064450140f Input: fix open count handling in input interfaces
If input_open_device() fails we should not leave interfaces marked
as  opened.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-10-12 14:18:40 -04:00
Dmitry Torokhov 6addb1d6de Input: evdev - implement proper locking
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-08-30 00:22:18 -04:00
Ralf Baechle 293c5bd13f [MIPS] Fixup secure computing stuff.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2007-07-31 21:35:21 +01:00
Dmitry Torokhov 9657d75c5f Input: convert from class devices to standard devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-07-10 00:35:17 -04:00
Linus Torvalds 0b662c6484 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: reduce raciness when input handlers disconnect
  Input: ucb1x00 - do not access input_dev->private directly
  Input: logips2pp - fix typo in Kconfig
  Input: db9 - do not ignore dev2 module parameter
2007-06-04 13:27:33 -07:00
Dmitry Torokhov 1dfa281240 Input: reduce raciness when input handlers disconnect
There is a race between input handler's release() and disconnect()
methods: when input handler disconnects it wakes up all regular
users and then process to walk user list to wake up async. users.
While disconnect() walks the list release() removes elements of
the same list causing oopses.

While this is not a substibute for proper locking we can reduce
odds of getting an oops if we wake up normal readers after walking
the list.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-06-03 23:50:05 -04:00
Kenichi Nagai bf61f8d357 Input: evdev - fix overflow in compat_ioctl
When exporting input device bitmaps via compat_ioctl on BIG_ENDIAN
platforms evdev calculates data size incorrectly. This causes buffer
overflow if user specifies buffer smaller than maxlen.

Signed-off-by: Kenichi Nagai <kenichi3.nagai@toshiba.co.jp>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-11 09:08:04 -07:00
Linus Torvalds 393bfca19e Merge master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
* master.kernel.org:/pub/scm/linux/kernel/git/dtor/input:
  Input: move USB miscellaneous devices under drivers/input/misc
  Input: move USB mice under drivers/input/mouse
  Input: move USB gamepads under drivers/input/joystick
  Input: move USB touchscreens under drivers/input/touchscreen
  Input: move USB tablets under drivers/input/tablet
  Input: i8042 - fix AUX port detection with some chips
  Input: aaed2000_kbd - convert to use polldev library
  Input: drivers/usb/input - usb_buffer_free() cleanup
  Input: synaptics - don't complain about failed resets
  Input: pull input.h into uinpit.h
  Input: drivers/usb/input - fix sparse warnings (signedness)
  Input: evdev - fix some sparse warnings (signedness, shadowing)
  Input: drivers/joystick - fix various sparse warnings
  Input: force feedback - make sure effect is present before playing
2007-05-08 11:51:43 -07:00
Randy Dunlap e63340ae6b header cleaning: don't include smp_lock.h when not used
Remove includes of <linux/smp_lock.h> where it is not used/needed.
Suggested by Al Viro.

Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc,
sparc64, and arm (all 59 defconfigs).

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 11:15:07 -07:00
Dmitry Torokhov 334d0dd8b6 Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2007-05-08 01:31:11 -04:00
Linus Torvalds a3d52136ee Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input: (65 commits)
  Input: gpio_keys - add support for switches (EV_SW)
  Input: cobalt_btns - convert to use polldev library
  Input: add skeleton for simple polled devices
  Input: update some documentation
  Input: wistron - fix typo in keymap for Acer TM610
  Input: add input_set_capability() helper
  Input: i8042 - add Fujitsu touchscreen/touchpad PNP IDs
  Input: i8042 - add Panasonic CF-29 to nomux list
  Input: lifebook - split into 2 devices
  Input: lifebook - add signature of Panasonic CF-29
  Input: lifebook - activate 6-byte protocol on select models
  Input: lifebook - work properly on Panasonic CF-18
  Input: cobalt buttons - separate device and driver registration
  Input: ati_remote - make button repeat sensitivity configurable
  Input: pxa27x - do not use deprecated SA_INTERRUPT flag
  Input: ucb1400 - make delays configurable
  Input: misc devices - switch to using input_dev->dev.parent
  Input: joysticks - switch to using input_dev->dev.parent
  Input: touchscreens - switch to using input_dev->dev.parent
  Input: mice - switch to using input_dev->dev.parent
  ...

Fixed up conflicts with core device model removal of "struct subsystem" manually.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-04 18:16:12 -07:00
Dmitry Torokhov ce305b6a08 Input: evdev - fix some sparse warnings (signedness, shadowing)
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-05-03 00:53:18 -04:00
Greg Kroah-Hartman 823bccfc40 remove "struct subsystem" as it is no longer needed
We need to work on cleaning up the relationship between kobjects, ksets and
ktypes.  The removal of 'struct subsystem' is the first step of this,
especially as it is not really needed at all.

Thanks to Kay for fixing the bugs in this patch.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-05-02 18:57:59 -07:00
Dmitry Torokhov d542ed82fd Input: handlers - handle errors from input_open_device()
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-04-12 01:30:15 -04:00
Dmitry Torokhov d0ffb9be86 Input: handlers - rename 'list' to 'client'
The naming convention in input handlers was very confusing -
client stuctures were called lists, regular lists were also
called lists making anyone looking at the code go mad.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-04-12 01:30:00 -04:00
Dmitry Torokhov 5b2a08262a Input: rework handle creation code
- consolidate code for binding handlers to a device
 - return error codes from handlers connect() methods back to input
   core and log failures

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-04-12 01:29:46 -04:00
Marvin Raaijmakers c8e4c77277 Input: add getkeycode and setkeycode methods
Allow drivers to implement their own get and set keycode methods. This
will allow drivers to change their keymaps without allocating huge
tables covering entire range of possible scancodes.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2007-03-14 22:50:42 -04:00
Dmitry Torokhov 4263cf0fac Input: make input_register_handler() return error codes
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-09-14 01:32:39 -04:00
Dmitry Torokhov 66e6611883 Input: constify input core
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2006-09-14 01:31:59 -04:00