From: Vicki Pfau <vi@endrift.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Lyude Paul <thatslyude@gmail.com>,
linux-input@vger.kernel.org
Cc: Vicki Pfau <vi@endrift.com>
Subject: [PATCH 2/2] Input: userio - Allow setting other id values
Date: Thu, 21 May 2026 18:50:40 -0700 [thread overview]
Message-ID: <20260522015040.3953472-2-vi@endrift.com> (raw)
In-Reply-To: <20260522015040.3953472-1-vi@endrift.com>
Previously, only the type value was settable. The proto value is used
internally for choosing the right drivers, so we should expose it. The
other values make sense to expose as well.
Signed-off-by: Vicki Pfau <vi@endrift.com>
---
Documentation/input/userio.rst | 23 +++++++++++++++++++++--
drivers/input/serio/userio.c | 30 ++++++++++++++++++++++++++++++
include/uapi/linux/userio.h | 5 ++++-
3 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/Documentation/input/userio.rst b/Documentation/input/userio.rst
index 415962152815..7aaaa629bde0 100644
--- a/Documentation/input/userio.rst
+++ b/Documentation/input/userio.rst
@@ -66,8 +66,27 @@ USERIO_CMD_SET_PORT_TYPE
~~~~~~~~~~~~~~~~~~~~~~~~
Sets the type of port we're emulating, where ``data`` is the port type being
-set. Can be any of the macros from <linux/serio.h>. For example: SERIO_8042
-would set the port type to be a normal PS/2 port.
+set. Can be any of the serio type macros from <linux/serio.h>. For example:
+SERIO_8042 would set the port type to be a normal PS/2 port.
+
+USERIO_CMD_SET_PORT_PROTO
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sets the protocol of port we're emulating, where ``data`` is the protocol being
+set. Can be any of the serio proto macros from <linux/serio.h>. For example:
+SERIO_IFORCE would set the port type to be an I-Force serial joystick.
+
+USERIO_CMD_SET_PORT_ID
+~~~~~~~~~~~~~~~~~~~~~~
+
+Sets the ``id`` value on the identification of port we're emulating, where
+``data`` is the value being set.
+
+USERIO_CMD_SET_PORT_EXTRA
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sets the ``extra`` value on the identification of port we're emulating, where
+``data`` is the value being set.
USERIO_CMD_SEND_INTERRUPT
~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/drivers/input/serio/userio.c b/drivers/input/serio/userio.c
index abca8cb6aca5..8c19975c84bf 100644
--- a/drivers/input/serio/userio.c
+++ b/drivers/input/serio/userio.c
@@ -206,6 +206,36 @@ static int userio_execute_cmd(struct userio_device *userio,
userio->serio->id.type = cmd->data;
break;
+ case USERIO_CMD_SET_PORT_EXTRA:
+ if (userio->running) {
+ dev_warn(userio_misc.this_device,
+ "Can't change port extra on an already running userio instance\n");
+ return -EBUSY;
+ }
+
+ userio->serio->id.extra = cmd->data;
+ break;
+
+ case USERIO_CMD_SET_PORT_ID:
+ if (userio->running) {
+ dev_warn(userio_misc.this_device,
+ "Can't change port id on an already running userio instance\n");
+ return -EBUSY;
+ }
+
+ userio->serio->id.id = cmd->data;
+ break;
+
+ case USERIO_CMD_SET_PORT_PROTO:
+ if (userio->running) {
+ dev_warn(userio_misc.this_device,
+ "Can't change port proto on an already running userio instance\n");
+ return -EBUSY;
+ }
+
+ userio->serio->id.proto = cmd->data;
+ break;
+
case USERIO_CMD_SEND_INTERRUPT:
if (!userio->running) {
dev_warn(userio_misc.this_device,
diff --git a/include/uapi/linux/userio.h b/include/uapi/linux/userio.h
index 98fe7e9089c4..550c7465af1f 100644
--- a/include/uapi/linux/userio.h
+++ b/include/uapi/linux/userio.h
@@ -27,7 +27,10 @@
enum userio_cmd_type {
USERIO_CMD_REGISTER = 0,
USERIO_CMD_SET_PORT_TYPE = 1,
- USERIO_CMD_SEND_INTERRUPT = 2
+ USERIO_CMD_SEND_INTERRUPT = 2,
+ USERIO_CMD_SET_PORT_EXTRA = 3,
+ USERIO_CMD_SET_PORT_ID = 4,
+ USERIO_CMD_SET_PORT_PROTO = 5,
};
/*
--
2.54.0
prev parent reply other threads:[~2026-05-22 2:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 1:50 [PATCH 1/2] Input: userio - Update maintainer name Vicki Pfau
2026-05-22 1:50 ` Vicki Pfau [this message]
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=20260522015040.3953472-2-vi@endrift.com \
--to=vi@endrift.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=thatslyude@gmail.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