2022-02-11 09:01:58

by José Expósito

[permalink] [raw]
Subject: [PATCH 0/7] DIGImend patches, part one

Hi everyone,

I'm working on the UC Logic driver to add support for my tablet.
After some work, I noticed that I needed some patches from the
DIGImend project [1].

Instead of cherry picking what I needed, I decided to go the hard
way and upstream every change present in DIGImend but missing in
the kernel with the intention of making development easier in the
future for everyone and providing better hardware support.

In a private conversation with DIGImend's maintainer, Nikolai
Kondrashov, I asked him for permission to upstream his changes and
he said it was fine :) All credit goes to him, I only fixed his
patches so they apply, fixed minor checkpatch errors, squashed
related changes and reviewed and tested them when my hardware
allowed me to.

This is the first series of patches from DIGImend. There are 37
patches in total [2], but I can imagine nobody wants to review such
a long series, so I'll be sending small groups of related patches...
Unless someone feels brave and tells me to send all of them ;)

Thank you very much in advance,
José Expósito

[1] https://github.com/DIGImend/digimend-kernel-drivers
[2] https://github.com/JoseExposito/linux/commits/patch-digimend-parblo-patches-mailing-list

Nikolai Kondrashov (7):
HID: uclogic: Support Huion tilt reporting
HID: uclogic: Rename Huion HS64 PID to Huion Tablet 2
HID: uclogic: Support Huion 13th frame button
HID: uclogic: Split pen and frame raw event handling
HID: uclogic: Access pen/frame params directly in raw_event handling
HID: uclogic: Skip non-input raw events earlier
HID: uclogic: Handle virtual frame reports

drivers/hid/hid-ids.h | 2 +-
drivers/hid/hid-uclogic-core.c | 205 +++++++++++++++++++------------
drivers/hid/hid-uclogic-params.c | 3 +-
drivers/hid/hid-uclogic-params.h | 8 ++
drivers/hid/hid-uclogic-rdesc.c | 20 ++-
5 files changed, 153 insertions(+), 85 deletions(-)

--
2.25.1



2022-02-11 09:25:47

by José Expósito

[permalink] [raw]
Subject: [PATCH 5/7] HID: uclogic: Access pen/frame params directly in raw_event handling

From: Nikolai Kondrashov <[email protected]>

Simplify the raw event handling code by accessing the
uclogic_params_pen/uclogic_params_frame structs directly.

Signed-off-by: Nikolai Kondrashov <[email protected]>
Signed-off-by: José Expósito <[email protected]>
---
drivers/hid/hid-uclogic-core.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
index 9187fd835a46..56b76d9b46af 100644
--- a/drivers/hid/hid-uclogic-core.c
+++ b/drivers/hid/hid-uclogic-core.c
@@ -259,13 +259,13 @@ static int uclogic_resume(struct hid_device *hdev)
static int uclogic_raw_event_pen(struct uclogic_drvdata *drvdata,
u8 *data, int size)
{
- struct uclogic_params *params = &drvdata->params;
+ struct uclogic_params_pen *pen = &drvdata->params.pen;

WARN_ON(drvdata == NULL);
WARN_ON(data == NULL && size != 0);

/* If in-range reports are inverted */
- if (params->pen.inrange ==
+ if (pen->inrange ==
UCLOGIC_PARAMS_PEN_INRANGE_INVERTED) {
/* Invert the in-range bit */
data[1] ^= 0x40;
@@ -274,7 +274,7 @@ static int uclogic_raw_event_pen(struct uclogic_drvdata *drvdata,
* If report contains fragmented high-resolution pen
* coordinates
*/
- if (size >= 10 && params->pen.fragmented_hires) {
+ if (size >= 10 && pen->fragmented_hires) {
u8 pressure_low_byte;
u8 pressure_high_byte;

@@ -296,7 +296,7 @@ static int uclogic_raw_event_pen(struct uclogic_drvdata *drvdata,
data[9] = pressure_high_byte;
}
/* If we need to emulate in-range detection */
- if (params->pen.inrange == UCLOGIC_PARAMS_PEN_INRANGE_NONE) {
+ if (pen->inrange == UCLOGIC_PARAMS_PEN_INRANGE_NONE) {
/* Set in-range bit */
data[1] |= 0x40;
/* (Re-)start in-range timeout */
@@ -304,7 +304,7 @@ static int uclogic_raw_event_pen(struct uclogic_drvdata *drvdata,
jiffies + msecs_to_jiffies(100));
}
/* If we report tilt and Y direction is flipped */
- if (size >= 12 && params->pen.tilt_y_flipped)
+ if (size >= 12 && pen->tilt_y_flipped)
data[11] = -data[11];

return 0;
@@ -323,21 +323,19 @@ static int uclogic_raw_event_pen(struct uclogic_drvdata *drvdata,
static int uclogic_raw_event_frame(struct uclogic_drvdata *drvdata,
u8 *data, int size)
{
- struct uclogic_params *params = &drvdata->params;
+ struct uclogic_params_frame *frame = &drvdata->params.frame;

WARN_ON(drvdata == NULL);
WARN_ON(data == NULL && size != 0);

/* If need to, and can, set pad device ID for Wacom drivers */
- if (params->frame.dev_id_byte > 0 &&
- params->frame.dev_id_byte < size) {
- data[params->frame.dev_id_byte] = 0xf;
+ if (frame->dev_id_byte > 0 && frame->dev_id_byte < size) {
+ data[frame->dev_id_byte] = 0xf;
}
/* If need to, and can, read rotary encoder state change */
- if (params->frame.re_lsb > 0 &&
- params->frame.re_lsb / 8 < size) {
- unsigned int byte = params->frame.re_lsb / 8;
- unsigned int bit = params->frame.re_lsb % 8;
+ if (frame->re_lsb > 0 && frame->re_lsb / 8 < size) {
+ unsigned int byte = frame->re_lsb / 8;
+ unsigned int bit = frame->re_lsb % 8;

u8 change;
u8 prev_state = drvdata->re_state;
--
2.25.1


2022-02-16 17:19:42

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH 0/7] DIGImend patches, part one

On Thu, 10 Feb 2022, José Expósito wrote:

> I'm working on the UC Logic driver to add support for my tablet.
> After some work, I noticed that I needed some patches from the
> DIGImend project [1].
>
> Instead of cherry picking what I needed, I decided to go the hard
> way and upstream every change present in DIGImend but missing in
> the kernel with the intention of making development easier in the
> future for everyone and providing better hardware support.
>
> In a private conversation with DIGImend's maintainer, Nikolai
> Kondrashov, I asked him for permission to upstream his changes and
> he said it was fine :) All credit goes to him, I only fixed his
> patches so they apply, fixed minor checkpatch errors, squashed
> related changes and reviewed and tested them when my hardware
> allowed me to.
>
> This is the first series of patches from DIGImend. There are 37
> patches in total [2], but I can imagine nobody wants to review such
> a long series, so I'll be sending small groups of related patches...

Thanks a lot for consideration :)

> Unless someone feels brave and tells me to send all of them ;)

Definitely not me :)

The patches look good to me, and I see Nikolai is CCed, so I've now queued
them in hid.git#for-5.18/uclogic

Thanks,

--
Jiri Kosina
SUSE Labs