16 Jun, 2020

1 commit

  • Neither the trackpad, nor the mouse want input core to generate autorepeat
    events for their buttons, so let's reset the bit (as hid-input sets it for
    these devices based on the usage vendor code).

    Cc: stable@vger.kernel.org
    Reported-by: Yariv
    Tested-by: Yariv
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Jiri Kosina

    Dmitry Torokhov
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 3029 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

03 Oct, 2018

1 commit

  • USB device
    Vendor 05ac (Apple)
    Device 0265 (Magic Trackpad 2)
    Bluetooth device
    Vendor 004c (Apple)
    Device 0265 (Magic Trackpad 2)

    Add support for Apple Magic Trackpad 2 over USB and bluetooth, putting
    the device in multi-touch mode.

    Signed-off-by: Claudio Mettler
    Signed-off-by: Marek Wyborski
    Signed-off-by: Sean O'Brien
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Sean O'Brien
     

26 Apr, 2018

1 commit

  • It is not a good idea to try to fit all types of applications in the
    same input report. There are a lot of devices that are needing
    the quirk HID_MULTI_INPUT but this quirk doesn't match the actual HID
    description as it is based on the report ID.

    Given that most devices with MULTI_INPUT I can think of split nicely
    the devices inputs into application, it is a good thing to split the
    devices by default based on this assumption.

    Also make hid-multitouch following this rule, to not have to deal
    with too many input created.

    While we are at it, fix some checkpatch complaints about converting
    'unsigned' to 'unsigned int'.

    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

31 Oct, 2017

1 commit

  • Several function prototypes for the set/get functions defined by
    module_param_call() have a slightly wrong argument types. This fixes
    those in an effort to clean up the calls when running under type-enforced
    compiler instrumentation for CFI. This is the result of running the
    following semantic patch:

    @match_module_param_call_function@
    declarer name module_param_call;
    identifier _name, _set_func, _get_func;
    expression _arg, _mode;
    @@

    module_param_call(_name, _set_func, _get_func, _arg, _mode);

    @fix_set_prototype
    depends on match_module_param_call_function@
    identifier match_module_param_call_function._set_func;
    identifier _val, _param;
    type _val_type, _param_type;
    @@

    int _set_func(
    -_val_type _val
    +const char * _val
    ,
    -_param_type _param
    +const struct kernel_param * _param
    ) { ... }

    @fix_get_prototype
    depends on match_module_param_call_function@
    identifier match_module_param_call_function._get_func;
    identifier _val, _param;
    type _val_type, _param_type;
    @@

    int _get_func(
    -_val_type _val
    +char * _val
    ,
    -_param_type _param
    +const struct kernel_param * _param
    ) { ... }

    Two additional by-hand changes are included for places where the above
    Coccinelle script didn't notice them:

    drivers/platform/x86/thinkpad_acpi.c
    fs/lockd/svc.c

    Signed-off-by: Kees Cook
    Signed-off-by: Jessica Yu

    Kees Cook
     

20 Jun, 2017

1 commit

  • Setting these bits causes libinput to fail to initialize the device;
    setting BTN_TOUCH and BTN_TOOL_FINGER causes it to treat the mouse as a
    touchpad, and it then refuses to continue when it discovers ABS_X is not
    set.

    This breaks all known Wayland compositors, as well as Xorg when the
    libinput driver is being used.

    This reverts commit f4b65b9563216b3e01a5cc844c3ba68901d9b195.

    Signed-off-by: Daniel Stone
    Cc: Che-Liang Chiou
    Cc: Thierry Escande
    Cc: Jiri Kosina
    Cc: Benjamin Tissoires
    Acked-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Daniel Stone
     

05 May, 2017

1 commit

  • The driver emits multi-touch events for Magic Trackpad as well as Magic
    Mouse, but it does not set keybits that are related to multi-touch event
    for Magic Mouse; so set these keybits.

    The keybits that are not set cause trouble because user programs often
    probe these keybits for self-configuration and thus they cannot operate
    properly if the keybits are not set.

    One of such troubles is that libevdev will not be able to emit correct
    touch count, causing gestures library failed to do fling stop.

    Signed-off-by: Che-Liang Chiou
    Signed-off-by: Thierry Escande
    Signed-off-by: Jiri Kosina

    Che-Liang Chiou
     

24 Nov, 2016

1 commit


06 Nov, 2015

1 commit

  • When configuring input device via input_configured callback we may
    encounter errors (for example input_mt_init_slots() may fail). Instead
    of continuing with half-initialized input device let's allow driver
    indicate failures.

    Signed-off-by: Jaikumar Ganesh
    Signed-off-by: Arve Hjønnevåg
    Reviewed-by: Benjamin Tissoires
    Reviewed-by: David Herrmann
    Acked-by: Nikolai Kondrashov
    Acked-by: Andrew Duggan
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Jiri Kosina

    Dmitry Torokhov
     

27 Aug, 2014

1 commit


17 Feb, 2014

2 commits


06 Sep, 2013

1 commit


31 Jul, 2013

1 commit

  • It is safe to use devres allocation within the hid subsystem:
    - the devres release is called _after_ the call to .remove(), meaning
    that no freed pointers will exists while removing the device
    - if a .probe() fails, devres releases all the allocated ressources
    before going to the next driver: there will not be ghost ressources
    attached to a hid device if several drivers are probed.

    Given that, we can clean up a little some of the HID drivers. These ones
    are trivial:
    - there is only one kzalloc in the driver
    - the .remove() callback contains only one kfree on top of hid_hw_stop()
    - the error path in the probe is easy enough to be manually checked

    Signed-off-by: Benjamin Tissoires
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

23 Jul, 2013

1 commit


30 Apr, 2013

1 commit


04 Apr, 2013

1 commit

  • Since kernel 3.7, it appears that the input registration occured before
    the end of magicmouse_setup_input(). This is shown by receiving a lot of
    "EV_SYN SYN_REPORT 1" instead of normal "EV_SYN SYN_REPORT 0".
    This value means that the output buffer is full, and the user space
    is loosing events.

    Using .input_configured guarantees that the race is not occuring, and that
    the call of "input_set_events_per_packet(input, 60)" is taken into account
    by input_register().

    Fixes:
    https://bugzilla.redhat.com/show_bug.cgi?id=908604

    Cc: stable@vger.kernel.org
    Reported-and-Tested-By: Clarke Wixon
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

25 Feb, 2013

1 commit


03 Jan, 2013

1 commit

  • Use the new module_hid_driver macro in all HID drivers that have
    a simple register/unregister init/exit.

    This also converts the hid drivers that test for a failure of
    hid_register_driver() and report the failure. Using module_hid_driver
    in those drivers removes the failure message.

    Signed-off-by: H Hartley Sweeten
    Signed-off-by: Jiri Kosina

    H Hartley Sweeten
     

20 Sep, 2012

1 commit


05 Jul, 2012

2 commits

  • The driver for Apple Magic Trackpad/Mouse currently uses
    Multi-touch Protocol A (MT-A) to report touch events and uses
    ABS_MT_TRACKING_ID to do finger tracking. The fact of the device
    being able to track individual finger makes it possible to
    report touch events using MT-B. This patch converts the driver
    to use MT-B as it is preferred to MT-A.

    V4: Removed BTN_TOUCH evnet.
    V3: Removed the single touch related logic.
    V2: Converting entirely to MT-B as Henrik Rydberg suggested.

    Signed-off-by: Yufeng Shen
    Reviewed-and-tested-by: Henrik Rydberg
    Signed-off-by: Jiri Kosina

    Yufeng Shen
     
  • Remove the report_touches switch as it is not so useful to turn
    off reporting touch events for a touch device. Let the userspace
    to do the filtering if the turning off is needed.

    V2: Remove report_touches as suggeted by Chase Douglas

    Signed-off-by: Yufeng Shen
    Reviewed-and-tested-by: Henrik Rydberg
    Signed-off-by: Jiri Kosina

    Yufeng Shen
     

25 Jun, 2012

1 commit

  • In patch "HID: magicmouse: Adjust major / minor axes to scale",
    touch_major and touch_minor axes are scaled by a factor of
    four when reported but the max touch_major/minor is not scaled
    accordingly. This patch scales the max touch_major/minor to
    be consistent with the reported value.

    Signed-off-by: Yufeng Shen
    Acked-by: Henrik Rydberg
    Signed-off-by: Jiri Kosina

    Yufeng Shen
     

21 Feb, 2012

1 commit


21 Oct, 2011

1 commit

  • hid-magicmouse was advertising the Apple Magic Trackpad as having 2
    buttons (left and right) when it actually only has 1 button.

    Advertising multiple buttons makes Xorg disable all button 2 and 3
    emulation (using multi-finger clicks). So Xorg users don't get working
    right/middle-click emulation out of the box.

    This patch makes hid-magicmouse correctly only report one real button
    for Magic Trackpad, which in turn makes Xorg enable multi-finger click
    support to emulate right/middle buttons.

    [http://launchpad.net/bugs/862094]

    Signed-off-by: Daniel van Vugt
    Reviewed-by: Chase Douglas
    Signed-off-by: Jiri Kosina

    Daniel van Vugt
     

25 Aug, 2011

1 commit

  • This is basically a more generic respin of 23746a6 ("HID: magicmouse: ignore
    'ivalid report id' while switching modes") which got reverted later by
    c3a492.

    It turns out that on some configurations, this is actually still the case
    and we are not able to detect in runtime.

    The device reponds with 'invalid report id' when feature report switching it
    into multitouch mode is sent to it.

    This has been silently ignored before 0825411ade ("HID: bt: Wait for ACK
    on Sent Reports"), but since this commit, it propagates -EIO from the _raw
    callback .

    So let the driver ignore -EIO as response to 0xd7,0x01 report, as that's
    how the device reacts in normal mode.

    Sad, but following reality.

    This fixes https://bugzilla.kernel.org/show_bug.cgi?id=35022

    Reported-by: Chase Douglas
    Reported-by: Jaikumar Ganesh
    Tested-by: Chase Douglas
    Tested-by: Jaikumar Ganesh
    Signed-off-by: Jiri Kosina

    Jiri Kosina
     

10 Aug, 2011

1 commit

  • Add touch surface resolution information. The size of the touch surfaces
    has been determined to the hundredth of a mm.

    Cc: Jiri Kosina
    Cc: Michael Poole
    Cc: linux-input@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Chase Douglas
    [jkosina@suse.cz: update comments and commit message]
    Signed-off-by: Jiri Kosina

    Chase Douglas
     

16 Jun, 2011

1 commit


23 May, 2011

1 commit


20 May, 2011

1 commit

  • The device reponds with 'invalid report id' when feature report switching it
    into multitouch mode is sent to it.

    This has been silently ignored before 0825411ade ("HID: bt: Wait for ACK
    on Sent Reports"), but since this commit, it propagates -EIO from the _raw
    callback .

    So let the driver ignore -EIO as response to 0xd7,0x01 report, as that's
    how the device reacts in normal mode.

    Sad, but following reality.

    This fixes https://bugzilla.kernel.org/show_bug.cgi?id=35022

    Tested-by: Chase Douglas
    Signed-off-by: Jiri Kosina

    Jiri Kosina
     

08 Apr, 2011

1 commit


06 Apr, 2011

1 commit

  • The evdev buffer isn't big enough when you get many fingers on the
    device. Bump up the buffer to a reasonable size, matching what other
    multitouch devices use. Without this change, events may be discarded in
    the evdev buffer before they are read.

    Reported-by: Simon Budig
    Cc: Henrik Rydberg
    Cc: Jiri Kosina
    Cc: stable@kernel.org
    Signed-off-by: Chase Douglas
    Acked-by: Henrik Rydberg
    Signed-off-by: Jiri Kosina

    Chase Douglas
     

31 Mar, 2011

1 commit


10 Mar, 2011

1 commit

  • The magic trackpad and mouse both report touch orientation in opposite
    direction to the bcm5974 driver and what is written in
    Documents/input/multi-touch-protocol.txt. This patch reverts the
    direction, so that all in-kernel devices with this feature behave the
    same way.

    Since no known application has been utilizing this information yet, it
    seems appropriate also for stable.

    Cc: stable@kernel.org
    Cc: Michael Poole
    Signed-off-by: Henrik Rydberg
    Acked-by: Chase Douglas
    Signed-off-by: Jiri Kosina

    Henrik Rydberg
     

08 Jan, 2011

1 commit


10 Dec, 2010

1 commit

  • Neaten current uses of dev_ by adding and using
    hid specific hid_ macros.

    Convert existing uses of dev_ uses to hid_.
    Convert hid-pidff printk uses to hid_.

    Remove err_hid and use hid_err instead.

    Add missing newlines to logging messages where necessary.
    Coalesce format strings.

    Add and use pr_fmt(fmt) KBUILD_MODNAME ": " fmt

    Other miscellaneous changes:

    Add const struct hid_device * argument to hid-core functions
    extract() and implement() so hid_ can be used by them.
    Fix bad indentation in hid-core hid_input_field function
    that calls extract() function above.

    Signed-off-by: Joe Perches
    Signed-off-by: Jiri Kosina

    Joe Perches
     

09 Dec, 2010

1 commit

  • With the recent switch to having the hid layer handle standard axis
    initialization, the Magic Trackpad now reports relative axes. This would
    be fine in the normal mode, but the driver puts the device in multitouch
    mode where no relative events are generated. Also, userspace software
    depends on accurate axis information for device type detection. Thus,
    ignoring the relative axes from the Magic Trackpad is best.

    Signed-off-by: Chase Douglas
    Signed-off-by: Jiri Kosina

    Chase Douglas
     

01 Oct, 2010

1 commit

  • By visual inspection, the reported touch_major and touch_minor axes
    are roughly a factor of four too small. The factor is approximate,
    since the protocol is not known and the HID report encodes touch size
    with fewer bits than positions. This patch scales the reported values
    by a factor of four.

    Signed-off-by: Henrik Rydberg
    Signed-off-by: Chase Douglas
    Acked-by: Michael Poole
    Signed-off-by: Jiri Kosina

    Henrik Rydberg
     

24 Sep, 2010

1 commit


04 Sep, 2010

1 commit

  • The trackpad speaks a similar, but different, protocol from the magic
    mouse. However, only small code tweaks here and there are needed to make
    basic multitouch work.

    Extra logic is required for single-touch emulation of the touchpad. The
    changes made here take the approach that only one finger may emulate the
    single pointer when multiple fingers have touched the screen. Once that
    finger is raised, all touches must be raised before any further single
    touch events can be sent.

    Sometimes the magic trackpad sends two distinct touch reports as one big
    report. Simply splitting the packet in two and resending them through
    magicmouse_raw_event ensures they are handled properly.

    I also added myself to the copyright statement.

    Signed-off-by: Chase Douglas
    Acked-by: Michael Poole
    Signed-off-by: Jiri Kosina

    Chase Douglas