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: i8042 - add Lenovo Ideapad U455 to 'reset' blacklist
  Input: serio_raw - return proper result when serio_raw_read fails
  Input: document device properties
  Input: twl4030_keypad - fix comment (trivial)
  Input: gpio_keys - fix struct device declared inside parameter list
  Input: evdev - fix variable initialisation
This commit is contained in:
Linus Torvalds 2012-02-04 10:57:42 -08:00
commit 31c150a11c
6 changed files with 84 additions and 18 deletions

View File

@ -17,11 +17,11 @@ reports supported by a device are also provided by sysfs in
class/input/event*/device/capabilities/, and the properties of a device are class/input/event*/device/capabilities/, and the properties of a device are
provided in class/input/event*/device/properties. provided in class/input/event*/device/properties.
Types: Event types:
========== ===========
Types are groupings of codes under a logical input construct. Each type has a Event types are groupings of codes under a logical input construct. Each
set of applicable codes to be used in generating events. See the Codes section type has a set of applicable codes to be used in generating events. See the
for details on valid codes for each type. Codes section for details on valid codes for each type.
* EV_SYN: * EV_SYN:
- Used as markers to separate events. Events may be separated in time or in - Used as markers to separate events. Events may be separated in time or in
@ -63,9 +63,9 @@ for details on valid codes for each type.
* EV_FF_STATUS: * EV_FF_STATUS:
- Used to receive force feedback device status. - Used to receive force feedback device status.
Codes: Event codes:
========== ===========
Codes define the precise type of event. Event codes define the precise type of event.
EV_SYN: EV_SYN:
---------- ----------
@ -220,6 +220,56 @@ EV_PWR:
EV_PWR events are a special type of event used specifically for power EV_PWR events are a special type of event used specifically for power
mangement. Its usage is not well defined. To be addressed later. mangement. Its usage is not well defined. To be addressed later.
Device properties:
=================
Normally, userspace sets up an input device based on the data it emits,
i.e., the event types. In the case of two devices emitting the same event
types, additional information can be provided in the form of device
properties.
INPUT_PROP_DIRECT + INPUT_PROP_POINTER:
--------------------------------------
The INPUT_PROP_DIRECT property indicates that device coordinates should be
directly mapped to screen coordinates (not taking into account trivial
transformations, such as scaling, flipping and rotating). Non-direct input
devices require non-trivial transformation, such as absolute to relative
transformation for touchpads. Typical direct input devices: touchscreens,
drawing tablets; non-direct devices: touchpads, mice.
The INPUT_PROP_POINTER property indicates that the device is not transposed
on the screen and thus requires use of an on-screen pointer to trace user's
movements. Typical pointer devices: touchpads, tablets, mice; non-pointer
device: touchscreen.
If neither INPUT_PROP_DIRECT or INPUT_PROP_POINTER are set, the property is
considered undefined and the device type should be deduced in the
traditional way, using emitted event types.
INPUT_PROP_BUTTONPAD:
--------------------
For touchpads where the button is placed beneath the surface, such that
pressing down on the pad causes a button click, this property should be
set. Common in clickpad notebooks and macbooks from 2009 and onwards.
Originally, the buttonpad property was coded into the bcm5974 driver
version field under the name integrated button. For backwards
compatibility, both methods need to be checked in userspace.
INPUT_PROP_SEMI_MT:
------------------
Some touchpads, most common between 2008 and 2011, can detect the presence
of multiple contacts without resolving the individual positions; only the
number of contacts and a rectangular shape is known. For such
touchpads, the semi-mt property should be set.
Depending on the device, the rectangle may enclose all touches, like a
bounding box, or just some of them, for instance the two most recent
touches. The diversity makes the rectangle of limited use, but some
gestures can normally be extracted from it.
If INPUT_PROP_SEMI_MT is not set, the device is assumed to be a true MT
device.
Guidelines: Guidelines:
========== ==========
The guidelines below ensure proper single-touch and multi-finger functionality. The guidelines below ensure proper single-touch and multi-finger functionality.
@ -240,6 +290,8 @@ used to report when a touch is active on the screen.
BTN_{MOUSE,LEFT,MIDDLE,RIGHT} must not be reported as the result of touch BTN_{MOUSE,LEFT,MIDDLE,RIGHT} must not be reported as the result of touch
contact. BTN_TOOL_<name> events should be reported where possible. contact. BTN_TOOL_<name> events should be reported where possible.
For new hardware, INPUT_PROP_DIRECT should be set.
Trackpads: Trackpads:
---------- ----------
Legacy trackpads that only provide relative position information must report Legacy trackpads that only provide relative position information must report
@ -250,6 +302,8 @@ location of the touch. BTN_TOUCH should be used to report when a touch is active
on the trackpad. Where multi-finger support is available, BTN_TOOL_<name> should on the trackpad. Where multi-finger support is available, BTN_TOOL_<name> should
be used to report the number of touches active on the trackpad. be used to report the number of touches active on the trackpad.
For new hardware, INPUT_PROP_POINTER should be set.
Tablets: Tablets:
---------- ----------
BTN_TOOL_<name> events must be reported when a stylus or other tool is active on BTN_TOOL_<name> events must be reported when a stylus or other tool is active on
@ -260,3 +314,5 @@ button may be used for buttons on the tablet except BTN_{MOUSE,LEFT}.
BTN_{0,1,2,etc} are good generic codes for unlabeled buttons. Do not use BTN_{0,1,2,etc} are good generic codes for unlabeled buttons. Do not use
meaningful buttons, like BTN_FORWARD, unless the button is labeled for that meaningful buttons, like BTN_FORWARD, unless the button is labeled for that
purpose on the device. purpose on the device.
For new hardware, both INPUT_PROP_DIRECT and INPUT_PROP_POINTER should be set.

View File

@ -386,7 +386,7 @@ static ssize_t evdev_read(struct file *file, char __user *buffer,
struct evdev_client *client = file->private_data; struct evdev_client *client = file->private_data;
struct evdev *evdev = client->evdev; struct evdev *evdev = client->evdev;
struct input_event event; struct input_event event;
int retval; int retval = 0;
if (count < input_event_size()) if (count < input_event_size())
return -EINVAL; return -EINVAL;

View File

@ -34,7 +34,6 @@
#include <linux/i2c/twl.h> #include <linux/i2c/twl.h>
#include <linux/slab.h> #include <linux/slab.h>
/* /*
* The TWL4030 family chips include a keypad controller that supports * The TWL4030 family chips include a keypad controller that supports
* up to an 8x8 switch matrix. The controller can issue system wakeup * up to an 8x8 switch matrix. The controller can issue system wakeup
@ -302,7 +301,7 @@ static int __devinit twl4030_kp_program(struct twl4030_keypad *kp)
if (twl4030_kpwrite_u8(kp, i, KEYP_DEB) < 0) if (twl4030_kpwrite_u8(kp, i, KEYP_DEB) < 0)
return -EIO; return -EIO;
/* Set timeout period to 100 ms */ /* Set timeout period to 200 ms */
i = KEYP_PERIOD_US(200000, PTV_PRESCALER); i = KEYP_PERIOD_US(200000, PTV_PRESCALER);
if (twl4030_kpwrite_u8(kp, (i & 0xFF), KEYP_TIMEOUT_L) < 0) if (twl4030_kpwrite_u8(kp, (i & 0xFF), KEYP_TIMEOUT_L) < 0)
return -EIO; return -EIO;
@ -466,4 +465,3 @@ MODULE_AUTHOR("Texas Instruments");
MODULE_DESCRIPTION("TWL4030 Keypad Driver"); MODULE_DESCRIPTION("TWL4030 Keypad Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:twl4030_keypad"); MODULE_ALIAS("platform:twl4030_keypad");

View File

@ -512,6 +512,13 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"), DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"),
}, },
}, },
{
/* Lenovo Ideapad U455 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_NAME, "20046"),
},
},
{ } { }
}; };

View File

@ -164,7 +164,8 @@ static ssize_t serio_raw_read(struct file *file, char __user *buffer,
struct serio_raw_client *client = file->private_data; struct serio_raw_client *client = file->private_data;
struct serio_raw *serio_raw = client->serio_raw; struct serio_raw *serio_raw = client->serio_raw;
char uninitialized_var(c); char uninitialized_var(c);
ssize_t retval = 0; ssize_t read = 0;
int retval;
if (serio_raw->dead) if (serio_raw->dead)
return -ENODEV; return -ENODEV;
@ -180,13 +181,15 @@ static ssize_t serio_raw_read(struct file *file, char __user *buffer,
if (serio_raw->dead) if (serio_raw->dead)
return -ENODEV; return -ENODEV;
while (retval < count && serio_raw_fetch_byte(serio_raw, &c)) { while (read < count && serio_raw_fetch_byte(serio_raw, &c)) {
if (put_user(c, buffer++)) if (put_user(c, buffer++)) {
return -EFAULT; retval = -EFAULT;
retval++; break;
}
read++;
} }
return retval; return read ?: retval;
} }
static ssize_t serio_raw_write(struct file *file, const char __user *buffer, static ssize_t serio_raw_write(struct file *file, const char __user *buffer,

View File

@ -1,6 +1,8 @@
#ifndef _GPIO_KEYS_H #ifndef _GPIO_KEYS_H
#define _GPIO_KEYS_H #define _GPIO_KEYS_H
struct device;
struct gpio_keys_button { struct gpio_keys_button {
/* Configuration parameters */ /* Configuration parameters */
unsigned int code; /* input event code (KEY_*, SW_*) */ unsigned int code; /* input event code (KEY_*, SW_*) */