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 B4FED2244E3E4 for ; Sun, 15 Apr 2018 14:15:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ED73611F602; Sun, 15 Apr 2018 21:15:26 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-121-58.rdu2.redhat.com [10.10.121.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B6CB2024CA9; Sun, 15 Apr 2018 21:15:25 +0000 (UTC) From: Laszlo Ersek To: edk2-devel@lists.01.org Cc: Ard Biesheuvel , Jordan Justen Date: Sun, 15 Apr 2018 23:15:23 +0200 Message-Id: <20180415211523.10635-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sun, 15 Apr 2018 21:15:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sun, 15 Apr 2018 21:15:26 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [PATCH] OvmfPkg/PlatformBootManagerLib: add USB keyboard to ConIn 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: Sun, 15 Apr 2018 21:15:28 -0000 PlatformInitializeConsole() (called by PlatformBootManagerBeforeConsole()) adds elements of "gPlatformConsole" to ConIn / ConOut / ErrOut (as requested per element) if at boot at least one of ConIn and ConOut doesn't exist. This typically applies to new VMs, and VMs with freshly recreated varstores. Add a USB keyboard wildcard to ConIn via "gPlatformConsole", so that we not only bind the PS/2 keyboard. (The PS/2 keyboard is added in PrepareLpcBridgeDevicePath()). Explicitly connecting the USB keyboard is necessary after commit 245c643cc8b7. Cc: Ard Biesheuvel Cc: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek --- Notes: Repo: https://github.com/lersek/edk2.git Branch: ovmf_usb_kbd_con OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c index 82f294577ecf..a50cd7bcaf90 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c @@ -27,6 +27,16 @@ typedef struct { } VENDOR_UART_DEVICE_PATH; #pragma pack() +// +// USB Keyboard Device Path structure +// +#pragma pack (1) +typedef struct { + USB_CLASS_DEVICE_PATH Keyboard; + EFI_DEVICE_PATH_PROTOCOL End; +} USB_KEYBOARD_DEVICE_PATH; +#pragma pack () + ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode = gPnpPs2Keyboard; ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode = gPnp16550ComPort; UART_DEVICE_PATH gUartDeviceNode = gUart; @@ -71,6 +81,24 @@ VENDOR_UART_DEVICE_PATH gDebugAgentUartDevicePath = { gEndEntire }; +STATIC USB_KEYBOARD_DEVICE_PATH gUsbKeyboardDevicePath = { + { + { + MESSAGING_DEVICE_PATH, + MSG_USB_CLASS_DP, + { + (UINT8)sizeof (USB_CLASS_DEVICE_PATH), + (UINT8)(sizeof (USB_CLASS_DEVICE_PATH) >> 8) + } + }, + 0xFFFF, // VendorId: any + 0xFFFF, // ProductId: any + 3, // DeviceClass: HID + 1, // DeviceSubClass: boot + 1 // DeviceProtocol: keyboard + }, + gEndEntire +}; // // Predefined platform default console device path @@ -80,6 +108,10 @@ PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = { (EFI_DEVICE_PATH_PROTOCOL *) &gDebugAgentUartDevicePath, (CONSOLE_OUT | CONSOLE_IN | STD_ERROR) }, + { + (EFI_DEVICE_PATH_PROTOCOL *)&gUsbKeyboardDevicePath, + CONSOLE_IN + }, { NULL, 0 -- 2.14.1.3.gb7cf6e02401b