]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: qemu: Enable usb keyboard as an input device
authorAlper Nebi Yasak <alpernebiyasak@gmail.com>
Mon, 14 Aug 2023 17:39:43 +0000 (20:39 +0300)
committerTom Rini <trini@konsulko.com>
Thu, 24 Aug 2023 20:47:25 +0000 (16:47 -0400)
Commit 02be57caf730 ("riscv: qemu: Enable usb keyboard as an input
device") adds PCI xHCI support to QEMU RISC-V virtual machines and
enables using a USB keyboard as one of the input devices. Similarly,
enable those for ARM virtual machines as well.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
arch/arm/Kconfig
board/emulation/qemu-arm/qemu-arm.c
board/emulation/qemu-arm/qemu-arm.env
configs/qemu_arm64_defconfig
configs/qemu_arm_defconfig
doc/board/emulation/qemu-arm.rst

index 9332829874842abfe713e02b4fb3c630ecf853f0..71f820e443bb7ce159677fda8316bf9fdf46ff83 100644 (file)
@@ -1042,6 +1042,11 @@ config ARCH_QEMU
        imply SYS_WHITE_ON_BLACK
        imply SYS_CONSOLE_IS_IN_ENV
        imply PRE_CONSOLE_BUFFER
+       imply USB
+       imply USB_XHCI_HCD
+       imply USB_XHCI_PCI
+       imply USB_KEYBOARD
+       imply CMD_USB
 
 config ARCH_RMOBILE
        bool "Renesas ARM SoCs"
index dfea0d92a3c8d434261c8e204f256cc0e8b1d32c..942f1fff571720f15a90647b082a5535c9f513c5 100644 (file)
@@ -11,6 +11,7 @@
 #include <fdtdec.h>
 #include <init.h>
 #include <log.h>
+#include <usb.h>
 #include <virtio_types.h>
 #include <virtio.h>
 
@@ -114,6 +115,10 @@ int board_late_init(void)
         */
        virtio_init();
 
+       /* start usb so that usb keyboard can be used as input device */
+       if (CONFIG_IS_ENABLED(USB_KEYBOARD))
+               usb_init();
+
        return 0;
 }
 
index 86a99a2e87131f90318220406086207e1846d1b9..fb4adef281ede8837eb90aeec3d84b5bee711c89 100644 (file)
@@ -2,7 +2,7 @@
 
 /* environment for qemu-arm and qemu-arm64 */
 
-stdin=serial
+stdin=serial,usbkbd
 stdout=serial,vidconsole
 stderr=serial,vidconsole
 fdt_high=0xffffffff
index 2080f5ee9a5f417b633ac5f87b193de83b83cfd1..5fdf496a4599e526836f89f978f4bc5fa83e062f 100644 (file)
@@ -35,7 +35,6 @@ CONFIG_CMD_NVEDIT_EFI=y
 CONFIG_CMD_DFU=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_PCI=y
-CONFIG_CMD_USB=y
 CONFIG_CMD_TPM=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_ENV_IS_IN_FLASH=y
@@ -68,7 +67,6 @@ CONFIG_SYSRESET=y
 CONFIG_SYSRESET_CMD_POWEROFF=y
 CONFIG_SYSRESET_PSCI=y
 CONFIG_TPM2_MMIO=y
-CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_PCI=y
 CONFIG_SEMIHOSTING=y
index 7cb1e9f037ff7da939f0ea70ec4042308aac82a1..1347b86f34b1dca8e7ecb0dd9b81c34721371179 100644 (file)
@@ -36,7 +36,6 @@ CONFIG_CMD_NVEDIT_EFI=y
 CONFIG_CMD_DFU=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_PCI=y
-CONFIG_CMD_USB=y
 CONFIG_CMD_TPM=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_ENV_IS_IN_FLASH=y
@@ -69,7 +68,6 @@ CONFIG_SYSRESET=y
 CONFIG_SYSRESET_CMD_POWEROFF=y
 CONFIG_SYSRESET_PSCI=y
 CONFIG_TPM2_MMIO=y
-CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_PCI=y
 CONFIG_TPM=y
index 1108fe5f8184f860eb079e9ebd84de12675caa08..8ec5349fc9ea31fcb3b340cea820cd978ba37315 100644 (file)
@@ -84,6 +84,10 @@ can be enabled with the following command line parameters:
 
     -device usb-ehci,id=ehci
 
+- To add a USB keyboard attached to an emulated xHCI controller, pass e.g.::
+
+    -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0
+
 - To add an NVMe disk, pass e.g.::
 
     -drive if=none,file=disk.img,id=mydisk -device nvme,drive=mydisk,serial=foo