Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F423CC43334 for ; Mon, 27 Jun 2022 10:03:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5C6AC8427E; Mon, 27 Jun 2022 12:03:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="OJMDHJeM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4773E8438D; Mon, 27 Jun 2022 12:03:36 +0200 (CEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id ABE4C83FF8 for ; Mon, 27 Jun 2022 12:03:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kory.maincent@bootlin.com Received: (Authenticated sender: kory.maincent@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 042001BF20E; Mon, 27 Jun 2022 10:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1656324213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nI1uGK2Vu9AVzkzKDp8oZ+aymnxWyamLLU3jj9UTQTw=; b=OJMDHJeMIk6lUpU0Py3UO69QlvMYvNpGCshumOFr7N+2t3XNGkgu0hcaqVRD9grYnXXfE1 J8FMCwDUnrarK/xETjJKIdRubEmKbnrpdAjB0so91muCqPwwcJ5djWhsKc15eCdnfSsIyg qWyWK+96wEV3V/AANNV/kDW+gWhVvlqXbLIImS3+67KIEZSF7GatwAWaNrObFQ4uwVqUUA Sl+MQ7Ol8W/aRzrz2dtv+tClRAyxwYFIKFv80dlDBHbRe+qYNnnYO+8HKstEXxoQ3+zCtj 4+vFnRHZ43CHGFNRZG9+6mqFVLL7p0VBfUkYsA/Iu9gdi7P2iz8ows6yD8ughg== Date: Mon, 27 Jun 2022 12:03:32 +0200 From: =?UTF-8?B?S8O2cnk=?= Maincent To: Marek Vasut Cc: u-boot@lists.denx.de, thomas.petazzoni@bootlin.com Subject: Re: [PATCH] usb: kbd: allow probing even if usbkbd not in stdin Message-ID: <20220627120332.23bd6bcf@kmaincent-XPS-13-7390> In-Reply-To: <0ac21e40-3295-4dbd-22b3-253846b98a47@denx.de> References: <20220622085931.1205590-1-kory.maincent@bootlin.com> <0ac21e40-3295-4dbd-22b3-253846b98a47@denx.de> Organization: bootlin X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hello Marek, On Fri, 24 Jun 2022 20:12:31 +0200 Marek Vasut wrote: > On 6/22/22 10:59, kory.maincent@bootlin.com wrote: > > From: Kory Maincent > >=20 > > 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 st= din =20 >=20 > Environment should be up and running before USB, so this is likely not a= =20 > problem. Having a driver probing only in this specific state is weird? It should probe whatever the state of stdin. >=20 > > and we can not use this driver in other manner than stdin console. > >=20 > > 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.= =20 >=20 > Can you document the usecase in a bit more detail ? My usecase is to get a key press from the USB keyboard and do some thing ab= out it in board_init. I do not want to multiplex the keyboard input to stdin bu= t I still want to read character from it. > What exactly is the problem you are solving here ? > > stdinname =3D env_get("stdin"); > > #if CONFIG_IS_ENABLED(CONSOLE_MUX) > > - error =3D iomux_doenv(stdin, stdinname); > > - if (error) > > - return error; > > + if (strstr(stdinname, DEVNAME) !=3D NULL) { > > + error =3D 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)) { =20 >=20 > Maybe use strcmp() =3D=3D NULL to be consistent with the !=3D NULL check = above ? Yes, you are right. Regards, K=C3=B6ry