[PATCH] usb: kbd: allow probing even if usbkbd not in stdin

Marek Vasut marex at denx.de
Fri Jun 24 20:12:31 CEST 2022


On 6/22/22 10:59, kory.maincent at bootlin.com wrote:
> From: Kory Maincent <kory.maincent at 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

Environment should be up and running before USB, so this is likely not a 
problem.

> 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.

Can you document the usecase in a bit more detail ?
What exactly is the problem you are solving here ?

>   	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)) {

Maybe use strcmp() == NULL to be consistent with the != NULL check above ?


More information about the U-Boot mailing list