From: Ping Cheng <pinglinux@gmail.com>
To: jkosina@suse.cz
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
Ping Cheng <pingc@wacom.com>
Subject: [PATCH] HID: wacom - make sure touch_input is valid before using it
Date: Thu, 6 Nov 2014 17:30:51 -0800 [thread overview]
Message-ID: <1415323851-16453-1-git-send-email-pingc@wacom.com> (raw)
touch_input is stored in wacom_shared for pen data to report touch
switch status. It is possible, although we didn't see it happen on
Linux yet, that pen data is procesed before touch interface is
fully probed.
As a by-product of this patch, it fixes the FreeBSD issue reported
by Denis Akiyakov http://www.spinics.net/lists/linux-input/msg33971.html
Reviewed-by: Hans Petter Selasky <hps@selasky.org>
Tested-by: Denis Akiyakov <d.akiyakov@gmail.com>
Signed-off-by: Ping Cheng <pingc@wacom.com>
---
drivers/hid/wacom_wac.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 8ce7fab..1048295 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1681,7 +1681,9 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
return 0;
if (data[0] == WACOM_REPORT_USB) {
- if (features->type == INTUOSHT && features->touch_max) {
+ if (features->type == INTUOSHT &&
+ wacom->shared->touch_input &&
+ features->touch_max) {
input_report_switch(wacom->shared->touch_input,
SW_MUTE_DEVICE, data[8] & 0x40);
input_sync(wacom->shared->touch_input);
@@ -1774,7 +1776,8 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
int pid, battery, ps_connected;
if ((wacom->shared->type == INTUOSHT) &&
- wacom->shared->touch_max) {
+ wacom->shared->touch_input &&
+ wacom->shared->touch_max) {
input_report_switch(wacom->shared->touch_input,
SW_MUTE_DEVICE, data[5] & 0x40);
input_sync(wacom->shared->touch_input);
--
1.9.1
next reply other threads:[~2014-11-07 1:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 1:30 Ping Cheng [this message]
2014-11-07 15:42 ` [PATCH] HID: wacom - make sure touch_input is valid before using it Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415323851-16453-1-git-send-email-pingc@wacom.com \
--to=pinglinux@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=pingc@wacom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).