31 Dec, 2011

3 commits


18 Jun, 2011

1 commit


12 May, 2011

1 commit


27 Apr, 2011

1 commit

  • This patch modifies evdev so that it only becomes readable when
    the buffer contains an EV_SYN/SYN_REPORT event.

    On SMP systems, it is possible for an evdev client blocked on poll()
    to wake up and read events from the evdev ring buffer at the same
    rate as they are enqueued. This can result in high CPU usage,
    particularly for MT devices, because the client ends up reading
    events one at a time instead of reading complete packets.

    We eliminate this problem by making the device readable only when
    the buffer contains at least one complete packet. This causes
    clients to block until the entire packet is available.

    Signed-off-by: Jeff Brown
    Signed-off-by: Dmitry Torokhov

    Jeff Brown
     

13 Apr, 2011

1 commit

  • Add a new EV_SYN code, SYN_DROPPED, to inform the client when input
    events have been dropped from the evdev input buffer due to a
    buffer overrun. The client should use this event as a hint to
    reset its state or ignore all following events until the next
    packet begins.

    Signed-off-by: Jeff Brown
    [dtor@mail.ru: Implement Henrik's suggestion and drop old events in
    case of overflow.]
    Signed-off-by: Dmitry Torokhov

    Jeff Brown
     

27 Feb, 2011

1 commit

  • As was recently brought up on the busybox list
    (http://lists.busybox.net/pipermail/busybox/2011-January/074565.html),
    evdev_write doesn't properly check the count argument, which will
    lead to a return value > count on partial writes if the remaining bytes
    are accessible - causing userspace confusion.

    Fix it by only handling each full input_event structure and return -EINVAL
    if less than 1 struct was written, similar to how it is done in evdev_read.

    Reported-by: Baruch Siach
    Signed-off-by: Peter Korsgaard
    Acked-by: Henrik Rydberg
    Signed-off-by: Dmitry Torokhov

    Peter Korsgaard
     

07 Jan, 2011

1 commit


28 Dec, 2010

1 commit


20 Dec, 2010

1 commit

  • Today, userspace sets up an input device based on the data it emits.
    This is not always enough; a tablet and a touchscreen may emit exactly
    the same data, for instance, but the former should be set up with a
    pointer whereas the latter does not need to. Recently, a new type of
    touchpad has emerged where the buttons are under the pad, which
    changes logic without changing the emitted data. This patch introduces
    a new ioctl, EVIOCGPROP, which enables user access to a set of device
    properties useful during setup. The properties are given as a bitmap
    in the same fashion as the event types, and are also made available
    via sysfs, uevent and /proc/bus/input/devices.

    Acked-by: Ping Cheng
    Acked-by: Chase Douglas
    Acked-by: Dmitry Torokhov
    Signed-off-by: Henrik Rydberg

    Henrik Rydberg
     

15 Dec, 2010

1 commit

  • The desire to keep old names for the EVIOCGKEYCODE/EVIOCSKEYCODE while
    extending them to support large scancodes was a mistake. While we tried
    to keep ABI intact (and we succeeded in doing that, programs compiled
    on older kernels will work on newer ones) there is still a problem with
    recompiling existing software with newer kernel headers.

    New kernel headers will supply updated ioctl numbers and kernel will
    expect that userspace will use struct input_keymap_entry to set and
    retrieve keymap data. But since the names of ioctls are still the same
    userspace will happily compile even if not adjusted to make use of the
    new structure and will start miraculously fail in the field.

    To avoid this issue let's revert EVIOCGKEYCODE/EVIOCSKEYCODE definitions
    and add EVIOCGKEYCODE_V2/EVIOCSKEYCODE_V2 so that userspace can explicitly
    select the style of ioctls it wants to employ.

    Reviewed-by: Henrik Rydberg
    Acked-by: Jarod Wilson
    Acked-by: Mauro Carvalho Chehab
    Signed-off-by: Dmitry Torokhov

    Dmitry Torokhov
     

01 Dec, 2010

1 commit


25 Oct, 2010

2 commits

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (75 commits)
    Input: wacom - specify Cinitq supported tools
    Input: ab8500-ponkey - fix IRQ freeing in error path
    Input: adp5588-keys - use more obvious i2c_device_id name string
    Input: ad7877 - switch to using threaded IRQ
    Input: ad7877 - use attribute group to control visibility of attributes
    Input: serio - add support for PS2Mult multiplexer protocol
    Input: wacom - properly enable runtime PM
    Input: ad7877 - filter events where pressure is beyond the maximum
    Input: ad7877 - implement EV_KEY:BTN_TOUCH reporting
    Input: ad7877 - implement specified chip select behavior
    Input: hp680_ts_input - use cancel_delayed_work_sync()
    Input: mousedev - correct lockdep annotation
    Input: ads7846 - switch to using threaded IRQ
    Input: serio - support multiple child devices per single parent
    Input: synaptics - simplify pass-through port handling
    Input: add ROHM BU21013 touch panel controller support
    Input: omap4-keypad - wake-up on events & long presses
    Input: omap4-keypad - fix interrupt line configuration
    Input: omap4-keypad - SYSCONFIG register configuration
    Input: omap4-keypad - use platform device helpers
    ...

    Linus Torvalds
     
  • Dmitry Torokhov
     

23 Oct, 2010

1 commit

  • * 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
    vfs: make no_llseek the default
    vfs: don't use BKL in default_llseek
    llseek: automatically add .llseek fop
    libfs: use generic_file_llseek for simple_attr
    mac80211: disallow seeks in minstrel debug code
    lirc: make chardev nonseekable
    viotape: use noop_llseek
    raw: use explicit llseek file operations
    ibmasmfs: use generic_file_llseek
    spufs: use llseek in all file operations
    arm/omap: use generic_file_llseek in iommu_debug
    lkdtm: use generic_file_llseek in debugfs
    net/wireless: use generic_file_llseek in debugfs
    drm: use noop_llseek

    Linus Torvalds
     

22 Oct, 2010

1 commit

  • * 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (52 commits)
    sched: fix RCU lockdep splat from task_group()
    rcu: using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value
    sched: suppress RCU lockdep splat in task_fork_fair
    net: suppress RCU lockdep false positive in sock_update_classid
    rcu: move check from rcu_dereference_bh to rcu_read_lock_bh_held
    rcu: Add advice to PROVE_RCU_REPEATEDLY kernel config parameter
    rcu: Add tracing data to support queueing models
    rcu: fix sparse errors in rcutorture.c
    rcu: only one evaluation of arg in rcu_dereference_check() unless sparse
    kernel: Remove undead ifdef CONFIG_DEBUG_LOCK_ALLOC
    rcu: fix _oddness handling of verbose stall warnings
    rcu: performance fixes to TINY_PREEMPT_RCU callback checking
    rcu: upgrade stallwarn.txt documentation for CPU-bound RT processes
    vhost: add __rcu annotations
    rcu: add comment stating that list_empty() applies to RCU-protected lists
    rcu: apply TINY_PREEMPT_RCU read-side speedup to TREE_PREEMPT_RCU
    rcu: combine duplicate code, courtesy of CONFIG_PREEMPT_RCU
    rcu: Upgrade srcu_read_lock() docbook about SRCU grace periods
    rcu: document ways of stalling updates in low-memory situations
    rcu: repair code-duplication FIXMEs
    ...

    Linus Torvalds
     

18 Oct, 2010

2 commits

  • 448cd16 ("Input: evdev - rearrange ioctl handling") broke EVIOCSABS by
    checking for the wrong direction bit.

    Signed-off-by: Daniel Mack
    Reported-by: Sven Neumann
    Tested-by: Sven Neumann
    Signed-off-by: Dmitry Torokhov

    Daniel Mack
     
  • This fixes a regression introduced by the dynamic allocation of absinfo
    for input devices. We need to bail out early for input devices which
    don't have absolute axis.

    [ 929.664303] Pid: 2989, comm: input Not tainted 2.6.36-rc8+ #14 MS-7260/MS-7260
    [ 929.664318] EIP: 0060:[] EFLAGS: 00010246 CPU: 0
    [ 929.664331] EIP is at evdev_ioctl+0x4f8/0x59f
    [ 929.664341] EAX: 00000040 EBX: 00000000 ECX: 00000006 EDX: f45a1efc
    [ 929.664355] ESI: 00000000 EDI: f45a1efc EBP: f45a1f24 ESP: f45a1eb8
    [ 929.664369] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
    [ 929.664402] f470da74 f6a30e78 f462c240 00000018 bfe4a260 00000000 f45b06fc 00000000
    [ 929.664429] 000000c4 b769d000 c3544620 f470da74 f45b06fc f45b06fc f45a1f38 c107dd1f
    [ 929.664458] f4710b74 000000c4 00000000 00000000 00000000 0000029d 00000a74 f4710b74
    [ 929.664500] [] ? handle_mm_fault+0x2be/0x59a
    [ 929.664513] [] ? evdev_ioctl+0x0/0x59f
    [ 929.664524] [] ? do_vfs_ioctl+0x494/0x4d9
    [ 929.664538] [] ? up_read+0x16/0x29
    [ 929.664550] [] ? do_page_fault+0x2ff/0x32d
    [ 929.664564] [] ? do_sys_open+0xc5/0xcf
    [ 929.664575] [] ? sys_ioctl+0x41/0x61
    [ 929.664587] [] ? sysenter_do_call+0x12/0x36
    [ 929.684570] ---[ end trace 11b83e923bd8f2bb ]---

    Signed-off-by: Daniel Mack
    Signed-off-by: Dmitry Torokhov

    Daniel Mack
     

15 Oct, 2010

1 commit

  • All file_operations should get a .llseek operation so we can make
    nonseekable_open the default for future file operations without a
    .llseek pointer.

    The three cases that we can automatically detect are no_llseek, seq_lseek
    and default_llseek. For cases where we can we can automatically prove that
    the file offset is always ignored, we use noop_llseek, which maintains
    the current behavior of not returning an error from a seek.

    New drivers should normally not use noop_llseek but instead use no_llseek
    and call nonseekable_open at open time. Existing drivers can be converted
    to do the same when the maintainer knows for certain that no user code
    relies on calling seek on the device file.

    The generated code is often incorrectly indented and right now contains
    comments that clarify for each added line why a specific variant was
    chosen. In the version that gets submitted upstream, the comments will
    be gone and I will manually fix the indentation, because there does not
    seem to be a way to do that using coccinelle.

    Some amount of new code is currently sitting in linux-next that should get
    the same modifications, which I will do at the end of the merge window.

    Many thanks to Julia Lawall for helping me learn to write a semantic
    patch that does all this.

    ===== begin semantic patch =====
    // This adds an llseek= method to all file operations,
    // as a preparation for making no_llseek the default.
    //
    // The rules are
    // - use no_llseek explicitly if we do nonseekable_open
    // - use seq_lseek for sequential files
    // - use default_llseek if we know we access f_pos
    // - use noop_llseek if we know we don't access f_pos,
    // but we still want to allow users to call lseek
    //
    @ open1 exists @
    identifier nested_open;
    @@
    nested_open(...)
    {

    }

    @ open exists@
    identifier open_f;
    identifier i, f;
    identifier open1.nested_open;
    @@
    int open_f(struct inode *i, struct file *f)
    {

    }

    @ read disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    @@
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    {

    }

    @ read_no_fpos disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    @@
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    {
    ... when != off
    }

    @ write @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    @@
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    {

    }

    @ write_no_fpos @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    @@
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    {
    ... when != off
    }

    @ fops0 @
    identifier fops;
    @@
    struct file_operations fops = {
    ...
    };

    @ has_llseek depends on fops0 @
    identifier fops0.fops;
    identifier llseek_f;
    @@
    struct file_operations fops = {
    ...
    .llseek = llseek_f,
    ...
    };

    @ has_read depends on fops0 @
    identifier fops0.fops;
    identifier read_f;
    @@
    struct file_operations fops = {
    ...
    .read = read_f,
    ...
    };

    @ has_write depends on fops0 @
    identifier fops0.fops;
    identifier write_f;
    @@
    struct file_operations fops = {
    ...
    .write = write_f,
    ...
    };

    @ has_open depends on fops0 @
    identifier fops0.fops;
    identifier open_f;
    @@
    struct file_operations fops = {
    ...
    .open = open_f,
    ...
    };

    // use no_llseek if we call nonseekable_open
    ////////////////////////////////////////////
    @ nonseekable1 depends on !has_llseek && has_open @
    identifier fops0.fops;
    identifier nso ~= "nonseekable_open";
    @@
    struct file_operations fops = {
    ... .open = nso, ...
    +.llseek = no_llseek, /* nonseekable */
    };

    @ nonseekable2 depends on !has_llseek @
    identifier fops0.fops;
    identifier open.open_f;
    @@
    struct file_operations fops = {
    ... .open = open_f, ...
    +.llseek = no_llseek, /* open uses nonseekable */
    };

    // use seq_lseek for sequential files
    /////////////////////////////////////
    @ seq depends on !has_llseek @
    identifier fops0.fops;
    identifier sr ~= "seq_read";
    @@
    struct file_operations fops = {
    ... .read = sr, ...
    +.llseek = seq_lseek, /* we have seq_read */
    };

    // use default_llseek if there is a readdir
    ///////////////////////////////////////////
    @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier readdir_e;
    @@
    // any other fop is used that changes pos
    struct file_operations fops = {
    ... .readdir = readdir_e, ...
    +.llseek = default_llseek, /* readdir is present */
    };

    // use default_llseek if at least one of read/write touches f_pos
    /////////////////////////////////////////////////////////////////
    @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read.read_f;
    @@
    // read fops use offset
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = default_llseek, /* read accesses f_pos */
    };

    @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write.write_f;
    @@
    // write fops use offset
    struct file_operations fops = {
    ... .write = write_f, ...
    + .llseek = default_llseek, /* write accesses f_pos */
    };

    // Use noop_llseek if neither read nor write accesses f_pos
    ///////////////////////////////////////////////////////////

    @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    identifier write_no_fpos.write_f;
    @@
    // write fops use offset
    struct file_operations fops = {
    ...
    .write = write_f,
    .read = read_f,
    ...
    +.llseek = noop_llseek, /* read and write both use no f_pos */
    };

    @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write_no_fpos.write_f;
    @@
    struct file_operations fops = {
    ... .write = write_f, ...
    +.llseek = noop_llseek, /* write uses no f_pos */
    };

    @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    @@
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = noop_llseek, /* read uses no f_pos */
    };

    @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    @@
    struct file_operations fops = {
    ...
    +.llseek = noop_llseek, /* no read or write fn */
    };
    ===== End semantic patch =====

    Signed-off-by: Arnd Bergmann
    Cc: Julia Lawall
    Cc: Christoph Hellwig

    Arnd Bergmann
     

10 Sep, 2010

1 commit

  • 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
    Signed-off-by: Dan Carpenter
    Signed-off-by: Jarod Wilson
    Signed-off-by: Dmitry Torokhov

    Mauro Carvalho Chehab
     

20 Aug, 2010

1 commit


03 Aug, 2010

3 commits

  • 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

    Dmitry Torokhov
     
  • 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
    Signed-off-by: Dmitry Torokhov

    Daniel Mack
     
  • 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
    Cc: Dmitry Torokhov
    Signed-off-by: Dmitry Torokhov

    Daniel Mack
     

16 Jul, 2010

3 commits

  • Signed-off-by: Dmitry Torokhov

    Dmitry Torokhov
     
  • Signed-off-by: Dmitry Torokhov

    Dmitry Torokhov
     
  • 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
    Acked-by: Chase Douglas
    Acked-by: Rafi Rubin
    Signed-off-by: Henrik Rydberg
    Signed-off-by: Dmitry Torokhov

    Henrik Rydberg
     

24 Jun, 2010

3 commits

  • 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
    Signed-off-by: Dmitry Torokhov

    Henrik Rydberg
     
  • 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
    Acked-by: Chase Douglas
    Signed-off-by: Dmitry Torokhov

    Henrik Rydberg
     
  • 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
    Signed-off-by: Dmitry Torokhov

    Henrik Rydberg
     

09 Mar, 2010

1 commit

  • 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
    Acked-by: Matthew Garrett
    Acked-by: Jiri Kosina
    Signed-off-by: Dmitry Torokhov

    Dmitry Torokhov
     

04 Feb, 2010

1 commit


06 Jan, 2010

1 commit

  • 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
    Signed-off-by: Dmitry Torokhov

    Adam Jackson
     

05 Oct, 2009

1 commit


14 Jul, 2009

1 commit

  • 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
    Signed-off-by: Daniel Mack
    Reviewed-by: Thadeu Lima de Souza Cascardo
    Signed-off-by: Dmitry Torokhov

    Daniel Mack
     

20 Jun, 2009

1 commit


11 May, 2009

1 commit


16 Mar, 2009

1 commit

  • 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
    Signed-off-by: Jonathan Corbet

    Jonathan Corbet
     

20 Dec, 2008

1 commit