U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: kory.maincent@bootlin.com
To: u-boot@lists.denx.de
Cc: marex@denx.de, thomas.petazzoni@bootlin.com,
	Kory Maincent <kory.maincent@bootlin.com>
Subject: [PATCH] usb: kbd: allow probing even if usbkbd not in stdin
Date: Wed, 22 Jun 2022 10:59:31 +0200	[thread overview]
Message-ID: <20220622085931.1205590-1-kory.maincent@bootlin.com> (raw)

From: Kory Maincent <kory.maincent@bootlin.com>

For now the driver does not probe if usbkbd was not present in stdin.
This presents two issues, we can not probe the driver before setting stdin
and we can not use this driver in other manner than stdin console.

This patch fixes this by adding an else statement. It simply probes the
driver without console management in the case "usbkbd" is not in stdin.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 common/usb_kbd.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 352d86fb2e..d385bea532 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -581,21 +581,22 @@ static int probe_usb_keyboard(struct usb_device *dev)
 
 	stdinname = env_get("stdin");
 #if CONFIG_IS_ENABLED(CONSOLE_MUX)
-	error = iomux_doenv(stdin, stdinname);
-	if (error)
-		return error;
+	if (strstr(stdinname, DEVNAME) != NULL) {
+		error = iomux_doenv(stdin, stdinname);
+		if (error)
+			return error;
+	}
 #else
 	/* Check if this is the standard input device. */
-	if (strcmp(stdinname, DEVNAME))
-		return 1;
-
-	/* Reassign the console */
-	if (overwrite_console())
-		return 1;
+	if (!strcmp(stdinname, DEVNAME)) {
+		/* Reassign the console */
+		if (overwrite_console())
+			return 1;
 
-	error = console_assign(stdin, DEVNAME);
-	if (error)
-		return error;
+		error = console_assign(stdin, DEVNAME);
+		if (error)
+			return error;
+	}
 #endif
 
 	return 0;
-- 
2.25.1


             reply	other threads:[~2022-06-22  8:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22  8:59 kory.maincent [this message]
2022-06-24 18:12 ` [PATCH] usb: kbd: allow probing even if usbkbd not in stdin Marek Vasut
2022-06-27 10:03   ` Köry Maincent
2022-06-27 11:39     ` Marek Vasut
2022-06-27 12:27       ` Köry Maincent

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=20220622085931.1205590-1-kory.maincent@bootlin.com \
    --to=kory.maincent@bootlin.com \
    --cc=marex@denx.de \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=u-boot@lists.denx.de \
    /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