Skip to content

Commit 98ac785

Browse files
kmaincentMarek Vasut
authored andcommitted
usb: kbd: allow probing even if usbkbd not in stdin
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 <[email protected]>
1 parent 018cdfc commit 98ac785

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

common/usb_kbd.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -581,21 +581,22 @@ static int probe_usb_keyboard(struct usb_device *dev)
581581

582582
stdinname = env_get("stdin");
583583
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
584-
error = iomux_doenv(stdin, stdinname);
585-
if (error)
586-
return error;
584+
if (strstr(stdinname, DEVNAME) != NULL) {
585+
error = iomux_doenv(stdin, stdinname);
586+
if (error)
587+
return error;
588+
}
587589
#else
588590
/* Check if this is the standard input device. */
589-
if (strcmp(stdinname, DEVNAME))
590-
return 1;
591-
592-
/* Reassign the console */
593-
if (overwrite_console())
594-
return 1;
591+
if (!strcmp(stdinname, DEVNAME)) {
592+
/* Reassign the console */
593+
if (overwrite_console())
594+
return 1;
595595

596-
error = console_assign(stdin, DEVNAME);
597-
if (error)
598-
return error;
596+
error = console_assign(stdin, DEVNAME);
597+
if (error)
598+
return error;
599+
}
599600
#endif
600601

601602
return 0;

0 commit comments

Comments
 (0)