From: Rob Clark <robdclark@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: kbd: don't fail with iomux
Date: Fri, 4 Aug 2017 07:52:04 -0400 [thread overview]
Message-ID: <20170804115209.18732-2-robdclark@gmail.com> (raw)
In-Reply-To: <20170804115209.18732-1-robdclark@gmail.com>
stdin might not be set, which would cause iomux_doenv() to fail
therefore causing probe_usb_keyboard() to fail. Furthermore if we do
have iomux enabled, the sensible thing (in terms of user experience)
would be to simply add ourselves to the list of stdin devices.
This fixes an issue with usbkbd on dragonboard410c with distro-
bootcmd, where stdin is not set (so stdinname is null).
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
v2: address Bin's review comments
v3: fix fail with free()ing if usbkbd is already in stdin env variable
pointed out by Simon
common/usb_kbd.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index d2d29cc98f..703dd748f5 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -517,7 +517,22 @@ static int probe_usb_keyboard(struct usb_device *dev)
stdinname = getenv("stdin");
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
+ char *devname = DEVNAME;
+ /*
+ * stdin might not be set yet.. either way, with console-mux the
+ * sensible thing to do is add ourselves to the list of stdio
+ * devices:
+ */
+ if (stdinname && !strstr(stdinname, DEVNAME)) {
+ char *newstdin = malloc(strlen(stdinname) + strlen(","DEVNAME) + 1);
+ sprintf(newstdin, "%s,"DEVNAME, stdinname);
+ stdinname = newstdin;
+ } else if (!stdinname) {
+ stdinname = devname;
+ }
error = iomux_doenv(stdin, stdinname);
+ if (stdinname != devname)
+ free(stdinname);
if (error)
return error;
#else
--
2.13.0
next prev parent reply other threads:[~2017-08-04 11:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-04 11:52 [U-Boot] [PATCH] efi_loader: GOP fix for no display Rob Clark
2017-08-04 11:52 ` Rob Clark [this message]
2017-08-04 12:35 ` [U-Boot] [PATCH] usb: kbd: don't fail with iomux Bin Meng
2017-08-04 12:51 ` Rob Clark
2017-08-04 13:08 ` Bin Meng
2017-08-31 16:20 ` [U-Boot] efi_loader: GOP fix for no display Alexander Graf
-- strict thread matches above, loose matches on Subject: below --
2017-09-27 1:19 [U-Boot] [PATCH] usb: kbd: Don't fail with iomux Rob Clark
2017-10-05 8:38 ` Peter Robinson
2017-10-05 12:06 ` Bin Meng
2017-10-09 4:45 ` Simon Glass
2017-08-03 19:22 [U-Boot] [PATCH] usb: kbd: don't " Rob Clark
2017-08-03 19:37 ` Simon Glass
2017-08-03 19:56 ` Rob Clark
2017-08-04 3:50 ` Bin Meng
2017-07-03 13:22 Rob Clark
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=20170804115209.18732-2-robdclark@gmail.com \
--to=robdclark@gmail.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