blob: 31b27860edbd20ed308bbf2f364977f836ce2afa (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
Arrow key not functional in QEMU monitor when using nographic on Windows 11 host
Description of problem:
The arrow keys do not work on the Windows QEMU when using -nographic option. On the Linux QEMU they work.
Steps to reproduce:
1. Download the qemu source code from https://download.qemu.org/qemu-8.0.0.tar.xz. THe sha256sum of the file is bb60f0341531181d6cc3969dd19a013d0427a87f918193970d9adb91131e56d0.
2. Prepare the build system on MSYS2 according to the instructions on https://wiki.qemu.org/Hosts/W32#Native_builds_with_MSYS2.
3. Uncompress the source code using `tar -xf qemu-8.0.0.tar.xz`.
4. Change the working directory to qemu-8.0.0/. The build configuration command is `./configure --target-list=arm-softmmu --extra-cflags="-g -ggdb"`
5. Run the command `./qemu-system-arm -s -S -M virt -nographic`.
6. Press Ctrl-C A to switch to QEMU monitor.
7. Input "help" command to the monitor.
8. Press Arrow-Up key.
9. The previous "help" command does not appear in the monitor prompt.
Additional information:
1. The pre-built binary downloaded from https://qemu.weilnetz.de/w64/qemu-w64-setup-20230424.exe has the same behaviour.
2. The QEMU from MSYS2, `pacman -S mingw-w64-x86_64-qemu`, has the same behaviour.
3. If the "-nographic" option is removed, the arrow-up key works in the GTK console.
4. Neither of arrow-up, arrow-down, arrow-right, arrow-left key work.
5. If the valid kernel and rootfs are added in the command line by "-kernel" and "-initrd" options, neither key work after booting to the Linux successfully.
6. If the code `dwMode |= ENABLE_LINE_INPUT;` in the function `qemu_chr_open_stdio()` is changed to `dwMode |= ENABLE_LINE_INPUT|ENABLE_VIRTUAL_TERMINAL_INPUT;`, build again. All arrow keys work.
7. The VT sequence support was added in `EmulatorPkg/Win/Host/WinThunk.c` by this commit https://gitlab.com/qemu-project/edk2/-/commit/5601e90d5cdbc4cea748e00e34ae07ce39bd700f.
8. The above commit is to add VT sequence support at compile-time. Microsoft provides some code to enable it at run-time on https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#example-of-enabling-virtual-terminal-processing.
9. The function readline_handle_byte() is not called when the VT sequence is not enabled.
|