The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Marian Flor <marian.flor@posteo.net>
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] gpio_keys.c: Send also event when EV_ABS axis button is released
Date: Sat,  1 Feb 2025 16:20:15 +0000	[thread overview]
Message-ID: <717e71d6-5114-45ff-aa6b-0bb4a68b6261@posteo.net> (raw)

The input EV_ABS does not emit an event when the axis button is
released.  It appears to libevdev as held, even when the axis
button is physically released.  This behavior is also opposing
to the devicetree documentation for gpio-keys.  Change the code
to additionally emit a zero valued event on axis button release.

Signed-off-by: Marian Flor <marian.flor@posteo.net>
---
v2: No changes in patch itself, v2 got a commit description.

 drivers/input/keyboard/gpio_keys.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 5eef66516e37..20a0327e8f9a 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -373,12 +373,10 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
 		return;
 	}
 
-	if (type == EV_ABS) {
-		if (state)
-			input_event(input, type, button->code, button->value);
-	} else {
+	if (type == EV_ABS)
+		input_event(input, type, button->code, state ? button->value : 0);
+	else
 		input_event(input, type, *bdata->code, state);
-	}
 }
 
 static void gpio_keys_debounce_event(struct gpio_button_data *bdata)
-- 
2.39.5


             reply	other threads:[~2025-02-01 16:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-01 16:20 Marian Flor [this message]
2025-02-03 14:00 ` [PATCH v2] gpio_keys.c: Send also event when EV_ABS axis button is released Dmitry Torokhov

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=717e71d6-5114-45ff-aa6b-0bb4a68b6261@posteo.net \
    --to=marian.flor@posteo.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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