17 May, 2016

3 commits


03 May, 2016

2 commits

  • Commit 7e12978 ("HID: wacom: break out wacom_intuos_get_tool_type") by accident
    removed stylus_in_proximity flag for Intuos series while shuffling the code
    around.

    Fix that by reintroducing that flag setting in wacom_intuos_inout(), where
    it originally was.

    Fixes: 7e12978 ("HID: wacom: break out wacom_intuos_get_tool_type")
    Signed-off-by: Ping Cheng
    Signed-off-by: Jiri Kosina

    Ping Cheng
     
  • The fuzz present on the distance and tilt axes is noticable when a puck is
    present, and userspace (specifically libinput) would like the ability to
    filter out the noise. To facilitate this, we assign a fuzz value of '1'
    for the distance and tilt axes. This is large enough to cover most of the
    natural variation in distance value as the puck is moved around, and
    enough to cover the jitter in rotation (reported through tilt axes) when
    the puck is left alone.

    Signed-off-by: Jason Gerecke
    Signed-off-by: Jiri Kosina

    Jason Gerecke
     

27 Apr, 2016

1 commit

  • These devices feature multiple interfaces/endpoints: a legacy BIOS/boot
    interface (endpoint 0x81), as well as 2 corsair-specific keyboard interfaces
    (endpoint 0x82, 0x83 IN/0x03 OUT) and an RGB LED control interface (endpoint
    0x84 IN/0x04 OUT)

    Because the extra 3 interfaces are not of subclass USB_INTERFACE_SUBCLASS_BOOT,
    HID_QUIRK_NOGET is not automatically set on them and a 10s timeout per-endpoint
    (30s per device) occurs initialising reports on boot. We configure
    HID_QUIRK_NO_INIT_REPORTS for these devices.

    Additionally the left-side G1-G18 macro keys on the K95RGB generate output on
    the un-opened 0x82/0x83 endpoints which causes the keyboard to stop responding
    waiting for this event to be collected. We enable HID_QUIRK_ALWAYS_POLL to
    prevent this situation from occurring.

    Signed-off-by: Trent Lloyd
    Tested-by: SUGNIAUX Wilfried
    Signed-off-by: Jiri Kosina

    Trent Lloyd
     

25 Apr, 2016

2 commits


18 Apr, 2016

2 commits


13 Apr, 2016

1 commit


12 Apr, 2016

1 commit

  • Pull HID fixes from Jiri Kosina:

    - fix for how scaling linearization is computed in wiimote driver, by
    Cyan Ogilvie

    - endless retry loop fix in generic USB HID core reset-resume handling,
    by Alan Stern

    - two functional fixes affecting particular devices, and oops fix for
    wacom driver, by Jason Gerecke

    - multitouch slot numbering fix from Gabriele Mazzotta

    - a couple more small fixes on top

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
    HID: wacom: Support switching from vendor-defined device mode on G9 and G11
    HID: wacom: Initialize hid_data.inputmode to -1
    HID: microsoft: add support for 3 more devices
    HID: multitouch: Synchronize MT frame on reset_resume
    HID: wacom: fix Bamboo ONE oops
    HID: lenovo: Don't use stack variables for DMA buffers
    HID: usbhid: fix inconsistent reset/resume/reset-resume behavior
    HID: wiimote: Fix wiimote mp scale linearization

    Linus Torvalds
     

07 Apr, 2016

1 commit

  • The 'size' variable is not really needed, and we can also shift constant
    in the loop body when masking off existing bits.

    Also we do not have to use 64 bit calculations if we take an extra
    branch.

    [jkosina@suse.cz: fix a small error in changelog]
    Suggested-by: Doug Anderson
    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Douglas Anderson
    Signed-off-by: Jiri Kosina

    Dmitry Torokhov
     

05 Apr, 2016

2 commits

  • A tablet PC booted into Windows may have its pen/touch hardware switched
    into "Wacom mode" similar to what we do with explicitly-supported hardware.
    Some devices appear to maintain this state across reboots, preventing their
    use with the generic HID driver. This patch adds support for detecting the
    presence of the mode switch feature report used by devices based on the G9
    and G11 chips and has the HID codepath always attempt to reset the device
    back to sending standard HID reports.

    Fixes: https://sourceforge.net/p/linuxwacom/bugs/307/
    Fixes: https://sourceforge.net/p/linuxwacom/bugs/310/
    Fixes: https://github.com/linuxwacom/input-wacom/issues/15

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

    Jason Gerecke
     
  • Commit 5ae6e89 introduced hid_data.inputmode with a comment that it
    would have the value -1 if undefined, but then forgot to actually
    perform the initialization. Although this doesn't appear to have
    caused any problems in practice, it should still be remedied.

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

    Jason Gerecke
     

04 Apr, 2016

4 commits


01 Apr, 2016

2 commits

  • Asus X205TA built-in keyboard contains wrong
    logical maximum value in report descriptor.

    0x05, 0x01, // Usage Page (Generic Desktop)
    0x09, 0x06, // Usage (Keyboard)
    0xa1, 0x01, // Collection (Application)
    0x85, 0x01, // Report ID (1)
    0x05, 0x07, // Usage Page (Keyboard/Keypad)
    0x19, 0xe0, // Usage Minimum (224)
    0x29, 0xe7, // Usage Maximum (231)
    0x15, 0x00, // Logical Minimum (0)
    0x25, 0x01, // Logical Maximum (1)
    0x75, 0x01, // Report Size (1)
    0x95, 0x08, // Report Count (8)
    0x81, 0x02, // Input (Data,Array,Abs)
    0x95, 0x01, // Report Count (1)
    0x75, 0x08, // Report Size (8)
    0x81, 0x03, // Input (Const,Var,Abs)
    0x95, 0x05, // Report Count (5)
    0x75, 0x01, // Report Size (1)
    0x05, 0x08, // Usage (LED)
    0x19, 0x01, // Usage Minimum (1)
    0x29, 0x05, // Usage Maximum (5)
    0x91, 0x02, // Output (Data,Var,Abs)
    0x95, 0x01, // Report Count (1)
    0x75, 0x03, // Report Size (3)
    0x91, 0x03, // Output (Const,Var,Abs)
    0x95, 0x06, // Report Count (6)
    0x75, 0x08, // Report Size (8)
    0x15, 0x00, // Logical Minimum (0)
    0x25, 0x65, // Logical Maximum (101) * too small *
    0x05, 0x07, // Usage Page (Keyboard/Keypad)
    0x19, 0x00, // Usage Minimum (0)
    0x29, 0xdd, // Usage Maximum (221)
    0x81, 0x00, // Input(Data,Array,Abs)

    In Asus X205TA japanese keyboard model,there are language
    specific keys over usage id 101.
    This patch correct wrong logical maximum in report
    descriptor.

    Signed-off-by: Yusuke Fujimaki
    Signed-off-by: Jiri Kosina

    Yusuke Fujimaki
     
  • input_mt_get_slot_by_key() requires input_mt_sync_frame() to be called
    at each frame. Do it when releasing the touches, or else we won't get
    a proper slot number after mt_reset_resume().

    Signed-off-by: Gabriele Mazzotta
    Reviewed-by: Benson Leung
    Reviewed-by: Benjamin TIssoires
    Signed-off-by: Jiri Kosina

    Gabriele Mazzotta
     

29 Mar, 2016

2 commits

  • Looks like recent changes in the Wacom driver made the Bamboo ONE crashes.
    The tablet behaves as if it was a regular Bamboo device with pen, touch
    and pad, but there is no physical pad connected to it.
    The weird part is that the pad is still sending events and given that
    there is no input node connected to it, we get anull pointer exception.

    Link: https://bugzilla.redhat.com/show_bug.cgi?id=1317116

    Signed-off-by: Benjamin Tissoires
    Acked-by: Ping Cheng
    Cc: stable@vger.kernel.org
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     
  • The lenovo_send_cmd_cptkbd function uses a stack variable to submit
    commands via hid_hw_raw_request. Eventually this gets to the
    usb_hcd_map_urb_for_dma function, which causes a warning to be thrown
    if the CONFIG_DMA_API_DEBUG option is enabled.

    Fix this by allocating a temporary buffer instead.

    [jkosina@suse.cz: no need to NULL-initialize buf, spotted by Benjamin]
    Reported-by: lejeczek
    Signed-off-by: Josh Boyer
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Josh Boyer
     

24 Mar, 2016

2 commits

  • The usbhid driver has inconsistently duplicated code in its post-reset,
    resume, and reset-resume pathways.

    reset-resume doesn't check HID_STARTED before trying to
    restart the I/O queues.

    resume fails to clear the HID_SUSPENDED flag if HID_STARTED
    isn't set.

    resume calls usbhid_restart_queues() with usbhid->lock held
    and the others call it without holding the lock.

    The first item in particular causes a problem following a reset-resume
    if the driver hasn't started up its I/O. URB submission fails because
    usbhid->urbin is NULL, and this triggers an unending reset-retry loop.

    This patch fixes the problem by creating a new subroutine,
    hid_restart_io(), to carry out all the common activities. It also
    adds some checks that were missing in the original code:

    After a reset, there's no need to clear any halted endpoints.

    After a resume, if a reset is pending there's no need to
    restart any I/O until the reset is finished.

    After a resume, if the interrupt-IN endpoint is halted there's
    no need to submit the input URB until the halt has been
    cleared.

    Signed-off-by: Alan Stern
    Reported-by: Daniel Fraga
    Tested-by: Daniel Fraga
    CC:
    Signed-off-by: Jiri Kosina

    Alan Stern
     
  • Instead of open-coding memory allocation and copying form user memory
    sequence let's use memdup_user().

    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Dmitry Torokhov
     

23 Mar, 2016

1 commit


19 Mar, 2016

1 commit

  • The wiimote motion plus gyros use two scales to report fast and slow
    rotation - below 440 deg/s uses 8192/440 units / deg/s, and above uses
    8192/2000 units / deg/s.

    Previously this driver attempted to linearize the two by scaling the fast
    rate by 18 and the slow by 9, but this results in a scale of
    8192*9/440 = ~167.564 for slow and 8192*18/2000 = 73.728 for fast.

    Correct the fast motion scale factor so that both report ~167.564
    units / deg/s

    Signed-off-by: Cyan Ogilvie
    Reviewed-by: David Herrmann
    Signed-off-by: Jiri Kosina

    Cyan Ogilvie
     

18 Mar, 2016

1 commit

  • Pull HID updates from Jiri Kosina:

    - functionally equivalent cleanups for wacom driver, making the code
    more readable, from Benjamin Tissoires

    - a bunch of improvements and fixes for thingm driver from Heiner
    Kallweit

    - bugfixes to out-of-bound access for generic parsing functions (which
    have been there since ever) extract() and implement(), from Dmitry
    Torokhov

    - a lot of added / improved device support in sony, wacom, microsoft,
    multitouch and logitech driver, from various people

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (44 commits)
    HID: microsoft: Add ID for MS Wireless Comfort Keyboard
    hid: thingm: reorder calls in thingm_probe
    HID: i2c-hid: fix OOB write in i2c_hid_set_or_send_report()
    HID: multitouch: Release all touch slots on reset_resume
    HID: usbhid: enable NO_INIT_REPORTS quirk for Semico USB Keykoard2
    HID: penmount: report only one button for PenMount 6000 USB touchscreen controller
    HID: i2c-hid: Fix suspend/resume when already runtime suspended
    HID: i2c-hid: Add hid-over-i2c name to i2c id table
    HID: multitouch: force retrieving of Win8 signature blob
    HID: Support for CMedia CM6533 HID audio jack controls
    HID: thingm: improve locking
    HID: thingm: switch to managed version of led_classdev_register
    HID: thingm: remove workqueue
    HID: corsair: fix mapping of non-keyboard usages
    HID: wacom: close the wireless receiver on remove()
    HID: wacom: cleanup input devices
    HID: wacom: reuse wacom_parse_and_register() in wireless_work
    HID: wacom: move down wireless_work()
    HID: wacom: break out parsing of device and registering of input
    HID: wacom: break out wacom_intuos_get_tool_type
    ...

    Linus Torvalds
     

17 Mar, 2016

1 commit


16 Mar, 2016

1 commit

  • Microsoft Wireless Comfort Keyboard has vendor specific My Favorites
    1-5 keys. Linux already supports this buttons on other MS keyboards by
    MS_ERGONOMY quirk. So apply MS_ERGONOMY quirk to USB PID 0x00e3
    (Microsoft Wireless Optical Desktop Receiver 3.0A). After this
    My Favorites 1..5 keys will be reported as KEY_F14..KEY_F15 events.

    Signed-off-by: Slava Bacherikov
    Signed-off-by: Jiri Kosina

    Slava Bacherikov
     

15 Mar, 2016

2 commits

  • When reviewing another thingm patch Benjamin Tissoires pointed out
    the following: "The problem here is that hid_hw_start() is called
    before thingm_version() which allows user space to briefly introduce
    races between thingm_version() and any hidraw requests.
    The mutex will not help here as it is initialized after hid_hw_start()
    and only used for protecting the concurrent access of the rgb."

    Avoid this possible issue by calling hid_hw_start() later in the
    probe function.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Jiri Kosina

    Heiner Kallweit
     
  • Even though hid_hw_* checks that passed in data_len is less than
    HID_MAX_BUFFER_SIZE it is not enough, as i2c-hid does not necessarily
    allocate buffers of HID_MAX_BUFFER_SIZE but rather checks all device
    reports and select largest size. In-kernel users normally just send as much
    data as report needs, so there is no problem, but hidraw users can do
    whatever they please:

    BUG: KASAN: slab-out-of-bounds in memcpy+0x34/0x54 at addr ffffffc07135ea80
    Write of size 4101 by task syz-executor/8747
    CPU: 2 PID: 8747 Comm: syz-executor Tainted: G BU 3.18.0 #37
    Hardware name: Google Tegra210 Smaug Rev 1,3+ (DT)
    Call trace:
    [] dump_backtrace+0x0/0x258 arch/arm64/kernel/traps.c:83
    [] show_stack+0x1c/0x2c arch/arm64/kernel/traps.c:172
    [< inline >] __dump_stack lib/dump_stack.c:15
    [] dump_stack+0x90/0x140 lib/dump_stack.c:50
    [< inline >] print_error_description mm/kasan/report.c:97
    [< inline >] kasan_report_error mm/kasan/report.c:278
    [] kasan_report+0x268/0x530 mm/kasan/report.c:305
    [] __asan_storeN+0x20/0x150 mm/kasan/kasan.c:718
    [] memcpy+0x30/0x54 mm/kasan/kasan.c:299
    [] __i2c_hid_command+0x2b0/0x7b4 drivers/hid/i2c-hid/i2c-hid.c:178
    [< inline >] i2c_hid_set_or_send_report drivers/hid/i2c-hid/i2c-hid.c:321
    [] i2c_hid_output_raw_report.isra.2+0x3d4/0x4b8 drivers/hid/i2c-hid/i2c-hid.c:589
    [] i2c_hid_output_report+0x54/0x68 drivers/hid/i2c-hid/i2c-hid.c:602
    [< inline >] hid_hw_output_report include/linux/hid.h:1039
    [] hidraw_send_report+0x400/0x414 drivers/hid/hidraw.c:154
    [] hidraw_write+0x40/0x64 drivers/hid/hidraw.c:177
    [] vfs_write+0x1d4/0x3cc fs/read_write.c:534
    [< inline >] SYSC_pwrite64 fs/read_write.c:627
    [] SyS_pwrite64+0xec/0x144 fs/read_write.c:614
    Object at ffffffc07135ea80, in cache kmalloc-512
    Object allocated with size 268 bytes.

    Let's check data length against the buffer size before attempting to copy
    data over.

    Cc: stable@vger.kernel.org
    Reported-by: Alexander Potapenko
    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Dmitry Torokhov
     

14 Mar, 2016

1 commit

  • When resetting a device (especially after power loss) it is unlikely
    that the firmware will keep the contact tracking data for the previous
    touches and will be able to reconcile it with the new contacts, so
    let's release all slots on reset resume as start anew.

    Signed-off-by: Benson Leung
    Signed-off-by: Dmitry Torokhov
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benson Leung
     

11 Mar, 2016

2 commits

  • The device which identifies itself as a "USB Keykoard" (no typo)
    with VID:PID 1a2c:0027 does not seem to be handling the reports
    initialization very well.

    This results in a "usb_submit_urb(ctrl) failed: -1" message from the
    kernel when connected, and a delay before its initialization. It can
    also cause the hang the system.

    This patch adds the quirk for this device, which causes the delay
    to disappear. It is named as "USB Keykoard2" because the "USB Keykoard"
    already exists.

    Signed-off-by: Daniel Bristot de Oliveira
    Signed-off-by: Jiri Kosina

    Daniel Bristot de Oliveira
     
  • PenMount 6000 USB resistive touchscreen controller reports it has three
    buttons, while in reality it doesn't have any and doesn't support active
    styli, and only generates touch events.

    In penmount_input_mapping(), map only the first button (with code 0),
    ignore the rest.

    Signed-off-by: Andrew Shadura
    Tested-by: Christian Gmeiner

    Andrew Shadura
     

10 Mar, 2016

2 commits

  • On ACPI-based systems ACPI power domain code runtime resumes device before
    calling suspend method, which ensures that i2c-hid suspend code starts with
    device not in low-power state and with interrupts enabled.

    On other systems, especially if device is not a part of any power domain,
    we may end up calling driver's system-level suspend routine while the
    device is runtime-suspended (with controller in presumably low power state
    and interrupts disabled). This will result in interrupts being essentially
    disabled twice, and we will only re-enable them after both system resume
    and runtime resume methods complete. Unfortunately i2c_hid_resume() calls
    i2c_hid_hwreset() and that only works properly if interrupts are enabled.

    Also if device is runtime-suspended driver's suspend code may fail if it
    tries to issue I/O requests.

    Let's fix it by runtime-resuming the device if we need to run HID driver's
    suspend code and also disabling interrupts only if device is not already
    runtime-suspended. Also on resume we mark the device as running at full
    power (since that is what resetting will do to it).

    Reviewed-by: Benson Leung
    Tested-by: Mika Westerberg
    Acked-by: Benjamin Tissoires
    Signed-off-by: Doug Anderson
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Jiri Kosina

    Doug Anderson
     
  • When using the device tree binding OF compatible = "hid-over-i2c" the
    i2c id table also needs to have that name in order to auto load this
    driver, since i2c core reports module alias as i2c: where
    is compatible string of OF binding stripped of manufacturer's
    prefix.

    Tested-by: Andrew Duggan
    Acked-by: Benjamin Tissoires
    Signed-off-by: Benson Leung
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Jiri Kosina

    Benson Leung
     

08 Mar, 2016

1 commit

  • The Synaptics 0x11e5 over I2C found in the Asus T100-CHI requires to
    fetch the signature blob to actually start sending events.

    With this patch, we should be close enough to the Windows driver which
    checks the content of the blob at plugin to validate or not the
    touchscreen.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=113481
    Fixes: 6d4f5440 ("HID: multitouch: Fetch feature reports on demand for Win8 devices")
    Cc: stable@vger.kernel.org
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

02 Mar, 2016

2 commits

  • The C-Media CM6533 is a USB audio chip featuring it's jack detection
    capability.The device originates an interrupt transfer via HID interface each
    time when a jack event occurs. The purpose of this patch is to handle hid raw
    events to keep the operating system informed of user interactions.

    Signed-off-by: Ben Chen
    Signed-off-by: Jiri Kosina

    Ben Chen
     
  • Reading from the device consists of two operations: sending the read
    command and the actual read from the device. If the device is accessed
    in between we might read wrong data. Therefore protect the full sequence
    of both operations with a mutex.
    Also change the semantics of thingm_recv to include both operations.

    Signed-off-by: Heiner Kallweit
    Signed-off-by: Jiri Kosina

    Heiner Kallweit