summaryrefslogtreecommitdiffstats
path: root/drivers/input/evdev.c
Commit message (Collapse)AuthorAgeFilesLines
* Input: add support for large scancodesMauro Carvalho Chehab2010-09-091-20/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several devices use a high number of bits for scancodes. One important group is the Remote Controllers. Some new protocols like RC-6 define a scancode space of 64 bits. The current EVIO[CS]GKEYCODE ioctls allow replace the scancode/keycode translation tables, but it is limited to up to 32 bits for scancode. Also, if userspace wants to clean the existing table, replacing it by a new one, it needs to run a loop calling the ioctls over the entire sparse scancode space. To solve those problems, this patch extends the ioctls to allow drivers handle scancodes up to 32 bytes long (the length could be extended in the future should such need arise) and allow userspace to query and set scancode to keycode mappings not only by scancode but also by index. Compatibility code were also added to handle the old format of EVIO[CS]GKEYCODE ioctls. Folded fixes by: - Dan Carpenter: locking fixes for the original implementation - Jarod Wilson: fix crash when setting keycode and wiring up get/set handlers in original implementation. - Dmitry Torokhov: rework to consolidate old and new scancode handling, provide options to act either by index or scancode. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: evdev - rearrange ioctl handlingDmitry Torokhov2010-08-021-68/+73
| | | | | | | | 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>
* Input: dynamically allocate ABS informationDaniel Mack2010-08-021-16/+5
| | | | | | | | | | 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>
* Input: switch to input_abs_*() access functionsDaniel Mack2010-08-021-13/+13
| | | | | | | | | | | | 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>
* Input: evdev - signal that device is writable in evdev_poll()Dmitry Torokhov2010-07-151-2/+7
| | | | Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: change input handlers to use bool when possibleDmitry Torokhov2010-07-151-3/+3
| | | | Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: introduce MT event slotsHenrik Rydberg2010-07-151-0/+4
| | | | | | | | | | | | | | | | | | | | | 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>
* Input: evdev - never leave the client buffer empty after writeHenrik Rydberg2010-06-231-3/+7
| | | | | | | | | | | | | | 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>
* Input: evdev - use driver hint to compute size of event bufferHenrik Rydberg2010-06-231-2/+7
| | | | | | | | | | | | 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>
* Input: evdev - convert to dynamic event bufferHenrik Rydberg2010-06-231-5/+17
| | | | | | | | | | 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>
* Input: scancode in get/set_keycodes should be unsignedDmitry Torokhov2010-03-081-1/+1
| | | | | | | | | | | | 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>
* Input: mark input interfaces as non-seekableDmitry Torokhov2010-02-041-0/+2
| | | | | | | 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>
* Input: evdev - be less aggressive about sending SIGIO notifiesAdam Jackson2010-01-061-1/+2
| | | | | | | | | | | | | | | | | | 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>
* headers: remove sched.h from poll.hAlexey Dobriyan2009-10-041-0/+1
| | | | | Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Input: fix EVIOCGNAME/JSIOCGNAME regressionDaniel Mack2009-07-131-2/+1
| | | | | | | | | | | | | | | | | 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>
* Input: synaptics - add support for reporting x/y resolutionTero Saarni2009-06-191-3/+9
| | | | | | | | | | 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>
* Input: simplify name handling for certain input handlesThadeu Lima de Souza Cascardo2009-05-111-5/+4
| | | | | | | | 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>
* Rationalize fasync return valuesJonathan Corbet2009-03-161-4/+1
| | | | | | | | | | | | | | | | | | | | 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>
* Merge commit 'v2.6.28-rc9' into nextDmitry Torokhov2008-12-201-1/+0
|\
| * saner FASYNC handling on file closeAl Viro2008-11-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Input: struct device - replace bus_id with dev_name(), dev_set_name()Kay Sievers2008-10-301-1/+1
| | | | | | | | | | | | 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>
* | Input: refactor evdev 32bit compat to be shareable with uinputPhilip Langdale2008-10-271-189/+8
|/ | | | | | | | | | 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>
* Input: evdev - fix printf() format for sizeofGeert Uytterhoeven2008-08-191-2/+2
| | | | | | | | | | | | | | | commit f2afa7711f8585ffc088ba538b9a510e0d5dca12 ("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>
* Input: paper over a bug in Synaptics X driverDmitry Torokhov2008-08-081-1/+20
| | | | Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: evdev - split EVIOCGBIT handlig into a separate functionLinus Torvalds2008-08-081-20/+24
| | | | | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: fix force feedback upload issue in compat modeAdam Dawidowski2008-06-301-11/+90
| | | | | | | | | | | | | 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>
* Input: make sure input interfaces pin parent input devicesDmitry Torokhov2008-04-011-4/+2
| | | | | | | | | | 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>
* evdev: Release eventual input device grabs when getting disconnectedBjörn Steinbrink2008-03-301-0/+3
| | | | | | | | | | | 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>
* Input: Add proper locking when changing device's keymapDmitry Torokhov2008-01-211-3/+3
| | | | | | | 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>
* get rid of input BIT* duplicate definesJiri Slaby2007-10-191-6/+6
| | | | | | | | | | | | | | | | | | | | | | 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>
* Input: use full RCU APIDmitry Torokhov2007-10-131-13/+9
| | | | | | | | 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>
* Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6Dmitry Torokhov2007-10-121-1/+1
|\ | | | | | | | | | | Conflicts: drivers/macintosh/adbhid.c
| * [MIPS] Fixup secure computing stuff.Ralf Baechle2007-07-311-1/+1
| | | | | | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* | Input: fix open count handling in input interfacesOliver Neukum2007-10-121-1/+4
| | | | | | | | | | | | | | | | 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>
* | Input: evdev - implement proper lockingDmitry Torokhov2007-08-301-240/+473
|/ | | | Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: convert from class devices to standard devicesDmitry Torokhov2007-07-101-42/+42
| | | | Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Merge branch 'for-linus' of ↵Linus Torvalds2007-06-041-1/+1
|\ | | | | | | | | | | | | | | | | | | 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
| * Input: reduce raciness when input handlers disconnectDmitry Torokhov2007-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Input: evdev - fix overflow in compat_ioctlKenichi Nagai2007-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | 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>
* | Merge master.kernel.org:/pub/scm/linux/kernel/git/dtor/inputLinus Torvalds2007-05-081-3/+3
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6Dmitry Torokhov2007-05-081-3/+3
| |\
| * | Input: evdev - fix some sparse warnings (signedness, shadowing)Dmitry Torokhov2007-05-031-3/+3
| | | | | | | | | | | | Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* | | header cleaning: don't include smp_lock.h when not usedRandy Dunlap2007-05-081-1/+0
| |/ |/| | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'for-linus' of ↵Linus Torvalds2007-05-041-101/+132
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Input: handlers - handle errors from input_open_device()Dmitry Torokhov2007-04-121-2/+9
| | | | | | | | Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
| * Input: handlers - rename 'list' to 'client'Dmitry Torokhov2007-04-121-70/+80
| | | | | | | | | | | | | | | | 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>
| * Input: rework handle creation codeDmitry Torokhov2007-04-121-11/+36
| | | | | | | | | | | | | | | | - 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>
| * Input: add getkeycode and setkeycode methodsMarvin Raaijmakers2007-03-141-20/+9
| | | | | | | | | | | | | | | | 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>
* | remove "struct subsystem" as it is no longer neededGreg Kroah-Hartman2007-05-021-2/+2
|/ | | | | | | | | | | 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>
* Input: make input_register_handler() return error codesDmitry Torokhov2006-09-141-2/+1
| | | | Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
OpenPOWER on IntegriCloud