From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 256E6226612B9 for ; Wed, 25 Apr 2018 07:16:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E186EC00F; Wed, 25 Apr 2018 14:16:27 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-121-20.rdu2.redhat.com [10.10.121.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 868487C42; Wed, 25 Apr 2018 14:16:26 +0000 (UTC) To: Ruiyu Ni Cc: edk2-devel@lists.01.org, Hao A Wu , Michael D Kinney , Star Zeng References: <20180425054415.26028-1-ruiyu.ni@intel.com> From: Laszlo Ersek Message-ID: <1ec8e5ef-1c90-43dd-2c89-befc77cd31f5@redhat.com> Date: Wed, 25 Apr 2018 16:16:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180425054415.26028-1-ruiyu.ni@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 25 Apr 2018 14:16:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 25 Apr 2018 14:16:27 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: Re: [PATCH] MdeModulePkg/ConPlatform: Support short-form USB device path X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2018 14:16:28 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Hello Ray, On 04/25/18 07:44, Ruiyu Ni wrote: > Today's implementation does an exact device path match to check > whether the device path of a console is in ConIn/ConOut/ErrOut. > But that doesn't work for the USB keyboard. > Because when a platform have multiple USB port, ConIn needs to > carry all device paths corresponding to each port. > Even worse, today's BDS core logic removes the device path from > ConIn/ConOut/ErrOut when the connection to that device path fails. > So if user switches the USB keyboard from one port to another across > boot, the USB keyboard doesn't work in the second boot. > > ConPlatform driver solved this problem by adding the > IsHotPlugDevice() function. So that for USB keyboard, ConPlatform > doesn't care whether its device path is in ConIn or not. > But the rule is too loose, and now causes platform BDS cannot control > whether to enable USB keyboard as an active console. > > The patch changes ConPlatform to support USB short-form device path > when checking whether the device path of a console is in > ConIn/ConOut/ErrOut. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ruiyu Ni > Cc: Hao A Wu > Cc: Michael D Kinney > Cc: Star Zeng > --- > .../Universal/Console/ConPlatformDxe/ConPlatform.c | 526 ++++++++++++++------- > .../Universal/Console/ConPlatformDxe/ConPlatform.h | 20 +- > 2 files changed, 353 insertions(+), 193 deletions(-) just a quick question: in OvmfPkg and ArmVirtPkg (more precisely: ArmVirtQemu*), we add a "wild card" USB keyboard to ConIn: > STATIC PLATFORM_USB_KEYBOARD mUsbKeyboard = { > // > // USB_CLASS_DEVICE_PATH Keyboard > // > { > { > MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, > DP_NODE_LEN (USB_CLASS_DEVICE_PATH) > }, > 0xFFFF, // VendorId: any > 0xFFFF, // ProductId: any > 3, // DeviceClass: HID > 1, // DeviceSubClass: boot > 1 // DeviceProtocol: keyboard > }, > > // > // EFI_DEVICE_PATH_PROTOCOL End > // > { > END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, > DP_NODE_LEN (EFI_DEVICE_PATH_PROTOCOL) > } > }; > > [...] > > // > // Add the hardcoded short-form USB keyboard device path to ConIn. > // > EfiBootManagerUpdateConsoleVariable (ConIn, > (EFI_DEVICE_PATH_PROTOCOL *)&mUsbKeyboard, NULL); The idea is to connect any USB keyboard(s) that the virtual machine might have. This patch for ConPlatformDxe will keep that working, right? Thanks! Laszlo