From: "Tomasz Pakuła" <tomasz.pakula.oficjalny@gmail.com>
To: dmitry.torokhov@gmail.com, corbet@lwn.net, jikos@kernel.org,
bentiss@kernel.org
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, vi@endrift.com,
linux-kernel@altimeter.info, peter.hutterer@who-t.net
Subject: [RFC PATCH 2/6] Input: Add info about EV_BTN
Date: Sun, 4 Jan 2026 22:31:28 +0100 [thread overview]
Message-ID: <20260104213132.163904-3-tomasz.pakula.oficjalny@gmail.com> (raw)
In-Reply-To: <20260104213132.163904-1-tomasz.pakula.oficjalny@gmail.com>
Add necessary bits to modalias etc. Store the number of buttons.
Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
---
drivers/input/input.c | 10 ++++++++++
include/linux/input.h | 2 ++
2 files changed, 12 insertions(+)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index a500e1e276c2..e926327443bb 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -258,6 +258,10 @@ static int input_get_disposition(struct input_dev *dev,
}
break;
+ case EV_BTN:
+ disposition = INPUT_PASS_TO_HANDLERS;
+ break;
+
case EV_ABS:
if (is_event_supported(code, dev->absbit, ABS_MAX))
disposition = input_handle_abs_event(dev, code, &value);
@@ -1124,6 +1128,8 @@ static int input_devices_seq_show(struct seq_file *seq, void *v)
input_seq_print_bitmap(seq, "FF", dev->ffbit, FF_MAX);
if (test_bit(EV_SW, dev->evbit))
input_seq_print_bitmap(seq, "SW", dev->swbit, SW_MAX);
+ if (test_bit(EV_BTN, dev->evbit))
+ seq_printf(seq, "I: BTN=%u\n", dev->button_count);
seq_putc(seq, '\n');
@@ -1347,6 +1353,7 @@ static int input_print_modalias_parts(char *buf, int size, int full_len,
'f', id->ffbit, 0, FF_MAX);
len += input_print_modalias_bits(buf + len, size - len,
'w', id->swbit, 0, SW_MAX);
+ len += snprintf(buf + len, size - len, "t%u", id->button_count);
return len;
}
@@ -1679,6 +1686,8 @@ static int input_dev_uevent(const struct device *device, struct kobj_uevent_env
INPUT_ADD_HOTPLUG_BM_VAR("FF=", dev->ffbit, FF_MAX);
if (test_bit(EV_SW, dev->evbit))
INPUT_ADD_HOTPLUG_BM_VAR("SW=", dev->swbit, SW_MAX);
+ if (test_bit(EV_BTN, dev->evbit))
+ INPUT_ADD_HOTPLUG_VAR("BTN=%u", dev->button_count);
INPUT_ADD_HOTPLUG_MODALIAS_VAR(dev);
@@ -2113,6 +2122,7 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int
break;
case EV_PWR:
+ case EV_BTN:
/* do nothing */
break;
diff --git a/include/linux/input.h b/include/linux/input.h
index 7d7cb0593a63..f6389de4a4d1 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -59,6 +59,7 @@ enum input_clock_type {
* @sndbit: bitmap of sound effects supported by the device
* @ffbit: bitmap of force feedback effects supported by the device
* @swbit: bitmap of switches present on the device
+ * @button_count: number of generic buttons present on the device.
* @hint_events_per_packet: average number of events generated by the
* device in a packet (between EV_SYN/SYN_REPORT events). Used by
* event handlers to estimate size of the buffer needed to hold
@@ -152,6 +153,7 @@ struct input_dev {
unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
unsigned long swbit[BITS_TO_LONGS(SW_CNT)];
+ unsigned int button_count;
unsigned int hint_events_per_packet;
unsigned int keycodemax;
--
2.52.0
next prev parent reply other threads:[~2026-01-04 21:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-04 21:31 [RFC PATCH 0/6] Input: New EV_BTN event for generic buttons Tomasz Pakuła
2026-01-04 21:31 ` [RFC PATCH 1/6] Input: Introduce " Tomasz Pakuła
2026-01-04 22:30 ` Randy Dunlap
2026-01-04 21:31 ` Tomasz Pakuła [this message]
2026-01-04 21:31 ` [RFC PATCH 3/6] Input: Fire EV_BTN if found in ev_bit Tomasz Pakuła
2026-01-08 10:48 ` Benjamin Tissoires
2026-01-04 21:31 ` [RFC PATCH 4/6] Input: Assign EV_BTN event to HID Joysticks Tomasz Pakuła
2026-01-08 10:50 ` Benjamin Tissoires
2026-01-04 21:31 ` [RFC PATCH 5/6] Input: Realign rest of the HID_UP_BUTTON cases Tomasz Pakuła
2026-01-04 21:31 ` [RFC PATCH 6/6] Input: Add EVIOCGBTNCNT Tomasz Pakuła
2026-01-07 5:44 ` [RFC PATCH 0/6] Input: New EV_BTN event for generic buttons Ivan Gorinov
2026-01-08 3:24 ` Peter Hutterer
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=20260104213132.163904-3-tomasz.pakula.oficjalny@gmail.com \
--to=tomasz.pakula.oficjalny@gmail.com \
--cc=bentiss@kernel.org \
--cc=corbet@lwn.net \
--cc=dmitry.torokhov@gmail.com \
--cc=jikos@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@altimeter.info \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.hutterer@who-t.net \
--cc=vi@endrift.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