17 Jan, 2021

1 commit

  • commit 37309f47e2f5674f3e86cb765312ace42cfcedf5 upstream.

    As reported by syzbot below, kfifo_alloc'd memory would not be freed
    if a non-zero return value is triggered in wacom_probe. This patch
    creates and uses devm_kfifo_alloc to allocate and free itself.

    BUG: memory leak
    unreferenced object 0xffff88810dc44a00 (size 512):
    comm "kworker/1:2", pid 3674, jiffies 4294943617 (age 14.100s)
    hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    backtrace:
    [] kmalloc_array include/linux/slab.h:592 [inline]
    [] __kfifo_alloc+0xad/0x100 lib/kfifo.c:43
    [] wacom_probe+0x1a1/0x3b0 drivers/hid/wacom_sys.c:2727
    [] hid_device_probe+0x16b/0x210 drivers/hid/hid-core.c:2281
    [] really_probe+0x159/0x480 drivers/base/dd.c:554
    [] driver_probe_device+0x84/0x100 drivers/base/dd.c:738
    [] __device_attach_driver+0xee/0x110 drivers/base/dd.c:844
    [] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431
    [] __device_attach+0x122/0x250 drivers/base/dd.c:912
    [] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:491
    [] device_add+0x5ac/0xc30 drivers/base/core.c:2936
    [] hid_add_device+0x151/0x390 drivers/hid/hid-core.c:2437
    [] usbhid_probe+0x412/0x560 drivers/hid/usbhid/hid-core.c:1407
    [] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396
    [] really_probe+0x159/0x480 drivers/base/dd.c:554
    [] driver_probe_device+0x84/0x100 drivers/base/dd.c:738
    [] __device_attach_driver+0xee/0x110 drivers/base/dd.c:844

    https://syzkaller.appspot.com/bug?extid=5b49c9695968d7250a26

    Reported-by: syzbot+5b49c9695968d7250a26@syzkaller.appspotmail.com
    Signed-off-by: Ping Cheng
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina
    Signed-off-by: Greg Kroah-Hartman

    Ping Cheng
     

03 Apr, 2020

1 commit

  • We've recently switched from extracting the value of HID_DG_CONTACTMAX
    at a fixed offset (which may not be correct for all tablets) to
    injecting the report into the driver for the generic codepath to handle.
    Unfortunately, this change was made for *all* tablets, even those which
    aren't generic. Because `wacom_wac_report` ignores reports from non-
    generic devices, the contact count never gets initialized. Ultimately
    this results in the touch device itself failing to probe, and thus the
    loss of touch input.

    This commit adds back the fixed-offset extraction for non-generic devices.

    Link: https://github.com/linuxwacom/input-wacom/issues/155
    Fixes: 184eccd40389 ("HID: wacom: generic: read HID_DG_CONTACTMAX from any feature report")
    Signed-off-by: Jason Gerecke
    Reviewed-by: Aaron Armstrong Skomra
    CC: stable@vger.kernel.org # 5.3+
    Signed-off-by: Benjamin Tissoires

    Jason Gerecke
     

22 Aug, 2019

1 commit


20 Aug, 2019

1 commit

  • Addresses a few issues that were noticed when compiling with non-default
    warnings enabled. The trimmed-down warnings in the order they are fixed
    below are:

    * declaration of 'size' shadows a parameter

    * '%s' directive output may be truncated writing up to 5 bytes into a
    region of size between 1 and 64

    * pointer targets in initialization of 'char *' from 'unsigned char *'
    differ in signedness

    * left shift of negative value

    Signed-off-by: Jason Gerecke
    Reviewed-by: Aaron Armstrong Skomra
    Signed-off-by: Jiri Kosina

    Jason Gerecke
     

10 Jul, 2019

1 commit


13 Jun, 2019

1 commit

  • In the generic code path, HID_DG_CONTACTMAX was previously
    only read from the second byte of report 0x23.

    Another report (0x82) has the HID_DG_CONTACTMAX in the
    higher nibble of the third byte. We should support reading the
    value of HID_DG_CONTACTMAX no matter what report we are reading
    or which position that value is in.

    To do this we submit the feature report as a event report
    using hid_report_raw_event(). Our modified finger event path
    records the value of HID_DG_CONTACTMAX when it sees that usage.

    Fixes: 8ffffd5212846 ("HID: wacom: fix timeout on probe for some wacoms")
    Signed-off-by: Aaron Armstrong Skomra
    Signed-off-by: Jiri Kosina

    Aaron Armstrong Skomra
     

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
     

17 May, 2019

1 commit

  • Currently, the driver will attempt to set the mode on all
    devices with a center button, but some devices with a center
    button lack LEDs, and attempting to set the LEDs on devices
    without LEDs results in the kernel error message of the form:

    "leds input8::wacom-0.1: Setting an LED's brightness failed (-32)"

    This is because the generic codepath erroneously assumes that the
    BUTTON_CENTER usage indicates that the device has LEDs, the
    previously ignored TOUCH_RING_SETTING usage is a more accurate
    indication of the existence of LEDs on the device.

    Fixes: 10c55cacb8b2 ("HID: wacom: generic: support LEDs")
    Cc: # v4.11+
    Signed-off-by: Aaron Armstrong Skomra
    Reviewed-by: Jason Gerecke
    Signed-off-by: Jiri Kosina

    Aaron Armstrong Skomra
     

29 Jan, 2019

1 commit

  • The 'wacom_hid_usage_quirk' function is the intended home for fixing
    up descriptors that are buggy or that don't quite fit the mold. Commit
    578325120e was supposed to move all of these quirks but it missed the
    code to handle fixup the serial number usages for AES pens. Lets move
    this code out of 'wacom_wac_pen_usage_mapping' where it was previously
    lurking and put it into the same place as the others.

    Signed-off-by: Jason Gerecke
    Signed-off-by: Benjamin Tissoires

    Jason Gerecke
     

21 Aug, 2018

1 commit


23 Jul, 2018

1 commit


03 Jul, 2018

3 commits

  • Otherwise the switch would not catch the proper usages.

    Signed-off-by: Ping Cheng
    Reviewed-by: Ping Cheng
    Signed-off-by: Jiri Kosina

    Ping Cheng
     
  • We want to keep device-specific quirks as contained as possible so that the
    the code remains maintainable. Our 'wacom_setup_device_quirks' function is
    the usual place for this, but some quirks need to be applied to the HID
    descriptor as it is parsed. This commit introduces a new function which is
    called for each usage so that any HID-specific quirks can be applied. The
    function now houses quirks that were being done in 'wacom_feature_mapping'
    and 'wacom_usage_mapping'.

    Signed-off-by: Jason Gerecke
    Reviewed-by: Ping Cheng
    Signed-off-by: Jiri Kosina

    Jason Gerecke
     
  • Detecting the number of supported touches for a particular device used
    to be tricky, both because early forms of the driver didn't have a very
    good HID parser and because early hardware didn't always advertise the
    actual number. At the time, we added a block of code which would ensure
    that touch_max would always be equal to at least 1 on any touch device,
    and relied on setting touch_max to e.g. 2 only for the multitouch-capable
    exceptions.

    The common case has since flipped, and the driver and descriptors can
    reliably detect the number of touches supported by modern sensors.
    Because of this, it makes sense to remove the fixup code and instead
    place static declarations of "touch_max = 1" for these old devices. It
    isn't entirely clear if all 2-finger devices actually report a maximum
    number of touches so we leave these declarations still in place.

    For the eagle-eyed, the "> BAMBOO_PT" condition was originally equivalent
    to ">= TABLETPC", which is what the intent was. This commit doesn't have
    to consider the types introduced in the interim since they shouldn't be
    affected, hence why only the tablet PC definitions have been modified.

    Signed-off-by: Jason Gerecke
    Reviewed-by: Ping Cheng
    Signed-off-by: Jiri Kosina

    Jason Gerecke
     

20 Jun, 2018

2 commits

  • Pull HID fixes from Jiri Kosina:

    - Wacom 2nd-gen Intuos Pro large Y axis handling fix from Jason Gerecke

    - fix for hibernation in Intel ISH driver, from Even Xu

    - crash fix for hid-steam driver, from Rodrigo Rivas Costa

    - new device ID addition to google-hammer driver

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
    HID: wacom: Correct logical maximum Y for 2nd-gen Intuos Pro large
    HID: intel_ish-hid: ipc: register more pm callbacks to support hibernation
    HID: steam: use hid_device.driver_data instead of hid_set_drvdata()
    HID: google: Add support for whiskers

    Linus Torvalds
     
  • The HID descriptor for the 2nd-gen Intuos Pro large (PTH-860) contains
    a typo which defines an incorrect logical maximum Y value. This causes
    a small portion of the bottom of the tablet to become unusable (both
    because the area is below the "bottom" of the tablet and because
    'wacom_wac_event' ignores out-of-range values). It also results in a
    skewed aspect ratio.

    To fix this, we add a quirk to 'wacom_usage_mapping' which overwrites
    the data with the correct value.

    Signed-off-by: Jason Gerecke
    CC: stable@vger.kernel.org # v4.10+
    Signed-off-by: Jiri Kosina

    Jason Gerecke
     

13 Jun, 2018

1 commit

  • The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
    This patch replaces cases of:

    devm_kzalloc(handle, a * b, gfp)

    with:
    devm_kcalloc(handle, a * b, gfp)

    as well as handling cases of:

    devm_kzalloc(handle, a * b * c, gfp)

    with:

    devm_kzalloc(handle, array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    devm_kcalloc(handle, array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    devm_kzalloc(handle, 4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    Some manual whitespace fixes were needed in this patch, as Coccinelle
    really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    expression HANDLE;
    type TYPE;
    expression THING, E;
    @@

    (
    devm_kzalloc(HANDLE,
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression HANDLE;
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    expression HANDLE;
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    expression HANDLE;
    identifier SIZE, COUNT;
    @@

    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression HANDLE;
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression HANDLE;
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    expression HANDLE;
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression HANDLE;
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression HANDLE;
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
    |
    devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2, ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

25 Apr, 2018

1 commit


16 Feb, 2018

1 commit

  • Follow the change of return type u32 of hid_report_len,
    fix all the types of variables those get the return value of
    hid_report_len to u32, and all other code already uses u32.

    Cc: stable@vger.kernel.org
    Signed-off-by: Aaron Ma
    Signed-off-by: Jiri Kosina

    Aaron Ma
     

23 Jan, 2018

1 commit

  • Background: ExpressKey Remotes communicate their events via usb dongle.
    Each dongle can hold up to 5 pairings at one time and one EKR (identified
    by its serial number) can unfortunately be paired with its dongle
    more than once. The pairing takes place in a round-robin fashion.

    Input devices are only created once per EKR, when a new serial number
    is seen in the list of pairings. However, if a device is created for
    a "higher" paring index and subsequently a second pairing occurs at a
    lower pairing index, unpairing the remote with that serial number from
    any pairing index will currently cause a driver crash. This occurs
    infrequently, as two remotes are necessary to trigger this bug and most
    users have only one remote.

    As an illustration, to trigger the bug you need to have two remotes,
    and pair them in this order:

    1. slot 0 -> remote 1 (input device created for remote 1)
    2. slot 1 -> remote 1 (duplicate pairing - no device created)
    3. slot 2 -> remote 1 (duplicate pairing - no device created)
    4. slot 3 -> remote 1 (duplicate pairing - no device created)
    5. slot 4 -> remote 2 (input device created for remote 2)

    6. slot 0 -> remote 2 (1 destroyed and recreated at slot 1)
    7. slot 1 -> remote 2 (1 destroyed and recreated at slot 2)
    8. slot 2 -> remote 2 (1 destroyed and recreated at slot 3)
    9. slot 3 -> remote 2 (1 destroyed and not recreated)
    10. slot 4 -> remote 2 (2 was already in this slot so no changes)

    11. slot 0 -> remote 1 (The current code sees remote 2 was paired over in
    one of the dongle slots it occupied and attempts
    to remove all information about remote 2 [1]. It
    calls wacom_remote_destroy_one for remote 2, but
    the destroy function assumes the lowest index is
    where the remote's input device was created. The
    code "cleans up" the other remote 2 pairings
    including the one which the input device was based
    on, assuming they were were just duplicate
    pairings. However, the cleanup doesn't call the
    devres release function for the input device that
    was created in slot 4).

    This issue is fixed by this commit.

    [1] Remote 2 should subsequently be re-created on the next packet from the
    EKR at the lowest numbered slot that it occupies (here slot 1).

    Fixes: f9036bd43602 ("HID: wacom: EKR: use devres groups to manage resources")
    Cc: stable #4.9
    Signed-off-by: Aaron Armstrong Skomra
    Signed-off-by: Jiri Kosina

    Aaron Armstrong Skomra
     

21 Nov, 2017

1 commit

  • Userspace expects to receive tool type and serial number information
    for the active pen in the very first kernel report, if such data is
    supported by the hardware. While this expectation is not an issue for
    EMR devices, AES sensors will often send several packets worth of in-
    range data before relaying type/serial data to the kernel. Sending this
    data "late" can result in proximity-tracking issues by xf86-input-wacom,
    or an inability to distinguish different pens by input-wacom.

    Options for dealing with this situation include ignoring reports from
    the tablet until we get the necessary data, or using the information
    from the last-seen pen instead of the (eventual) real data. Neither
    option is particularly attractive: the former results in truncated
    strokes and the latter causes issues with switching between pens.

    This commit instead opts to queue up events with missing information
    until we receive a report which contains it. At that point, we can
    update the driver's state variables (id[0] and serial[0]) and replay
    the queued events.

    Signed-off-by: Jason Gerecke
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Jason Gerecke
     

15 Nov, 2017

1 commit


10 Nov, 2017

1 commit

  • The Dell Canvas exports 2 collections for the Pen part. The only
    difference between the 2 is that the default one has half the resolution
    of the second one.

    The Windows driver switches the tablet into the second mode, so we should
    behave the same.

    Signed-off-by: Benjamin Tissoires
    Reviewed-by: Jason Gerecke

    Benjamin Tissoires
     

02 Oct, 2017

1 commit

  • The wacom_get_hdev_data function is used to find and return a reference to
    the "other half" of a Wacom device (i.e., the touch device associated with
    a pen, or vice-versa). To ensure these references are properly accounted
    for, the function is supposed to automatically increment the refcount before
    returning. This was not done, however, for devices which have pen & touch
    on different interfaces of the same USB device. This can lead to a WARNING
    ("refcount_t: underflow; use-after-free") when removing the module or device
    as we call kref_put() more times than kref_get(). Triggering an "actual" use-
    after-free would be difficult since both devices will disappear nearly-
    simultaneously. To silence this warning and prevent the potential error, we
    need to increment the refcount for all cases within wacom_get_hdev_data.

    Fixes: 41372d5d40 ("HID: wacom: Augment 'oVid' and 'oPid' with heuristics for HID_GENERIC")
    Cc: # v4.9+
    Signed-off-by: Jason Gerecke
    Reviewed-by: Ping Cheng
    Signed-off-by: Jiri Kosina

    Jason Gerecke
     

06 Sep, 2017

1 commit

  • Commit a50aac7193f1 introduces 'led.groups' and adds EKR support
    for these groups. However, unlike the other devices with LEDs,
    the EKR's LEDs are read-only and we shouldn't attempt to control
    them in wacom_led_control().

    See bug: https://sourceforge.net/p/linuxwacom/bugs/342/

    Fixes: a50aac7193f1 ("HID: wacom: leds: dynamically allocate LED groups")
    Cc: stable # 4.9
    Signed-off-by: Aaron Armstrong Skomra
    Reviewed-by: Jason Gerecke
    Signed-off-by: Jiri Kosina

    Aaron Armstrong Skomra
     

27 Jul, 2017

1 commit

  • The 'wacom_update_name' function is responsible for producing names for
    the input device nodes based on the hardware device name. Commit f2209d4
    added the ability to strip off prefixes like "Wacom Co.,Ltd." where the
    prefix was immediately (and redundantly) followed by "Wacom". The
    2nd-generation Intuos Pro 2 has such a prefix, but with a small error
    (the period and comma are swapped) that prevents the existing code from
    matching it. We're loath to extend the number of cases out endlessly and
    so instead try to be smarter about name generation.

    We observe that the cause of the redundant prefixes is HID combining the
    manufacturer and product strings of USB devices together. By using the
    original product name (with "Wacom" prefixed, if it does not already
    exist in the string) we can bypass the gyrations to find and remove
    redundant prefixes. Other devices either don't have a manufacturer string
    that needs to be removed (Bluetooth, uhid) or should have their name
    generated from scratch (I2C).

    Signed-off-by: Jason Gerecke
    Acked-By: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Jason Gerecke
     

20 Jul, 2017

1 commit


06 May, 2017

1 commit

  • At the moment, our driver relies on 'wacom_battery_get_property()' to
    determine the most likely battery state (e.g charging, discharging, or
    full) based on the information available. It is not always possible
    for the function to properly determine this, however. For instance,
    whenever an AES pen leaves proximity the battery state becomes
    indeterminite. This commit adds the ability to provide it with explict
    state information if desired. Whenever explicit state is not required
    (the majority of circumstances), WACOM_POWER_SUPPLY_STATUS_AUTO can
    be used in its place.

    Three uses of explicit battery status are added: two wireless disconnect
    paths and the AES case mentioned above.

    Signed-off-by: Jason Gerecke
    Reviewed-by: Ping Cheng
    Signed-off-by: Jiri Kosina

    Jason Gerecke
     

02 May, 2017

1 commit


30 Mar, 2017

2 commits

  • Commit a544c619a54b ("HID: wacom: do not attempt to switch mode
    while in probe") introduces delayed work for querying (setting the
    mode) on all tablets. Bamboo Touch (056a:00d0) has a ghost
    interface which claims to be a pen device. Though this device can
    be removed, we have to set the mode on the ghost pen interface
    before we remove it. After the aforementioned delay was introduced
    the device was being removed before the mode setting could be
    executed.

    Signed-off-by: Aaron Armstrong Skomra
    Signed-off-by: Jiri Kosina

    Aaron Armstrong Skomra
     
  • A previous commit (below) adds a check for already probed interfaces to
    Wacom's matching heuristic. Unfortunately this causes the Bamboo Pen
    (CTL-460) to match itself to its 'ghost' touch interface. After
    subsequent changes to the driver this match to the ghost causes the
    kernel to crash. This patch avoids calling wacom_add_shared_data()
    for the BAMBOO_PEN's ghost touch interface.

    Fixes: 41372d5d40e7 ("HID: wacom: Augment 'oVid' and 'oPid' with heuristics for HID_GENERIC")
    Cc: stable # 4.9
    Signed-off-by: Aaron Armstrong Skomra
    Signed-off-by: Jiri Kosina

    Aaron Armstrong Skomra
     

21 Mar, 2017

1 commit

  • Commit 5b779fc introduces the manual release of resources in wacom_remove() as
    an addition to the driver's use of devm. The EKR resources can only be
    released through wacom_remote_destroy_one() so we skip the manual release for
    it.

    Fixes: 5b779fc ("HID: wacom: release the resources before leaving despite devm")
    Signed-off-by: Aaron Armstrong Skomra
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Aaron Armstrong Skomra
     

06 Mar, 2017

2 commits

  • Wacom Cintiq Pro has a softkey to turn touch on/off. Since it is
    a softkey, hardware/firmware still reports touch events no matter
    what state the softkey is. We need to ignore touch events when
    the key is in off mode.

    Signed-off-by: Ping Cheng
    Reviewed-by: Benjamin Tissoires
    Tested-by: Aaron Armstrong Skomra
    Signed-off-by: Jiri Kosina

    Ping Cheng
     
  • Wacom Cintiq Pro added a touch key to switch the tablet between
    display and opaque mode. This patch informs the change by removing
    the old devices and creating new ones with proper properties.

    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Ping Cheng
    Tested-by: Aaron Armstrong Skomra
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

20 Feb, 2017

1 commit


27 Jan, 2017

5 commits

  • Add support for the LEDs around the mode switch to the generic code path in
    support of the second generation Intuos Pro.

    Signed-off-by: Aaron Skomra
    Reviewed-by: Ping Cheng
    Signed-off-by: Jiri Kosina

    Aaron Armstrong Skomra
     
  • The second generation Intuos Pro is the first device in the generic codepath
    which has a touchswitch. We utilize a flag in wacom_shared in order to report
    this switch event received from the pad on the touch input.

    Signed-off-by: Aaron Skomra
    Reviewed-by: Ping Cheng
    Signed-off-by: Jiri Kosina

    Aaron Armstrong Skomra
     
  • Add vendor defined touch to support the second generation Intuos Pro.
    Previously all generic Wacom devices used true HID to report their touch.

    Signed-off-by: Aaron Skomra
    Reviewed-by: Ping Cheng
    Signed-off-by: Jiri Kosina

    Aaron Armstrong Skomra
     
  • In addition to its USB interface, the second-generation Intuos Pro
    includes a Bluetooth radio that offers two pairing interfaces: classic
    and low-energy. The classic interface functions just like the earlier
    Bluetooth-enabled Intuos4 and Graphire4 tablets, appearing as a HID device
    that our driver can work with. The low-energy interface is intented to
    be used by userspace applications that make use of its paper-to-digital
    capabilities.

    Despite the USB interface using Wacom's new vendor-defined HID usages,
    the Bluetooth interface provides us with useless black-box "blob"
    report descriptors like past devices. We thus have to explicitly add
    support for the PIDs and reports used.

    These devices pack a /lot/ of information into a single Bluetooth
    input report. Each report contains up to seven snapshots of the pen
    state, four snapshots of the touch state (of five touches each), pad
    state, and battery data. Thankfully this isn't too hard for the driver
    to report -- it just takes a fair amount of code to extract!

    Signed-off-by: Jason Gerecke
    Reviewed-by: Ping Cheng
    Signed-off-by: Jiri Kosina

    Jason Gerecke
     
  • Centralize our definition of report IDs by moving those for device commands
    into wacom_wac.h alongside those for input reports.

    Signed-off-by: Jason Gerecke
    Reviewed-by: Ping Cheng
    Signed-off-by: Jiri Kosina

    Jason Gerecke