1
0
Fork 0
remarkable-linux/drivers/hid
Jason Gerecke c76133afb9 HID: wacom: Fix reporting of touch toggle (WACOM_HID_WD_MUTE_DEVICE) events
commit 403c0f681c upstream.

Touch toggle softkeys send a '1' while pressed and a '0' while released,
requring the kernel to keep track of wether touch should be enabled or
disabled. The code does not handle the state transitions properly,
however. If the key is pressed repeatedly, the following four states
of states are cycled through (assuming touch starts out enabled):

Press:   shared->is_touch_on => 0, SW_MUTE_DEVICE => 1
Release: shared->is_touch_on => 0, SW_MUTE_DEVICE => 1
Press:   shared->is_touch_on => 1, SW_MUTE_DEVICE => 0
Release: shared->is_touch_on => 1, SW_MUTE_DEVICE => 1

The hardware always properly enables/disables touch when the key is
pressed but applications that listen for SW_MUTE_DEVICE events to provide
feedback about the state will only ever show touch as being enabled while
the key is held, and only every-other time. This sequence occurs because
the fallthrough WACOM_HID_WD_TOUCHONOFF case is always handled, and it
uses the value of the *local* is_touch_on variable as the value to
report to userspace. The local value is equal to the shared value when
the button is pressed, but equal to zero when the button is released.

Reporting the shared value to userspace fixes this problem, but the
fallthrough case needs to update the shared value in an incompatible
way (which is why the local variable was introduced in the first place).
To work around this, we just handle both cases in a single block of code
and update the shared variable as appropriate.

Fixes: d793ff8187 ("HID: wacom: generic: support touch on/off softkey")
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Aaron Skomra <aaron.skomra@wacom.com>
Tested-by: Aaron Skomra <aaron.skomra@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-03 17:38:51 +01:00
..
i2c-hid HID: i2c-hid: allocate hid buffers for real worst case 2017-09-13 18:16:40 +02:00
intel-ish-hid License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
usbhid License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig HID: cp2112: add HIDRAW dependency 2017-11-21 09:49:23 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hid-a4tech.c HID: trivial devm conversion for special hid drivers 2013-07-31 10:12:28 +02:00
hid-accutouch.c HID: Accutouch: Add driver for ELO Accutouch 2216 USB Touchscreens 2017-03-21 15:03:55 +01:00
hid-alps.c 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
hid-apple.c HID: apple: Use country code to detect ISO keyboards 2017-06-08 13:58:03 +02:00
hid-appleir.c HID: hid-input: allow input_configured callback return errors 2015-11-05 09:51:50 -08:00
hid-asus.c HID: asus: Add T100CHI bluetooth keyboard dock touchpad support 2017-08-08 10:05:23 +02:00
hid-aureal.c HID: fix some indenting issues 2015-10-21 13:15:53 +02:00
hid-axff.c HID: enable Mayflash USB Gamecube Adapter 2013-11-12 19:06:23 +01:00
hid-belkin.c
hid-betopff.c HID: betop: add drivers/hid/hid-betopff.c 2014-12-22 15:00:25 +01:00
hid-cherry.c HID: fix a couple of off-by-ones 2014-08-21 10:43:28 -05:00
hid-chicony.c HID: move Asus keyboard support from hid-chicony to hid-asus 2017-06-08 13:47:52 +02:00
hid-cmedia.c HID: Support for CMedia CM6533 HID audio jack controls 2016-03-02 10:31:36 +01:00
hid-core.c HID: hid-elecom: extend to fix descriptor for HUGE trackball 2017-10-11 15:46:22 +02:00
hid-corsair.c HID: corsair: Add driver Scimitar Pro RGB gaming mouse 1b1c:1b3e support to hid-corsair 2017-03-21 14:46:15 +01:00
hid-cp2112.c HID: cp2112: fix broken gpio_direction_input callback 2017-12-20 10:10:22 +01:00
hid-cypress.c HID: hid-cypress: validate length of report 2017-01-06 16:06:43 +01:00
hid-debug.c Merge branch 'for-4.12/asus' into for-linus 2017-05-02 11:02:41 +02:00
hid-dr.c Revert "HID: dragonrise: fix HID Descriptor for 0x0006 PID" 2016-10-10 10:52:01 +02:00
hid-elecom.c HID: hid-elecom: extend to fix descriptor for HUGE trackball 2017-10-11 15:46:22 +02:00
hid-elo.c HID: elo: kill not flush the work 2016-06-01 14:08:17 +02:00
hid-emsff.c
hid-ezkey.c
hid-gaff.c
hid-gembird.c HID: gembird: add new driver to fix Gembird JPD-DualForce 2 2015-08-18 15:03:43 +02:00
hid-generic.c
hid-gfrm.c HID: hid-gfrm: avoid warning for input_configured API change 2015-11-05 10:15:35 -08:00
hid-gt683r.c HID: use to_hid_device() 2015-12-28 13:41:44 +01:00
hid-gyration.c
hid-holtek-kbd.c
hid-holtek-mouse.c HID: Add Holtek USB ID 04d9:a0c2 ETEKCITY Scroll 2014-09-08 09:48:56 +02:00
hid-holtekff.c HID: hid-holtekff: don't push static constants on stack for %*ph 2013-08-05 11:29:57 +02:00
hid-hyperv.c HID: hyperv: match wait_for_completion_timeout return type 2015-01-26 14:25:41 +01:00
hid-icade.c
hid-ids.h HID: hid-elecom: extend to fix descriptor for HUGE trackball 2017-10-11 15:46:22 +02:00
hid-input.c HID: input: throttle battery uevents 2017-08-15 10:56:03 +02:00
hid-ite.c HID: ite: Add hid-ite driver 2017-05-11 10:27:48 +02:00
hid-kensington.c
hid-keytouch.c
hid-kye.c scripts/spelling.txt: add "comsume(r)" pattern and fix typo instances 2017-02-27 18:43:47 -08:00
hid-lcpower.c
hid-led.c HID: hid-led: fix issue with transfer buffer not being dma capable 2016-10-10 10:47:03 +02:00
hid-lenovo.c HID: lenovo: Don't use stack variables for DMA buffers 2016-03-29 15:39:36 +02:00
hid-lg.c HID: hid-lg: Fix immediate disconnection of Logitech Rumblepad 2 2017-01-26 21:58:16 +01:00
hid-lg.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hid-lg2ff.c HID: logitech - lg2ff: Add IDs for Formula Vibration Feedback Wheel 2013-10-09 12:06:02 +02:00
hid-lg3ff.c HID: LG: validate HID output report details 2013-09-13 15:12:39 +02:00
hid-lg4ff.c HID: hid-logitech: Improve Wingman Formula Force GP support 2016-09-26 15:39:56 +02:00
hid-lg4ff.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hid-lgff.c HID: LG: validate HID output report details 2013-09-13 15:12:39 +02:00
hid-logitech-dj.c HID: logitech-dj: allow devices to request full pairing information 2017-04-06 14:36:36 +02:00
hid-logitech-hidpp.c HID: logitech-hidpp: constify attribute_group structures. 2017-08-03 13:38:30 +02:00
hid-magicmouse.c Revert "HID: magicmouse: Set multi-touch keybits for Magic Mouse" 2017-06-20 10:38:17 +02:00
hid-mf.c HID: hid-mf: add force feedback support for Mayflash DolphinBar and GameCube 2017-01-11 22:12:44 +01:00
hid-microsoft.c HID: multitouch: enable Surface 3 Type Cover Pro to report multitouch data 2017-01-20 15:17:19 +01:00
hid-monterey.c HID: fix a couple of off-by-ones 2014-08-21 10:43:28 -05:00
hid-multitouch.c Revert "HID: multitouch: Support ALPS PTP stick with pid 0x120A" 2017-10-02 11:49:43 +02:00
hid-nti.c HID: Add quirk driver for NTI USB-SUN adapter 2017-03-06 13:16:33 +01:00
hid-ntrig.c HID: ntrig: constify attribute_group structures. 2017-08-03 13:38:30 +02:00
hid-ortek.c HID: ortek: add one more buggy device 2017-07-24 17:38:21 +02:00
hid-penmount.c HID: penmount: report only one button for PenMount 6000 USB touchscreen controller 2016-03-10 17:17:26 +01:00
hid-petalynx.c HID: fix a couple of off-by-ones 2014-08-21 10:43:28 -05:00
hid-picolcd.h
hid-picolcd_backlight.c HID: picoLCD: Deletion of unnecessary checks before three function calls 2015-06-29 14:51:12 +02:00
hid-picolcd_cir.c media: rc: rename RC_TYPE_* to RC_PROTO_* and RC_BIT_* to RC_PROTO_BIT_* 2017-08-20 10:02:48 -04:00
hid-picolcd_core.c HID: picolcd: be more verbose when reporting report size error 2014-08-27 23:27:10 +02:00
hid-picolcd_debugfs.c HID: picoLCD: Spelling s/REPORT_WRTIE_MEMORY/REPORT_WRITE_MEMORY/ 2017-03-24 15:45:04 +01:00
hid-picolcd_fb.c drivers/hid/hid-picolcd_fb: avoid world-writable sysfs files. 2014-05-14 10:53:56 +09:30
hid-picolcd_lcd.c HID: picoLCD: Deletion of unnecessary checks before three function calls 2015-06-29 14:51:12 +02:00
hid-picolcd_leds.c HID: use to_hid_device() 2015-12-28 13:41:44 +01:00
hid-pl.c HID: pantherlord: validate output report details 2013-09-04 11:58:32 +02:00
hid-plantronics.c HID: plantronics: Update to map volume up/down controls 2015-06-12 15:04:17 +02:00
hid-primax.c
hid-prodikeys.c HID: prodikeys: constify snd_rawmidi_ops structures 2017-08-15 11:02:45 +02:00
hid-retrode.c HID: Add driver for Retrode2 joypad adapter 2017-06-22 14:44:11 +02:00
hid-rmi.c HID: rmi: Make sure the HID device is opened on resume 2017-09-08 15:00:52 +02:00
hid-roccat-arvo.c HID: use kobj_to_dev() 2015-12-28 13:41:51 +01:00
hid-roccat-arvo.h
hid-roccat-common.c HID: use kobj_to_dev() 2015-12-28 13:41:51 +01:00
hid-roccat-common.h HID: roccat: generalize some common code 2013-10-30 14:17:31 +01:00
hid-roccat-isku.c HID: use kobj_to_dev() 2015-12-28 13:41:51 +01:00
hid-roccat-isku.h
hid-roccat-kone.c HID: use kobj_to_dev() 2015-12-28 13:41:51 +01:00
hid-roccat-kone.h
hid-roccat-koneplus.c HID: use kobj_to_dev() 2015-12-28 13:41:51 +01:00
hid-roccat-koneplus.h
hid-roccat-konepure.c HID: roccat: generalize some common code 2013-10-30 14:17:31 +01:00
hid-roccat-kovaplus.c HID: use kobj_to_dev() 2015-12-28 13:41:51 +01:00
hid-roccat-kovaplus.h
hid-roccat-lua.c HID: use kobj_to_dev() 2015-12-28 13:41:51 +01:00
hid-roccat-lua.h
hid-roccat-pyra.c HID: use kobj_to_dev() 2015-12-28 13:41:51 +01:00
hid-roccat-pyra.h
hid-roccat-ryos.c HID: roccat: add support for Ryos MK keyboards 2013-10-30 14:17:31 +01:00
hid-roccat-savu.c HID: roccat: generalize some common code 2013-10-30 14:17:31 +01:00
hid-roccat-savu.h HID: roccat: generalize some common code 2013-10-30 14:17:31 +01:00
hid-roccat.c sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h> 2017-03-02 08:42:32 +01:00
hid-saitek.c HID: Add a new Saitek mouse device ID (RAT 9) 2016-08-02 16:45:17 +02:00
hid-samsung.c
hid-sensor-custom.c Merge branch 'for-4.14/ish' into for-linus 2017-09-05 11:10:13 +02:00
hid-sensor-hub.c HID: hid-sensor-hub: Force logical minimum to 1 for power and report state 2017-08-09 22:15:59 +02:00
hid-sjoy.c HID: sjoy: support Super Joy Box 4 2015-05-07 10:47:53 +02:00
hid-sony.c Merge branch 'for-4.12/sony' into for-linus 2017-05-02 11:02:24 +02:00
hid-speedlink.c HID: Fix Speedlink VAD Cezanne support for some devices 2013-08-26 13:51:10 +02:00
hid-steelseries.c HID: use to_hid_device() 2015-12-28 13:41:44 +01:00
hid-sunplus.c HID: fix a couple of off-by-ones 2014-08-21 10:43:28 -05:00
hid-tivo.c HID: tivo: enable all buttons on the TiVo Slide Pro remote 2015-03-15 10:04:27 -04:00
hid-tmff.c
hid-topseed.c
hid-twinhan.c
hid-uclogic.c HID: uclogic: add support for Ugee Tablet EX07S 2017-04-06 14:50:11 +02:00
hid-udraw-ps3.c HID: udraw-ps3: accel_limits is local to the driver 2016-11-15 14:23:17 +01:00
hid-waltop.c HID: Remove broken links to tablet descriptions 2016-09-19 14:32:21 +02:00
hid-wiimote-core.c HID: wiimote: replace hid_output_raw_report with hid_hw_output_report for output requests 2014-02-17 14:57:17 +01:00
hid-wiimote-debug.c
hid-wiimote-modules.c HID: wiimote: Fix wiimote mp scale linearization 2016-03-18 17:31:38 +01:00
hid-wiimote.h HID: use to_hid_device() 2015-12-28 13:41:44 +01:00
hid-xinmo.c HID: xinmo: fix for out of range for THT 2P arcade controller. 2017-03-24 15:43:03 +01:00
hid-zpff.c HID: zeroplus: validate output report details 2013-09-13 15:11:34 +02:00
hid-zydacron.c HID: trivial devm conversion for special hid drivers 2013-07-31 10:12:28 +02:00
hidraw.c HID: hidraw: fix power sequence when closing device 2017-10-02 11:46:31 +02:00
uhid.c HID: introduce hid_is_using_ll_driver 2017-07-27 15:14:28 +02:00
wacom.h HID: wacom: Add ability to provide explicit battery status info 2017-05-05 21:46:10 +02:00
wacom_sys.c HID: wacom: EKR: ensure devres groups at higher indexes are released 2018-02-03 17:38:51 +01:00
wacom_wac.c HID: wacom: Fix reporting of touch toggle (WACOM_HID_WD_MUTE_DEVICE) events 2018-02-03 17:38:51 +01:00
wacom_wac.h HID: wacom: generic: Recognize WACOM_HID_WD_PEN as a type of pen collection 2017-11-21 09:49:23 +01:00