All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-5.19/uclogic 0/4] DIGImend patches, part IV
@ 2022-04-14 11:09 José Expósito
  2022-04-14 11:09 ` [PATCH for-5.19/uclogic 1/4] HID: uclogic: Compress params format string José Expósito
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: José Expósito @ 2022-04-14 11:09 UTC (permalink / raw)
  To: jikos
  Cc: benjamin.tissoires, spbnick, linux-input, linux-kernel,
	José Expósito

Hi everyone,

This series is a follow up to [1], [2] and [3] and upstreams 4 more
patches authored by Nikolai from the DIGImend project.

Patches 1 and 2 are simple code clean up.

Patch 3 adds support for "bitmap dials". This kind of dials send 01
and 10 binary values rather than the usual 1 and -1.

The last patch adds support for the Huion Q620M drawing tablet, which
has a bitmap dial.

Thank you very much in advance to Jiří for his work reviewing all the
patches I have sent so far,
José Expósito

[1] https://lore.kernel.org/linux-input/nycvar.YFH.7.76.2202161642180.11721@cbobk.fhfr.pm/T/
[2] https://lore.kernel.org/linux-input/56454560-5f62-05b9-1a24-3f51a305140e@gmail.com/T/
[3] https://lore.kernel.org/linux-input/nycvar.YFH.7.76.2204111653000.30217@cbobk.fhfr.pm/T/

Nikolai Kondrashov (4):
  HID: uclogic: Compress params format string
  HID: uclogic: Reduce indent for params format str/args
  HID: uclogic: Add support for bitmap dials
  HID: uclogic: Add support for Huion Q620M

 drivers/hid/hid-uclogic-core.c   |   6 +
 drivers/hid/hid-uclogic-params.c |  20 ++++
 drivers/hid/hid-uclogic-params.h | 187 ++++++++++++++++++-------------
 drivers/hid/hid-uclogic-rdesc.c  |  50 +++++++++
 drivers/hid/hid-uclogic-rdesc.h  |  10 ++
 5 files changed, 192 insertions(+), 81 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH for-5.19/uclogic 1/4] HID: uclogic: Compress params format string
  2022-04-14 11:09 [PATCH for-5.19/uclogic 0/4] DIGImend patches, part IV José Expósito
@ 2022-04-14 11:09 ` José Expósito
  2022-04-14 11:09 ` [PATCH for-5.19/uclogic 2/4] HID: uclogic: Reduce indent for params format str/args José Expósito
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: José Expósito @ 2022-04-14 11:09 UTC (permalink / raw)
  To: jikos
  Cc: benjamin.tissoires, spbnick, linux-input, linux-kernel,
	José Expósito

From: Nikolai Kondrashov <spbnick@gmail.com>

Shorten the format string for printing out UC-Logic interface parameters
so that it fits into a single log message.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/hid/hid-uclogic-params.h | 90 ++++++++++++++++++--------------
 1 file changed, 51 insertions(+), 39 deletions(-)

diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h
index f2649e8f959d..ebf84b56746b 100644
--- a/drivers/hid/hid-uclogic-params.h
+++ b/drivers/hid/hid-uclogic-params.h
@@ -203,45 +203,57 @@ extern int uclogic_params_init(struct uclogic_params *params,
 
 /* Tablet interface parameters *printf format string */
 #define UCLOGIC_PARAMS_FMT_STR \
-		".invalid = %s\n"                               \
-		".desc_ptr = %p\n"                              \
-		".desc_size = %u\n"                             \
-		".pen.desc_ptr = %p\n"                          \
-		".pen.desc_size = %u\n"                         \
-		".pen.id = %u\n"                                \
-		".pen.subreport_list[0] = {0x%02hhx, %hhu}\n"   \
-		".pen.subreport_list[1] = {0x%02hhx, %hhu}\n"   \
-		".pen.subreport_list[2] = {0x%02hhx, %hhu}\n"   \
-		".pen.inrange = %s\n"                           \
-		".pen.fragmented_hires = %s\n"                  \
-		".pen.tilt_y_flipped = %s\n"                    \
-		".frame_list[0].desc_ptr = %p\n"                \
-		".frame_list[0].desc_size = %u\n"               \
-		".frame_list[0].id = %u\n"                      \
-		".frame_list[0].suffix = %s\n"                  \
-		".frame_list[0].re_lsb = %u\n"                  \
-		".frame_list[0].dev_id_byte = %u\n"             \
-		".frame_list[0].touch_ring_byte = %u\n"         \
-		".frame_list[0].touch_ring_max = %hhd\n"        \
-		".frame_list[0].touch_ring_flip_at = %hhd\n"    \
-		".frame_list[1].desc_ptr = %p\n"                \
-		".frame_list[1].desc_size = %u\n"               \
-		".frame_list[1].id = %u\n"                      \
-		".frame_list[1].suffix = %s\n"                  \
-		".frame_list[1].re_lsb = %u\n"                  \
-		".frame_list[1].dev_id_byte = %u\n"             \
-		".frame_list[1].touch_ring_byte = %u\n"         \
-		".frame_list[1].touch_ring_max = %hhd\n"        \
-		".frame_list[1].touch_ring_flip_at = %hhd\n"    \
-		".frame_list[2].desc_ptr = %p\n"                \
-		".frame_list[2].desc_size = %u\n"               \
-		".frame_list[2].id = %u\n"                      \
-		".frame_list[2].suffix = %s\n"                  \
-		".frame_list[2].re_lsb = %u\n"                  \
-		".frame_list[2].dev_id_byte = %u\n"             \
-		".frame_list[2].touch_ring_byte = %u\n"         \
-		".frame_list[2].touch_ring_max = %hhd\n"        \
-		".frame_list[2].touch_ring_flip_at = %hhd\n"
+		".invalid = %s\n"                   \
+		".desc_ptr = %p\n"                  \
+		".desc_size = %u\n"                 \
+		".pen = {\n"                        \
+		"\t.desc_ptr = %p\n"                \
+		"\t.desc_size = %u\n"               \
+		"\t.id = %u\n"                      \
+		"\t.subreport_list = {\n"           \
+		"\t\t{0x%02hhx, %hhu},\n"           \
+		"\t\t{0x%02hhx, %hhu},\n"           \
+		"\t\t{0x%02hhx, %hhu},\n"           \
+		"\t}\n"                             \
+		"\t.inrange = %s\n"                 \
+		"\t.fragmented_hires = %s\n"        \
+		"\t.tilt_y_flipped = %s\n"          \
+		"}\n"                               \
+		".frame_list = {\n"                 \
+		"\t{\n"                             \
+		"\t\t.desc_ptr = %p\n"              \
+		"\t\t.desc_size = %u\n"             \
+		"\t\t.id = %u\n"                    \
+		"\t\t.suffix = %s\n"                \
+		"\t\t.re_lsb = %u\n"                \
+		"\t\t.dev_id_byte = %u\n"           \
+		"\t\t.touch_ring_byte = %u\n"       \
+		"\t\t.touch_ring_max = %hhd\n"      \
+		"\t\t.touch_ring_flip_at = %hhd\n"  \
+		"\t},\n"                            \
+		"\t{\n"                             \
+		"\t\t.desc_ptr = %p\n"              \
+		"\t\t.desc_size = %u\n"             \
+		"\t\t.id = %u\n"                    \
+		"\t\t.suffix = %s\n"                \
+		"\t\t.re_lsb = %u\n"                \
+		"\t\t.dev_id_byte = %u\n"           \
+		"\t\t.touch_ring_byte = %u\n"       \
+		"\t\t.touch_ring_max = %hhd\n"      \
+		"\t\t.touch_ring_flip_at = %hhd\n"  \
+		"\t},\n"                            \
+		"\t{\n"                             \
+		"\t\t.desc_ptr = %p\n"              \
+		"\t\t.desc_size = %u\n"             \
+		"\t\t.id = %u\n"                    \
+		"\t\t.suffix = %s\n"                \
+		"\t\t.re_lsb = %u\n"                \
+		"\t\t.dev_id_byte = %u\n"           \
+		"\t\t.touch_ring_byte = %u\n"       \
+		"\t\t.touch_ring_max = %hhd\n"      \
+		"\t\t.touch_ring_flip_at = %hhd\n"  \
+		"\t},\n"                            \
+		"}\n"
 
 /* Tablet interface parameters *printf format arguments */
 #define UCLOGIC_PARAMS_FMT_ARGS(_params) \
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH for-5.19/uclogic 2/4] HID: uclogic: Reduce indent for params format str/args
  2022-04-14 11:09 [PATCH for-5.19/uclogic 0/4] DIGImend patches, part IV José Expósito
  2022-04-14 11:09 ` [PATCH for-5.19/uclogic 1/4] HID: uclogic: Compress params format string José Expósito
@ 2022-04-14 11:09 ` José Expósito
  2022-04-14 11:09 ` [PATCH for-5.19/uclogic 3/4] HID: uclogic: Add support for bitmap dials José Expósito
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: José Expósito @ 2022-04-14 11:09 UTC (permalink / raw)
  To: jikos
  Cc: benjamin.tissoires, spbnick, linux-input, linux-kernel,
	José Expósito

From: Nikolai Kondrashov <spbnick@gmail.com>

Improve legibility of UCLOGIC_PARAMS_FMT_STR/ARGS.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/hid/hid-uclogic-params.h | 186 +++++++++++++++----------------
 1 file changed, 93 insertions(+), 93 deletions(-)

diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h
index ebf84b56746b..78965e683d20 100644
--- a/drivers/hid/hid-uclogic-params.h
+++ b/drivers/hid/hid-uclogic-params.h
@@ -203,102 +203,102 @@ extern int uclogic_params_init(struct uclogic_params *params,
 
 /* Tablet interface parameters *printf format string */
 #define UCLOGIC_PARAMS_FMT_STR \
-		".invalid = %s\n"                   \
-		".desc_ptr = %p\n"                  \
-		".desc_size = %u\n"                 \
-		".pen = {\n"                        \
-		"\t.desc_ptr = %p\n"                \
-		"\t.desc_size = %u\n"               \
-		"\t.id = %u\n"                      \
-		"\t.subreport_list = {\n"           \
-		"\t\t{0x%02hhx, %hhu},\n"           \
-		"\t\t{0x%02hhx, %hhu},\n"           \
-		"\t\t{0x%02hhx, %hhu},\n"           \
-		"\t}\n"                             \
-		"\t.inrange = %s\n"                 \
-		"\t.fragmented_hires = %s\n"        \
-		"\t.tilt_y_flipped = %s\n"          \
-		"}\n"                               \
-		".frame_list = {\n"                 \
-		"\t{\n"                             \
-		"\t\t.desc_ptr = %p\n"              \
-		"\t\t.desc_size = %u\n"             \
-		"\t\t.id = %u\n"                    \
-		"\t\t.suffix = %s\n"                \
-		"\t\t.re_lsb = %u\n"                \
-		"\t\t.dev_id_byte = %u\n"           \
-		"\t\t.touch_ring_byte = %u\n"       \
-		"\t\t.touch_ring_max = %hhd\n"      \
-		"\t\t.touch_ring_flip_at = %hhd\n"  \
-		"\t},\n"                            \
-		"\t{\n"                             \
-		"\t\t.desc_ptr = %p\n"              \
-		"\t\t.desc_size = %u\n"             \
-		"\t\t.id = %u\n"                    \
-		"\t\t.suffix = %s\n"                \
-		"\t\t.re_lsb = %u\n"                \
-		"\t\t.dev_id_byte = %u\n"           \
-		"\t\t.touch_ring_byte = %u\n"       \
-		"\t\t.touch_ring_max = %hhd\n"      \
-		"\t\t.touch_ring_flip_at = %hhd\n"  \
-		"\t},\n"                            \
-		"\t{\n"                             \
-		"\t\t.desc_ptr = %p\n"              \
-		"\t\t.desc_size = %u\n"             \
-		"\t\t.id = %u\n"                    \
-		"\t\t.suffix = %s\n"                \
-		"\t\t.re_lsb = %u\n"                \
-		"\t\t.dev_id_byte = %u\n"           \
-		"\t\t.touch_ring_byte = %u\n"       \
-		"\t\t.touch_ring_max = %hhd\n"      \
-		"\t\t.touch_ring_flip_at = %hhd\n"  \
-		"\t},\n"                            \
-		"}\n"
+	".invalid = %s\n"                   \
+	".desc_ptr = %p\n"                  \
+	".desc_size = %u\n"                 \
+	".pen = {\n"                        \
+	"\t.desc_ptr = %p\n"                \
+	"\t.desc_size = %u\n"               \
+	"\t.id = %u\n"                      \
+	"\t.subreport_list = {\n"           \
+	"\t\t{0x%02hhx, %hhu},\n"           \
+	"\t\t{0x%02hhx, %hhu},\n"           \
+	"\t\t{0x%02hhx, %hhu},\n"           \
+	"\t}\n"                             \
+	"\t.inrange = %s\n"                 \
+	"\t.fragmented_hires = %s\n"        \
+	"\t.tilt_y_flipped = %s\n"          \
+	"}\n"                               \
+	".frame_list = {\n"                 \
+	"\t{\n"                             \
+	"\t\t.desc_ptr = %p\n"              \
+	"\t\t.desc_size = %u\n"             \
+	"\t\t.id = %u\n"                    \
+	"\t\t.suffix = %s\n"                \
+	"\t\t.re_lsb = %u\n"                \
+	"\t\t.dev_id_byte = %u\n"           \
+	"\t\t.touch_ring_byte = %u\n"       \
+	"\t\t.touch_ring_max = %hhd\n"      \
+	"\t\t.touch_ring_flip_at = %hhd\n"  \
+	"\t},\n"                            \
+	"\t{\n"                             \
+	"\t\t.desc_ptr = %p\n"              \
+	"\t\t.desc_size = %u\n"             \
+	"\t\t.id = %u\n"                    \
+	"\t\t.suffix = %s\n"                \
+	"\t\t.re_lsb = %u\n"                \
+	"\t\t.dev_id_byte = %u\n"           \
+	"\t\t.touch_ring_byte = %u\n"       \
+	"\t\t.touch_ring_max = %hhd\n"      \
+	"\t\t.touch_ring_flip_at = %hhd\n"  \
+	"\t},\n"                            \
+	"\t{\n"                             \
+	"\t\t.desc_ptr = %p\n"              \
+	"\t\t.desc_size = %u\n"             \
+	"\t\t.id = %u\n"                    \
+	"\t\t.suffix = %s\n"                \
+	"\t\t.re_lsb = %u\n"                \
+	"\t\t.dev_id_byte = %u\n"           \
+	"\t\t.touch_ring_byte = %u\n"       \
+	"\t\t.touch_ring_max = %hhd\n"      \
+	"\t\t.touch_ring_flip_at = %hhd\n"  \
+	"\t},\n"                            \
+	"}\n"
 
 /* Tablet interface parameters *printf format arguments */
 #define UCLOGIC_PARAMS_FMT_ARGS(_params) \
-		((_params)->invalid ? "true" : "false"),                    \
-		(_params)->desc_ptr,                                        \
-		(_params)->desc_size,                                       \
-		(_params)->pen.desc_ptr,                                    \
-		(_params)->pen.desc_size,                                   \
-		(_params)->pen.id,                                          \
-		(_params)->pen.subreport_list[0].value,                     \
-		(_params)->pen.subreport_list[0].id,                        \
-		(_params)->pen.subreport_list[1].value,                     \
-		(_params)->pen.subreport_list[1].id,                        \
-		(_params)->pen.subreport_list[2].value,                     \
-		(_params)->pen.subreport_list[2].id,                        \
-		uclogic_params_pen_inrange_to_str((_params)->pen.inrange),  \
-		((_params)->pen.fragmented_hires ? "true" : "false"),       \
-		((_params)->pen.tilt_y_flipped ? "true" : "false"),         \
-		(_params)->frame_list[0].desc_ptr,                          \
-		(_params)->frame_list[0].desc_size,                         \
-		(_params)->frame_list[0].id,                                \
-		(_params)->frame_list[0].suffix,                            \
-		(_params)->frame_list[0].re_lsb,                            \
-		(_params)->frame_list[0].dev_id_byte,                       \
-		(_params)->frame_list[0].touch_ring_byte,                   \
-		(_params)->frame_list[0].touch_ring_max,                    \
-		(_params)->frame_list[0].touch_ring_flip_at,                \
-		(_params)->frame_list[1].desc_ptr,                          \
-		(_params)->frame_list[1].desc_size,                         \
-		(_params)->frame_list[1].id,                                \
-		(_params)->frame_list[1].suffix,                            \
-		(_params)->frame_list[1].re_lsb,                            \
-		(_params)->frame_list[1].dev_id_byte,                       \
-		(_params)->frame_list[1].touch_ring_byte,                   \
-		(_params)->frame_list[1].touch_ring_max,                    \
-		(_params)->frame_list[1].touch_ring_flip_at,                \
-		(_params)->frame_list[2].desc_ptr,                          \
-		(_params)->frame_list[2].desc_size,                         \
-		(_params)->frame_list[2].id,                                \
-		(_params)->frame_list[2].suffix,                            \
-		(_params)->frame_list[2].re_lsb,                            \
-		(_params)->frame_list[2].dev_id_byte,                       \
-		(_params)->frame_list[2].touch_ring_byte,                   \
-		(_params)->frame_list[2].touch_ring_max,                    \
-		(_params)->frame_list[2].touch_ring_flip_at
+	((_params)->invalid ? "true" : "false"),                    \
+	(_params)->desc_ptr,                                        \
+	(_params)->desc_size,                                       \
+	(_params)->pen.desc_ptr,                                    \
+	(_params)->pen.desc_size,                                   \
+	(_params)->pen.id,                                          \
+	(_params)->pen.subreport_list[0].value,                     \
+	(_params)->pen.subreport_list[0].id,                        \
+	(_params)->pen.subreport_list[1].value,                     \
+	(_params)->pen.subreport_list[1].id,                        \
+	(_params)->pen.subreport_list[2].value,                     \
+	(_params)->pen.subreport_list[2].id,                        \
+	uclogic_params_pen_inrange_to_str((_params)->pen.inrange),  \
+	((_params)->pen.fragmented_hires ? "true" : "false"),       \
+	((_params)->pen.tilt_y_flipped ? "true" : "false"),         \
+	(_params)->frame_list[0].desc_ptr,                          \
+	(_params)->frame_list[0].desc_size,                         \
+	(_params)->frame_list[0].id,                                \
+	(_params)->frame_list[0].suffix,                            \
+	(_params)->frame_list[0].re_lsb,                            \
+	(_params)->frame_list[0].dev_id_byte,                       \
+	(_params)->frame_list[0].touch_ring_byte,                   \
+	(_params)->frame_list[0].touch_ring_max,                    \
+	(_params)->frame_list[0].touch_ring_flip_at,                \
+	(_params)->frame_list[1].desc_ptr,                          \
+	(_params)->frame_list[1].desc_size,                         \
+	(_params)->frame_list[1].id,                                \
+	(_params)->frame_list[1].suffix,                            \
+	(_params)->frame_list[1].re_lsb,                            \
+	(_params)->frame_list[1].dev_id_byte,                       \
+	(_params)->frame_list[1].touch_ring_byte,                   \
+	(_params)->frame_list[1].touch_ring_max,                    \
+	(_params)->frame_list[1].touch_ring_flip_at,                \
+	(_params)->frame_list[2].desc_ptr,                          \
+	(_params)->frame_list[2].desc_size,                         \
+	(_params)->frame_list[2].id,                                \
+	(_params)->frame_list[2].suffix,                            \
+	(_params)->frame_list[2].re_lsb,                            \
+	(_params)->frame_list[2].dev_id_byte,                       \
+	(_params)->frame_list[2].touch_ring_byte,                   \
+	(_params)->frame_list[2].touch_ring_max,                    \
+	(_params)->frame_list[2].touch_ring_flip_at
 
 /* Get a replacement report descriptor for a tablet's interface. */
 extern int uclogic_params_get_desc(const struct uclogic_params *params,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH for-5.19/uclogic 3/4] HID: uclogic: Add support for bitmap dials
  2022-04-14 11:09 [PATCH for-5.19/uclogic 0/4] DIGImend patches, part IV José Expósito
  2022-04-14 11:09 ` [PATCH for-5.19/uclogic 1/4] HID: uclogic: Compress params format string José Expósito
  2022-04-14 11:09 ` [PATCH for-5.19/uclogic 2/4] HID: uclogic: Reduce indent for params format str/args José Expósito
@ 2022-04-14 11:09 ` José Expósito
  2022-04-14 11:09 ` [PATCH for-5.19/uclogic 4/4] HID: uclogic: Add support for Huion Q620M José Expósito
  2022-04-21  8:09 ` [PATCH for-5.19/uclogic 0/4] DIGImend patches, part IV Jiri Kosina
  4 siblings, 0 replies; 6+ messages in thread
From: José Expósito @ 2022-04-14 11:09 UTC (permalink / raw)
  To: jikos
  Cc: benjamin.tissoires, spbnick, linux-input, linux-kernel,
	José Expósito

From: Nikolai Kondrashov <spbnick@gmail.com>

A bitmap dial sends reports with a dedicated bit per direction: 1 means
clockwise rotation, 2 means counterclockwise, as opposed to the normal
1 and -1 values.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/hid/hid-uclogic-core.c   |  6 ++++++
 drivers/hid/hid-uclogic-params.h | 15 ++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
index 96f3fb8c492c..627f1d0c52f2 100644
--- a/drivers/hid/hid-uclogic-core.c
+++ b/drivers/hid/hid-uclogic-core.c
@@ -382,6 +382,12 @@ static int uclogic_raw_event_frame(
 		}
 	}
 
+	/* If need to, and can, transform the bitmap dial reports */
+	if (frame->bitmap_dial_byte > 0 && frame->bitmap_dial_byte < size) {
+		if (data[frame->bitmap_dial_byte] == 2)
+			data[frame->bitmap_dial_byte] = -1;
+	}
+
 	return 0;
 }
 
diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h
index 78965e683d20..e5ccc558abc3 100644
--- a/drivers/hid/hid-uclogic-params.h
+++ b/drivers/hid/hid-uclogic-params.h
@@ -153,6 +153,13 @@ struct uclogic_params_frame {
 	 * Zero if no reversal should be done.
 	 */
 	__s8 touch_ring_flip_at;
+	/*
+	 * Offset of the bitmap dial byte, in the report. Zero if not present.
+	 * Only valid if "id" is not zero. A bitmap dial sends reports with a
+	 * dedicated bit per direction: 1 means clockwise rotation, 2 means
+	 * counterclockwise, as opposed to the normal 1 and -1.
+	 */
+	unsigned int bitmap_dial_byte;
 };
 
 /*
@@ -230,6 +237,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
 	"\t\t.touch_ring_byte = %u\n"       \
 	"\t\t.touch_ring_max = %hhd\n"      \
 	"\t\t.touch_ring_flip_at = %hhd\n"  \
+	"\t\t.bitmap_dial_byte = %u\n"      \
 	"\t},\n"                            \
 	"\t{\n"                             \
 	"\t\t.desc_ptr = %p\n"              \
@@ -241,6 +249,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
 	"\t\t.touch_ring_byte = %u\n"       \
 	"\t\t.touch_ring_max = %hhd\n"      \
 	"\t\t.touch_ring_flip_at = %hhd\n"  \
+	"\t\t.bitmap_dial_byte = %u\n"      \
 	"\t},\n"                            \
 	"\t{\n"                             \
 	"\t\t.desc_ptr = %p\n"              \
@@ -252,6 +261,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
 	"\t\t.touch_ring_byte = %u\n"       \
 	"\t\t.touch_ring_max = %hhd\n"      \
 	"\t\t.touch_ring_flip_at = %hhd\n"  \
+	"\t\t.bitmap_dial_byte = %u\n"      \
 	"\t},\n"                            \
 	"}\n"
 
@@ -281,6 +291,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
 	(_params)->frame_list[0].touch_ring_byte,                   \
 	(_params)->frame_list[0].touch_ring_max,                    \
 	(_params)->frame_list[0].touch_ring_flip_at,                \
+	(_params)->frame_list[0].bitmap_dial_byte,                  \
 	(_params)->frame_list[1].desc_ptr,                          \
 	(_params)->frame_list[1].desc_size,                         \
 	(_params)->frame_list[1].id,                                \
@@ -290,6 +301,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
 	(_params)->frame_list[1].touch_ring_byte,                   \
 	(_params)->frame_list[1].touch_ring_max,                    \
 	(_params)->frame_list[1].touch_ring_flip_at,                \
+	(_params)->frame_list[1].bitmap_dial_byte,                  \
 	(_params)->frame_list[2].desc_ptr,                          \
 	(_params)->frame_list[2].desc_size,                         \
 	(_params)->frame_list[2].id,                                \
@@ -298,7 +310,8 @@ extern int uclogic_params_init(struct uclogic_params *params,
 	(_params)->frame_list[2].dev_id_byte,                       \
 	(_params)->frame_list[2].touch_ring_byte,                   \
 	(_params)->frame_list[2].touch_ring_max,                    \
-	(_params)->frame_list[2].touch_ring_flip_at
+	(_params)->frame_list[2].touch_ring_flip_at,                \
+	(_params)->frame_list[2].bitmap_dial_byte
 
 /* Get a replacement report descriptor for a tablet's interface. */
 extern int uclogic_params_get_desc(const struct uclogic_params *params,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH for-5.19/uclogic 4/4] HID: uclogic: Add support for Huion Q620M
  2022-04-14 11:09 [PATCH for-5.19/uclogic 0/4] DIGImend patches, part IV José Expósito
                   ` (2 preceding siblings ...)
  2022-04-14 11:09 ` [PATCH for-5.19/uclogic 3/4] HID: uclogic: Add support for bitmap dials José Expósito
@ 2022-04-14 11:09 ` José Expósito
  2022-04-21  8:09 ` [PATCH for-5.19/uclogic 0/4] DIGImend patches, part IV Jiri Kosina
  4 siblings, 0 replies; 6+ messages in thread
From: José Expósito @ 2022-04-14 11:09 UTC (permalink / raw)
  To: jikos
  Cc: benjamin.tissoires, spbnick, linux-input, linux-kernel,
	José Expósito

From: Nikolai Kondrashov <spbnick@gmail.com>

The Huion Q620M tablet needs a v2 frame dial.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/hid/hid-uclogic-params.c | 20 +++++++++++++
 drivers/hid/hid-uclogic-rdesc.c  | 50 ++++++++++++++++++++++++++++++++
 drivers/hid/hid-uclogic-rdesc.h  | 10 +++++++
 3 files changed, 80 insertions(+)

diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c
index 3ac45e7572a0..09c332c6a412 100644
--- a/drivers/hid/hid-uclogic-params.c
+++ b/drivers/hid/hid-uclogic-params.c
@@ -777,6 +777,23 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
 			p.frame_list[1].touch_ring_max = 12;
 			p.frame_list[1].touch_ring_flip_at = 6;
 
+			/* Create v2 frame dial parameters */
+			rc = uclogic_params_frame_init_with_desc(
+					&p.frame_list[2],
+					uclogic_rdesc_v2_frame_dial_arr,
+					uclogic_rdesc_v2_frame_dial_size,
+					UCLOGIC_RDESC_V2_FRAME_DIAL_ID);
+			if (rc != 0) {
+				hid_err(hdev,
+					"failed creating v2 frame dial parameters: %d\n",
+					rc);
+				goto cleanup;
+			}
+			p.frame_list[2].suffix = "Dial";
+			p.frame_list[2].dev_id_byte =
+				UCLOGIC_RDESC_V2_FRAME_DIAL_DEV_ID_BYTE;
+			p.frame_list[2].bitmap_dial_byte = 5;
+
 			/*
 			 * Link button and touch ring subreports from pen
 			 * reports
@@ -787,6 +804,9 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
 			p.pen.subreport_list[1].value = 0xf0;
 			p.pen.subreport_list[1].id =
 				UCLOGIC_RDESC_V2_FRAME_TOUCH_RING_ID;
+			p.pen.subreport_list[2].value = 0xf1;
+			p.pen.subreport_list[2].id =
+				UCLOGIC_RDESC_V2_FRAME_DIAL_ID;
 			goto output;
 		}
 		hid_dbg(hdev, "pen v2 parameters not found\n");
diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c
index d64b607dce5d..dd792160fe7e 100644
--- a/drivers/hid/hid-uclogic-rdesc.c
+++ b/drivers/hid/hid-uclogic-rdesc.c
@@ -761,6 +761,56 @@ const __u8 uclogic_rdesc_v2_frame_touch_ring_arr[] = {
 const size_t uclogic_rdesc_v2_frame_touch_ring_size =
 			sizeof(uclogic_rdesc_v2_frame_touch_ring_arr);
 
+/* Fixed report descriptor for (tweaked) v2 frame dial reports */
+const __u8 uclogic_rdesc_v2_frame_dial_arr[] = {
+	0x05, 0x01,         /*  Usage Page (Desktop),               */
+	0x09, 0x07,         /*  Usage (Keypad),                     */
+	0xA1, 0x01,         /*  Collection (Application),           */
+	0x85, UCLOGIC_RDESC_V2_FRAME_DIAL_ID,
+			    /*      Report ID (DIAL_ID),            */
+	0x14,               /*      Logical Minimum (0),            */
+	0x05, 0x0D,         /*      Usage Page (Digitizer),         */
+	0x09, 0x39,         /*      Usage (Tablet Function Keys),   */
+	0xA0,               /*      Collection (Physical),          */
+	0x25, 0x01,         /*          Logical Maximum (1),        */
+	0x75, 0x01,         /*          Report Size (1),            */
+	0x95, 0x01,         /*          Report Count (1),           */
+	0x81, 0x01,         /*          Input (Constant),           */
+	0x05, 0x09,         /*          Usage Page (Button),        */
+	0x09, 0x01,         /*          Usage (01h),                */
+	0x95, 0x01,         /*          Report Count (1),           */
+	0x81, 0x02,         /*          Input (Variable),           */
+	0x95, 0x06,         /*          Report Count (6),           */
+	0x81, 0x01,         /*          Input (Constant),           */
+	0x75, 0x08,         /*          Report Size (8),            */
+	0x95, 0x02,         /*          Report Count (2),           */
+	0x81, 0x01,         /*          Input (Constant),           */
+	0x05, 0x0D,         /*          Usage Page (Digitizer),     */
+	0x0A, 0xFF, 0xFF,   /*          Usage (FFFFh),              */
+	0x26, 0xFF, 0x00,   /*          Logical Maximum (255),      */
+	0x95, 0x01,         /*          Report Count (1),           */
+	0x81, 0x02,         /*          Input (Variable),           */
+	0x05, 0x01,         /*          Usage Page (Desktop),       */
+	0x09, 0x38,         /*          Usage (Wheel),              */
+	0x95, 0x01,         /*          Report Count (1),           */
+	0x15, 0xFF,         /*          Logical Minimum (-1),       */
+	0x25, 0x01,         /*          Logical Maximum (1),        */
+	0x81, 0x06,         /*          Input (Variable, Relative), */
+	0x09, 0x30,         /*          Usage (X),                  */
+	0x09, 0x31,         /*          Usage (Y),                  */
+	0x14,               /*          Logical Minimum (0),        */
+	0x25, 0x01,         /*          Logical Maximum (1),        */
+	0x75, 0x01,         /*          Report Size (1),            */
+	0x95, 0x02,         /*          Report Count (2),           */
+	0x81, 0x02,         /*          Input (Variable),           */
+	0x95, 0x2E,         /*          Report Count (46),          */
+	0x81, 0x01,         /*          Input (Constant),           */
+	0xC0,               /*      End Collection,                 */
+	0xC0                /*  End Collection                      */
+};
+const size_t uclogic_rdesc_v2_frame_dial_size =
+			sizeof(uclogic_rdesc_v2_frame_dial_arr);
+
 /* Fixed report descriptor for Ugee EX07 frame */
 const __u8 uclogic_rdesc_ugee_ex07_frame_arr[] = {
 	0x05, 0x01,             /*  Usage Page (Desktop),                   */
diff --git a/drivers/hid/hid-uclogic-rdesc.h b/drivers/hid/hid-uclogic-rdesc.h
index f15a9d8a946b..2ab6b7d5f5af 100644
--- a/drivers/hid/hid-uclogic-rdesc.h
+++ b/drivers/hid/hid-uclogic-rdesc.h
@@ -141,6 +141,16 @@ extern const size_t uclogic_rdesc_v2_frame_touch_ring_size;
 /* Device ID byte offset in v2 frame touch ring reports */
 #define UCLOGIC_RDESC_V2_FRAME_TOUCH_RING_DEV_ID_BYTE	0x4
 
+/* Report ID for tweaked v2 frame dial reports */
+#define UCLOGIC_RDESC_V2_FRAME_DIAL_ID 0xf9
+
+/* Fixed report descriptor for (tweaked) v2 frame dial reports */
+extern const __u8 uclogic_rdesc_v2_frame_dial_arr[];
+extern const size_t uclogic_rdesc_v2_frame_dial_size;
+
+/* Device ID byte offset in v2 frame dial reports */
+#define UCLOGIC_RDESC_V2_FRAME_DIAL_DEV_ID_BYTE	0x4
+
 /* Fixed report descriptor for Ugee EX07 frame */
 extern const __u8 uclogic_rdesc_ugee_ex07_frame_arr[];
 extern const size_t uclogic_rdesc_ugee_ex07_frame_size;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH for-5.19/uclogic 0/4] DIGImend patches, part IV
  2022-04-14 11:09 [PATCH for-5.19/uclogic 0/4] DIGImend patches, part IV José Expósito
                   ` (3 preceding siblings ...)
  2022-04-14 11:09 ` [PATCH for-5.19/uclogic 4/4] HID: uclogic: Add support for Huion Q620M José Expósito
@ 2022-04-21  8:09 ` Jiri Kosina
  4 siblings, 0 replies; 6+ messages in thread
From: Jiri Kosina @ 2022-04-21  8:09 UTC (permalink / raw)
  To: José Expósito
  Cc: benjamin.tissoires, spbnick, linux-input, linux-kernel

On Thu, 14 Apr 2022, José Expósito wrote:

> Hi everyone,
> 
> This series is a follow up to [1], [2] and [3] and upstreams 4 more
> patches authored by Nikolai from the DIGImend project.
> 
> Patches 1 and 2 are simple code clean up.
> 
> Patch 3 adds support for "bitmap dials". This kind of dials send 01
> and 10 binary values rather than the usual 1 and -1.
> 
> The last patch adds support for the Huion Q620M drawing tablet, which
> has a bitmap dial.
> 
> Thank you very much in advance to Jiří for his work reviewing all the
> patches I have sent so far,
> José Expósito
> 
> [1] https://lore.kernel.org/linux-input/nycvar.YFH.7.76.2202161642180.11721@cbobk.fhfr.pm/T/
> [2] https://lore.kernel.org/linux-input/56454560-5f62-05b9-1a24-3f51a305140e@gmail.com/T/
> [3] https://lore.kernel.org/linux-input/nycvar.YFH.7.76.2204111653000.30217@cbobk.fhfr.pm/T/
> 
> Nikolai Kondrashov (4):
>   HID: uclogic: Compress params format string
>   HID: uclogic: Reduce indent for params format str/args
>   HID: uclogic: Add support for bitmap dials
>   HID: uclogic: Add support for Huion Q620M

This is now in hid.git#for-5.19/uclogic

Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-21  8:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 11:09 [PATCH for-5.19/uclogic 0/4] DIGImend patches, part IV José Expósito
2022-04-14 11:09 ` [PATCH for-5.19/uclogic 1/4] HID: uclogic: Compress params format string José Expósito
2022-04-14 11:09 ` [PATCH for-5.19/uclogic 2/4] HID: uclogic: Reduce indent for params format str/args José Expósito
2022-04-14 11:09 ` [PATCH for-5.19/uclogic 3/4] HID: uclogic: Add support for bitmap dials José Expósito
2022-04-14 11:09 ` [PATCH for-5.19/uclogic 4/4] HID: uclogic: Add support for Huion Q620M José Expósito
2022-04-21  8:09 ` [PATCH for-5.19/uclogic 0/4] DIGImend patches, part IV Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.