Commit graph

2651 commits

Author SHA1 Message Date
Linus Torvalds bc75450cc3 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina:

 - Integrated Sensor Hub support (Cherrytrail+) from Srinivas Pandruvada

 - Big cleanup of Wacom driver; namely it's now using devres, and the
   standardized LED API so that libinput doesn't need to have root
   access any more, with substantial amount of other cleanups
   piggy-backing on top. All this from Benjamin Tissoires

 - Report descriptor parsing would now ignore and out-of-range System
   controls in case of the application actually being System Control.
   This fixes quite some issues with several devices, and allows us to
   remove a few ->report_fixup callbacks. From Benjamin Tissoires

 - ... a lot of other assorted small fixes and device ID additions

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (76 commits)
  HID: add missing \n to end of dev_warn messages
  HID: alps: fix multitouch cursor issue
  HID: hid-logitech: Documentation updates/corrections
  HID: hid-logitech: Improve Wingman Formula Force GP support
  HID: hid-logitech: Rewrite of descriptor for all DF wheels
  HID: hid-logitech: Compute combined pedals value
  HID: hid-logitech: Add combined pedal support Logitech wheels
  HID: hid-logitech: Introduce control for combined pedals feature
  HID: sony: Update copyright and add Dualshock 4 rate control note
  HID: sony: Defer the initial USB Sixaxis output report
  HID: sony: Relax duplicate checking for USB-only devices
  Revert "HID: microsoft: fix invalid rdesc for 3k kbd"
  HID: alps: fix error return code in alps_input_configured()
  HID: alps: fix stick device not working after resume
  HID: support for keyboard - Corsair STRAFE
  HID: alps: Fix memory leak
  HID: uclogic: Add support for UC-Logic TWHA60 v3
  HID: uclogic: Override constant descriptors
  HID: uclogic: Support UGTizer GP0610 partially
  HID: uclogic: Add support for several more tablets
  ...
2016-10-07 11:58:38 -07:00
Jiri Kosina 179023e6af Merge branches 'for-4.8/upstream-fixes', 'for-4.9/alps', 'for-4.9/hid-input', 'for-4.9/intel-ish', 'for-4.9/kye-uclogic-waltop-fixes', 'for-4.9/logitech', 'for-4.9/sony', 'for-4.9/upstream' and 'for-4.9/wacom' into for-linus 2016-10-07 09:59:48 +02:00
Masaki Ota 9a54cf462d HID: alps: fix multitouch cursor issue
Issue reproduction procedure:

1. three or more fingers put on Touchpad.
2. release fingers from Touchpad.
3. move the cursor by one finger.
4. the cursor does not move.

Cause:

We do not notify multi fingers state correctly to input subsystem.  For
example, when three fingers release from Touchpad, fingers state is 3 -> 0. It
needs to notify first, second and third finger's releasing state.

Fix this by not breaking out on z axis and move x,y,z input handling
code to the correct place so that it's in fact per-finger.

[jkosina@suse.cz: reword changelog]
Signed-off-by: Masaki Ota <masaki.ota@jp.alps.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-27 13:50:09 +02:00
Simon Wood f777a3a7bd HID: hid-logitech: Documentation updates/corrections
Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-26 15:39:56 +02:00
Simon Wood 560bea30ff HID: hid-logitech: Improve Wingman Formula Force GP support
Move ForceFeedback support for the Formula Force GP into hid-lgff4
and re-write HID descriptor, thus allowing combined pedals or not
as user desires.

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-26 15:39:56 +02:00
Simon Wood 7363b25af3 HID: hid-logitech: Rewrite of descriptor for all DF wheels
Rewrite the HID descriptor for _all_ Driving Force wheels (real
or emulated) so that they can report separate Accelerator and
Brake axis.

If the user wants a combined accel/brake axis, they can use the
'combined pedals' feature.

$ echo 1 > /sys/bus/hid/devices/<device-id>/combine_pedals

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-26 15:39:55 +02:00
Simon Wood b456634b8d HID: hid-logitech: Compute combined pedals value
Add support for computing a combined accelerator/brake axis for wheels
which don't contain combined data in their HID stream.

This includes DFGT, G25, G27, G29 and Wii-Wheel.

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-26 15:39:55 +02:00
Simon Wood c832f86eff HID: hid-logitech: Add combined pedal support Logitech wheels
Add support for reporting a combined accelerator/brake axis for wheels
which contain combined data in their HID stream.

This includes DF, MOMO, MOMO2 and DFP.

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-26 15:39:54 +02:00
Simon Wood 961af46f8e HID: hid-logitech: Introduce control for combined pedals feature
Introduce a dev_attr which can be used to combine the accelerator
and brake pedals into a single axis. This is useful for older games
which can not handle seperate accelerator and brake.

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-26 15:39:54 +02:00
Frank Praznik c4425c8f26 HID: sony: Update copyright and add Dualshock 4 rate control note
Update the copyright notice with the current year and add a note
about values for controlling the Dualshock 4 reporting rate.

Processing reports at the default full rate of 1000hz can be too
demanding for some low-power embedded processors so noting
alternate values for people working with this hardware can be useful.

Thanks to Rostislav Pehlivanov for finding these values.

Signed-off-by: Frank Praznik <frank.praznik@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-26 15:32:48 +02:00
Frank Praznik 2a24293277 HID: sony: Defer the initial USB Sixaxis output report
When initially connected via USB the Sixaxis isn't fully initialized
until the PS logo button is pressed and won't send any input reports
nor will any state set by output reports be retained.

This adds a 'defer_initialization' flag to the sony_sc struct which,
when set, will delay sending any output reports until the first input
report has arrived. This flag is used with the USB Sixaxis to ensure
that any state sent will persist since, until the PS button is pushed,
any changes sent to the controller via an output report will be lost
after a couple of seconds.

The initial state of the controller is still configured at the time
of the initial connection and won't be internally modified after that,
so any state set by the user between that time and the recepit of the
first input report won't be lost.

Signed-off-by: Frank Praznik <frank.praznik@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-26 15:32:48 +02:00
Frank Praznik 0f3982308b HID: sony: Relax duplicate checking for USB-only devices
Some USB-only devices which masquerade as Sixaxis controllers report the
same generic Bluetooth address for all hardware when queried via the HID
report. This causes these devices to be wrongly rejected as duplicates
when more than one is connected at once.

This introduces a connection type comparison when checking for duplicates
and only rejects the newly connected device if the existing matching
device is connected using a different connection protocol.

The results of the connection type comparison are also used when
registering power supply info as the device Bluetooth address is used
as the unique identifier string.  In cases where more than one valid
device has the same Bluetooth address the device ID is now appended
to the power supply name string to avoid name collisions when
registering the power supply information.

Signed-off-by: Frank Praznik <frank.praznik@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-26 15:32:47 +02:00
Michel Hermier 52dc085a50 Revert "HID: microsoft: fix invalid rdesc for 3k kbd"
This reverts commit 3ccc60f9d8.

While investigating bug https://bugzilla.kernel.org/show_bug.cgi?id=37982 ,
there was solid evidences that Microsoft reused the same report
descriptor for the its Digital Media keyboard series.

Since 1989dad "HID: input: ignore System Control application usages if not
System Controls", the keyboard series do not produce a spurious joystick
input device inode without needing to patch the problematic report
descriptor. As such the MS_RDESC_3K reportdescriptor fixup can be removed.

Signed-off-by: Michel Hermier <michel.hermier@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-26 13:47:12 +02:00
Wei Yongjun 46a41b512f HID: alps: fix error return code in alps_input_configured()
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

While at it, remove redundant input_free_device(NULL) call.

[jkosina@suse.cz: ammend changelog]
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-22 11:10:06 +02:00
Kai-Heng Feng 04fd4cb0b0 HID: alps: fix stick device not working after resume
The stick device does not work after resume, add U1_SP_ABS_MODE flag can
make the device work after resume.

This has been discovered by pure guesswork, based on how the existing code uses
U1_TP_ABS_MODE flag on both initialization and resume.

I also tested the the patch on an ALPS touchpad without stick device, did not
notice any side effect on suspend/resume, so I made the U1_SP_ABS_MODE flag
mandatory.

[jkosina@suse.cz: made changelog more verbose]
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-22 11:07:16 +02:00
Marian Krivoš 3da30bfc0b HID: support for keyboard - Corsair STRAFE
Add quirk for Corsair STRAFE keyboard, similarly to what we've been
doing for other CORSAIR devices already, in order to avoid long delays
during boot.

[jkosina@suse.cz: reword changelog a little bit]
Signed-off-by: Marian Krivos <marian.krivos@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19 16:27:37 +02:00
Axel Lin 7ee2eaa364 HID: alps: Fix memory leak
A kfree(readbuf) call was missed if hid_hw_raw_request() fails, fix it.
Also avoid mixing direct return with goto in the error paths.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19 14:42:22 +02:00
Nikolai Kondrashov 3202bb7fb0 HID: uclogic: Add support for UC-Logic TWHA60 v3
Add support for the third version of UC-Logic TWHA60, which has
three interfaces and responds to initialization.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19 14:32:24 +02:00
Nikolai Kondrashov 6e02633463 HID: uclogic: Override constant descriptors
Make uclogic_report_fixup override constant descriptors with generated
descriptors, so models reusing product ID, but working with generated
descriptor get correct one.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19 14:32:24 +02:00
Nikolai Kondrashov 18e3dfac16 HID: uclogic: Support UGTizer GP0610 partially
Add partial support for the UGTizer GP0610 tablet (aka iBall PF1064U,
aka UGTizer GT1060) to the hid-uclogic.c driver.

The pen input is supported fully, but frame buttons and wheel don't work
yet.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19 14:32:23 +02:00
Nikolai Kondrashov 4b7e7e5eda HID: uclogic: Add support for several more tablets
Add more product IDs to hid-uclogic.c driver to support several more
tablet models, including:

	UC-Logic DrawImage G3
	aka Ugee G3
	UC-Logic SP1001
	aka Ugee SP1001
	aka Yiynova UC-Logic SP-1001
	Ugee 1000L
	Ugee M708
	Yiynova DP10U
	aka Yiynova DP10U+
	Yiynova MSP19U
	Yiynova MSP19U+
	Yiynova MVP10U
	aka Yiynova MVP10U IPS
	Yiynova MVP10UHD+IPS
	Yiynova MVP22U+

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19 14:32:23 +02:00
Benjamin Tissoires 21003968cd HID: uclogic: Switch to reporting abstract button events
Based on a patch from: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>

Enable abstract keyboard mode for Huion tablets, which makes them report
frame buttons using the pen interface and report ID. Divert these
reports to a virtual report ID describing them.

This makes the tablet compatible with xf86-input-wacom and libinput,
but stops the frame buttons from reporting keyboard events.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19 14:32:23 +02:00
Nikolai Kondrashov 82d2efd2db HID: uclogic: Remove allocation failure messages
Remove unnecessary allocation failure messages from hid-uclogic.c,
following the checkpatch.pl recommendations.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19 14:32:22 +02:00
Nikolai Kondrashov 515cdc1975 HID: kye: Fix MousePen i608X v2 report descriptor
Add a dedicated, fixed report descriptor for the second version of KYE
MousePen i608X graphics tablet. The descriptor fixes pressure and
drawing area ranges.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19 14:32:22 +02:00
Nikolai Kondrashov 102750b8c9 HID: kye: Rename MousePen i608X v2 macro
Rename the device ID macro for the second version of KYE MousePen i608x
graphics tablet to have "V" in its name to signify that "2" is a
version.

I.e. USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2 ->
     USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2

This also makes applying additional fixes from DIGImend easier.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19 14:32:22 +02:00
Nikolai Kondrashov ce7ef551b9 HID: Remove broken links to tablet descriptions
Remove comments with broken links to tablet descriptions from
hid-kye/uclogic/waltop drivers.

They pointed to now dead DIGImend project wiki at sf.net. Even though
the DIGImend project still hosts descriptions, now at
digimend.github.io, it's better to avoid them going stale again, and let
anyone interested search the web instead.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19 14:32:21 +02:00
Benjamin Tissoires 1989dada7c HID: input: ignore System Control application usages if not System Controls
Microsoft is reusing its report descriptor again and again, and part of it
looks like this:

0x05, 0x01,                    // Usage Page (Generic Desktop)        299
0x09, 0x80,                    // Usage (System Control)              301
0xa1, 0x01,                    // Collection (Application)            303
0x85, 0x03,                    //  Report ID (3)                      305
0x19, 0x00,                    //  Usage Minimum (0)                  307
0x29, 0xff,                    //  Usage Maximum (255)                309
0x15, 0x00,                    //  Logical Minimum (0)                311
0x26, 0xff, 0x00,              //  Logical Maximum (255)              313
0x81, 0x00,                    //  Input (Data,Arr,Abs)               316
0xc0,                          // End Collection                      318

While there is nothing wrong in term of processing, we do however blindly
map the full usage range (it's an array) from 0x00 to 0xff, which creates
some interesting axis, like ABS_X|Y, and a bunch of ABS_MISC + n.

While libinput and other stacks don't care that much (we can detect them),
joydev is very happy and attaches itself to the mouse or keyboard.

The problem is that joydev now handles the device as a joystick, but given
that we have a HID array, it sets all the ABS_* values to 0. And in its
world, 0 means -32767 (minimum value), which sends spurious events to games
(think Steam).

It looks like hid-microsoft tries to tackle the very same problem with its
.report_fixup callback. But fixing the report descriptor is an endless task
and is quite obfuscated.

So take the hammer, and decide that if the application is meant to be
System Control, any other usage not in the System Control range should
be ignored.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1325354
Link: https://bugzilla.kernel.org/show_bug.cgi?id=28912
Link: https://github.com/ValveSoftware/steam-for-linux/issues/3384
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1325354
Link: https://bugzilla.kernel.org/show_bug.cgi?id=37982

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19 14:02:25 +02:00
PrasannaKumar Muralidharan ca75d601b5 miscdevice: Add helper macro for misc device boilerplate
Many modules call misc_register and misc_deregister in its module init
and exit methods without any additional code. This ends up being
boilerplate. This patch adds helper macro module_misc_device(), that
replaces module_init()/ module_exit() with template functions.

This patch also converts drivers to use new macro.

Change since v1:
Add device.h include in miscdevice.h as module_driver macro was not
available from other include files in some architectures.

Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-31 14:12:35 +02:00
Wei Yongjun 814cb72e25 HID: intel_ish-hid: Remove duplicated include from bus.c
Remove duplicated include.

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-29 09:36:21 +02:00
Wei Yongjun 6cf5c1c716 HID: intel_ish-hid: Use kzalloc instead of kmalloc/memset
Use kzalloc rather than kmalloc followed by memset with 0.

Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-29 09:36:20 +02:00
Wei Yongjun e8c6113595 HID: intel_ish-hid: Convert list_for_each to entry variant
convert list_for_each() to list_for_each_entry() where
applicable.

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-29 09:36:19 +02:00
Wei Yongjun 37becf6e60 HID: intel-ish-hid: use module_pci_driver to simplify the code
Use the module_pci_driver() macro to make the code simpler
by eliminating module_init and module_exit calls.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-29 09:36:19 +02:00
Wei Yongjun 67c0fe420e HID: intel-ish-hid: use list_move_tail instead of list_del/list_add_tail
Using list_move_tail() instead of list_del() + list_add_tail().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-29 09:36:19 +02:00
Yuta Kobayashi b490a8537d HID: microsoft: Add Surface 4 type cover pro 4 (JP)
Adding support for the Microsoft Surface 4 Type Cover Pro (JP).

Signed-off-by: Yuta Kobayashi <alu.ula@outlook.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-17 15:28:47 +02:00
Srinivas Pandruvada 930fafd9af HID: hid-sensor-hub: Add ISH quirk
Need enum quirk to change the base of enums to 1 for
power and report descriptors.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-17 11:13:08 +02:00
Srinivas Pandruvada 0b28cb4bcb HID: intel-ish-hid: ISH HID client driver
This driver is responsible for implementing ISH HID client, which
gets HID description and report. Once it has completely gets
report descriptors, it registers as a HID LL drivers. This implements
necessary callbacks so that it can be used by HID sensor hub driver.

Original-author: Daniel Drubin <daniel.drubin@intel.com>
Reviewed-and-tested-by: Ooi, Joyce <joyce.ooi@intel.com>
Tested-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Rann Bar-On <rb6@duke.edu>
Tested-by: Atri Bhattacharya <badshah400@aim.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-17 11:13:08 +02:00
Srinivas Pandruvada ae02e5d40d HID: intel-ish-hid: ipc layer
This layer is responsible for
- Enumerating over PCI bus
- Inform FW about host readiness
- Provide HW interface to transport layer for control and messages
- Interrupt handling and routing

Original-author: Daniel Drubin <daniel.drubin@intel.com>
Reviewed-and-tested-by: Ooi, Joyce <joyce.ooi@intel.com>
Tested-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Rann Bar-On <rb6@duke.edu>
Tested-by: Atri Bhattacharya <badshah400@aim.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-17 11:13:07 +02:00
Srinivas Pandruvada 3703f53b99 HID: intel_ish-hid: ISH Transport layer
The ISH transport layer (ishtp) is a bi-directional protocol implemented
on the top of PCI based inter processor communication layer. This layer
offers:
- Connection management
- Flow control with the firmware
- Multiple client sessions
- Client message transfer
- Client message reception
- DMA for RX and TX for fast data transfer

Refer to Documentation/hid/intel-ish-hid.txt for
overview of the functionality implemented in this layer.

Original-author: Daniel Drubin <daniel.drubin@intel.com>
Reviewed-and-tested-by: Ooi, Joyce <joyce.ooi@intel.com>
Tested-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Rann Bar-On <rb6@duke.edu>
Tested-by: Atri Bhattacharya <badshah400@aim.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-17 11:13:07 +02:00
Jason Gerecke 003f50ab67 HID: wacom: Update last_slot_field during pre_report phase
If a touchscreen contains both multitouch and single-touch reports in its
descriptor in that order, the driver may overwrite information it saved
about the format of the multitouch report. This can cause the report
processing code to get tripped up and send an incorrect event stream to
userspace.

In particular, this can cause last_slot_field to be overwritten with the
result that the driver prematurely assumes it has finished processing a
slot and sending the ABS_MT_SLOT event at the wrong point in time,
associating events for the current contact with the following contact
instead.

To prevent this from occurring, we update the value of last_slot_field
durring the pre_report phase to ensure that it is correct for the report
that is to be processed.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-11 22:37:13 +02:00
Ping Cheng 1924e05e60 HID: wacom - add touch_arbitration parameter to wacom module
Touch arbitration is always on in wacom.ko. However, there are
touch enabled applications use both pen and touch simultaneously.
We should provide an option for userland to decide if they want
arbitration on or off.

This patch sets default touch_arbitration to on since most userland
apps are not ready to process pen and touch events simultaneously.
In the future, when userland is ready to accept pen and touch events
together, we will switch default touch_arbitration to off.

Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Ping Cheng <pingc@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-10 11:46:26 +02:00
Jason Gerecke 41372d5d40 HID: wacom: Augment 'oVid' and 'oPid' with heuristics for HID_GENERIC
The 'oVid' and 'oPid' variables used by wacom_are_sibling are a hacky
solution to the problem of the driver historically having few good
heuristics to use in determining if two devices should be considered
siblings or not. While it works well enough for explicitly supported
devices, it offers no help for HID_GENERIC devices. Now that we have
a bit more information (e.g. direct/indirect) available to us though,
we should make use of it it to improve the pairing of such devices.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-10 11:44:28 +02:00
Jason Gerecke e5bc8eb1b0 HID: wacom: Add WACOM_DEVICETYPE_DIRECT for Cintiqs and similar
"Direct" input devices like Cintiqs and Tablet PCs set the INPUT_PROP_DIRECT
property to notify userspace that the sensor and screen are overlaid. This
information can also be useful elsewhere within the kernel driver, however,
so we introduce a new WACOM_DEVICETYPE_DIRECT that signals this to other
kernel code.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-10 11:44:28 +02:00
Benjamin Tissoires 9956953ec0 HID: wacom: power_supply: provide the actual model_name
Instead of displaying a generic "tablet", now g-c-c shows a pretty
"Wacom Intuos Pro S (WL)".

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-05 13:39:23 +02:00
Benjamin Tissoires 136ae5e9ba HID: wacom: power_supply: remove ac information
Looks like upowerd is ignoring this since October 2013, so there is
no need to keep this around in the kernel.
And as mentioned in 8aaa592 (linux: Ignore ACs coming from devices) in
the upower tree, "We already have enough information on the device
battery".

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-05 13:39:22 +02:00
Benjamin Tissoires 9698329628 HID: wacom: power_supply: mark the type as USB
When upowerd detects a new device, it tries to map this new device to
an input to guess its kind. It works OK for wired tablets when the
wireless module and its battery are attached, but not so well when
connected over wireless.
In that case, the battery is attached to the wireless HID node, not
the Pen or Pad HID node. So there is no input node as a parent of the
reported battery, which means it will be showed as a computer battery
in gnome-control-center.

If we set the power supply type to USB, upowerd has a heuristic that
detects "wacom_" in the name of the power_supply, and set the type to
tablet. So it's now clear that the reported battery of from a tablet.
(see https://cgit.freedesktop.org/upower/tree/src/linux/up-device-supply.c)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-05 13:39:21 +02:00
Benjamin Tissoires 6a06281e2b HID: wacom: leds: handle Cintiq 24HD leds buttons
The 24HD has 1 button per LED (first three buttons of each group).
We need a special treatment for them as it's not a uniq button that
switches between the LEDs.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-05 13:39:21 +02:00
Benjamin Tissoires 5a0fe8abd1 HID: wacom: leds: make sure Cintiq 21UX2 and 24HD control the right LEDs
The code for 21UX2 and 24HD makes the LED group 1 on the left, and
the group 0 on the right. The buttons are ordered in the other way,
but libwacom already exports those that way. So we simply can't reassign
LED group 0 to the left buttons, and have to quirk the incoming data...

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-05 13:39:21 +02:00
Benjamin Tissoires 34736aa96e HID: wacom: leds: handle the switch of the LEDs directly in the kernel
The EKR switches the LED directly, and there is no point in having
userspace handling the switch it self when it's easy enough to do
in the kernel.

The other benefit is that now userspace does not need to have root access
to the LED but need only to read them with user privileges.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-05 13:39:20 +02:00
Benjamin Tissoires 589e506020 HID: wacom: leds: actually release the LEDs on disconnect
There is a bug (?) in devm_led_classdev_register() in which its increments
the refcount of the parent. If the parent is an input device, that means
the ref count never reaches 0 when devm_input_device_release() gets called.
This means that the LEDs and all the devres resources attached to the
input device are not released.

Manually force the release of the group so that the leds are released once
we are done using them.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-05 13:39:19 +02:00
Benjamin Tissoires 97f5541fc0 HID: wacom: leds: use the ledclass instead of custom made sysfs files
The now obsolete sysfs files for LEDs and EKRemote are kept for backward
compatibility.
Both the EKR (read-only) and the regular Cintiqs and Intuos are now
sharing the same led API.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-08-05 13:39:19 +02:00