From: Tero Kristo <tero.kristo@linux.intel.com>
To: jikos@kernel.org, benjamin.tissoires@redhat.com,
mika.westerberg@linux.intel.com, tero.kristo@linux.intel.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC 5/8] HID: core: Add support for USI style events
Date: Thu, 4 Nov 2021 15:36:58 +0200 [thread overview]
Message-ID: <20211104133701.1733551-6-tero.kristo@linux.intel.com> (raw)
In-Reply-To: <20211104133701.1733551-1-tero.kristo@linux.intel.com>
Add support for Universal Stylus Interface (USI) style events to the HID
core and input layers. A new driver will be added in a separate patch
which is going to use this glue logic.
Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
---
drivers/hid/hid-core.c | 3 +++
drivers/hid/hid-input.c | 18 ++++++++++++++++++
include/linux/hid.h | 5 +++++
include/linux/mod_devicetable.h | 2 +-
include/uapi/linux/input-event-codes.h | 22 ++++++++++++++--------
5 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index dbed2524fd47..194c4bfed1be 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -780,6 +780,9 @@ static void hid_scan_input_usage(struct hid_parser *parser, u32 usage)
if (usage == HID_DG_CONTACTID)
hid->group = HID_GROUP_MULTITOUCH;
+
+ if (usage == HID_DG_TRANSDUCER_INDEX)
+ hid->group = HID_GROUP_USI;
}
static void hid_scan_feature_usage(struct hid_parser *parser, u32 usage)
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 0506612800db..426700cd8574 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -829,6 +829,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
}
break;
+ case 0x38: /* Transducer Index */
+ map_msc(MSC_PEN_ID);
+ break;
+
case 0x3b: /* Battery Strength */
hidinput_setup_battery(device, HID_INPUT_REPORT, field, false);
usage->type = EV_PWR;
@@ -875,6 +879,20 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
map_msc(MSC_SERIAL);
break;
+ case 0x5c: map_msc(MSC_PEN_COLOR); break;
+ case 0x5e: map_msc(MSC_PEN_LINE_WIDTH); break;
+
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ case 0x76:
+ case 0x77:
+ map_msc(MSC_PEN_LINE_STYLE);
+ break;
+
default: goto unknown;
}
break;
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 555b5de654b1..000fd3cf06ce 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -241,6 +241,7 @@ struct hid_item {
#define HID_DG_TOUCH 0x000d0033
#define HID_DG_UNTOUCH 0x000d0034
#define HID_DG_TAP 0x000d0035
+#define HID_DG_TRANSDUCER_INDEX 0x000d0038
#define HID_DG_TABLETFUNCTIONKEY 0x000d0039
#define HID_DG_PROGRAMCHANGEKEY 0x000d003a
#define HID_DG_BATTERYSTRENGTH 0x000d003b
@@ -253,6 +254,9 @@ struct hid_item {
#define HID_DG_BARRELSWITCH 0x000d0044
#define HID_DG_ERASER 0x000d0045
#define HID_DG_TABLETPICK 0x000d0046
+#define HID_DG_PEN_COLOR 0x000d005c
+#define HID_DG_PEN_LINE_WIDTH 0x000d005e
+#define HID_DG_PEN_LINE_STYLE 0x000d0070
#define HID_CP_CONSUMERCONTROL 0x000c0001
#define HID_CP_NUMERICKEYPAD 0x000c0002
@@ -369,6 +373,7 @@ struct hid_item {
#define HID_GROUP_MULTITOUCH 0x0002
#define HID_GROUP_SENSOR_HUB 0x0003
#define HID_GROUP_MULTITOUCH_WIN_8 0x0004
+#define HID_GROUP_USI 0x0005
/*
* Vendor specific HID device groups
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index ae2e75d15b21..4ff40be7676b 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -322,7 +322,7 @@ struct pcmcia_device_id {
#define INPUT_DEVICE_ID_KEY_MAX 0x2ff
#define INPUT_DEVICE_ID_REL_MAX 0x0f
#define INPUT_DEVICE_ID_ABS_MAX 0x3f
-#define INPUT_DEVICE_ID_MSC_MAX 0x07
+#define INPUT_DEVICE_ID_MSC_MAX 0x09
#define INPUT_DEVICE_ID_LED_MAX 0x0f
#define INPUT_DEVICE_ID_SND_MAX 0x07
#define INPUT_DEVICE_ID_FF_MAX 0x7f
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index 225ec87d4f22..98295f71941a 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -901,14 +901,20 @@
* Misc events
*/
-#define MSC_SERIAL 0x00
-#define MSC_PULSELED 0x01
-#define MSC_GESTURE 0x02
-#define MSC_RAW 0x03
-#define MSC_SCAN 0x04
-#define MSC_TIMESTAMP 0x05
-#define MSC_MAX 0x07
-#define MSC_CNT (MSC_MAX+1)
+#define MSC_SERIAL 0x00
+#define MSC_PULSELED 0x01
+#define MSC_GESTURE 0x02
+#define MSC_RAW 0x03
+#define MSC_SCAN 0x04
+#define MSC_TIMESTAMP 0x05
+/* USI Pen events */
+#define MSC_PEN_ID 0x06
+#define MSC_PEN_COLOR 0x07
+#define MSC_PEN_LINE_WIDTH 0x08
+#define MSC_PEN_LINE_STYLE 0x09
+/* TODO: Add USI diagnostic & battery events too */
+#define MSC_MAX 0x09
+#define MSC_CNT (MSC_MAX + 1)
/*
* LEDs
--
2.25.1
next prev parent reply other threads:[~2021-11-04 13:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 13:36 [RFC 0/8] HID: add support for USI style pens Tero Kristo
2021-11-04 13:36 ` [RFC 1/8] HID: debug: Add USI usages Tero Kristo
2021-11-04 13:36 ` [RFC 2/8] HID: Add map_msc() to avoid boilerplate code Tero Kristo
2021-11-04 13:36 ` [RFC 3/8] HID: hid-input: Add suffix also for HID_DG_PEN Tero Kristo
2021-11-04 13:36 ` [RFC 4/8] HID: input: Make hidinput_find_field() static Tero Kristo
2021-11-04 13:36 ` Tero Kristo [this message]
2021-11-04 13:36 ` [RFC 6/8] HID: usi: Add driver for Universal Stylus Interface (USI) Tero Kristo
2021-11-04 15:03 ` Randy Dunlap
2021-11-05 6:33 ` Tero Kristo
2021-11-05 20:53 ` Randy Dunlap
2021-11-04 13:37 ` [RFC 7/8] HID: USI: add new input event codes for the pen-set value events Tero Kristo
2021-11-04 13:37 ` [RFC 8/8] HID: USI: add support for ioctls Tero Kristo
2021-11-05 18:22 ` [RFC 0/8] HID: add support for USI style pens Benjamin Tissoires
2021-11-08 7:44 ` Tero Kristo
2021-11-09 17:02 ` Benjamin Tissoires
2021-11-15 16:30 ` Tero Kristo
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=20211104133701.1733551-6-tero.kristo@linux.intel.com \
--to=tero.kristo@linux.intel.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.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).