]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Input: userio - allow setting other id values
authorVicki Pfau <vi@endrift.com>
Fri, 22 May 2026 01:50:40 +0000 (18:50 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 2 Jun 2026 04:49:14 +0000 (21:49 -0700)
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>
Link: https://patch.msgid.link/20260522015040.3953472-2-vi@endrift.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Documentation/input/userio.rst
drivers/input/serio/userio.c
include/uapi/linux/userio.h

index 41596215281564484562fa3cf6da7dc9fac4e6d4..7aaaa629bde0648b66d08d56234fda99bdf06acf 100644 (file)
@@ -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
 ~~~~~~~~~~~~~~~~~~~~~~~~~
index abca8cb6aca52630684bf5713be67448dafea60d..8c19975c84bfae744b315441dfb844ab5406e26a 100644 (file)
@@ -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,
index 98fe7e9089c462fc852a196aedcb2287c3fbd953..550c7465af1f78686ab99ed74a3ee40306faa50d 100644 (file)
 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,
 };
 
 /*