Re: [PATCH] Fix reporting of touch toggle (WACOM_HID_WD_MUTE_DEVICE) events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 26 Dec 2017, Jason Gerecke wrote:

> 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")
> Cc: <stable@xxxxxxxxxxxxxxx> # v4.12+
> Signed-off-by: Jason Gerecke <jason.gerecke@xxxxxxxxx>
> Reviewed-by: Aaron Skomra <aaron.skomra@xxxxxxxxx>
> Tested-by: Aaron Skomra <aaron.skomra@xxxxxxxxx>

Applied to for-4.16/wacom.

-- 
Jiri Kosina
SUSE Labs

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux