mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
monitor: Rework modal password input (Jan Kiszka)
Currently, waiting for the user to type in some password blocks the whole VM because monitor_readline starts its own I/O loop. And this loop also screws up reading passwords from virtual console. Patch below fixes the shortcomings by using normal I/O processing also for waiting on a password. To keep to modal property for the monitor terminal, the command handler is temporarily replaced by a password handler and a callback infrastructure is established to process the result before switching back to command mode. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6710 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
9dd442b123
commit
bb5fc20f7c
6 changed files with 108 additions and 65 deletions
19
vl.c
19
vl.c
|
@ -2661,6 +2661,16 @@ int usb_device_add_dev(USBDevice *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void usb_msd_password_cb(void *opaque, int err)
|
||||
{
|
||||
USBDevice *dev = opaque;
|
||||
|
||||
if (!err)
|
||||
usb_device_add_dev(dev);
|
||||
else
|
||||
dev->handle_destroy(dev);
|
||||
}
|
||||
|
||||
static int usb_device_add(const char *devname, int is_hotplug)
|
||||
{
|
||||
const char *p;
|
||||
|
@ -2680,14 +2690,15 @@ static int usb_device_add(const char *devname, int is_hotplug)
|
|||
} else if (strstart(devname, "disk:", &p)) {
|
||||
BlockDriverState *bs;
|
||||
|
||||
dev = usb_msd_init(p, &bs);
|
||||
dev = usb_msd_init(p);
|
||||
if (!dev)
|
||||
return -1;
|
||||
bs = usb_msd_get_bdrv(dev);
|
||||
if (bdrv_key_required(bs)) {
|
||||
autostart = 0;
|
||||
if (is_hotplug && monitor_read_bdrv_key(bs) < 0) {
|
||||
dev->handle_destroy(dev);
|
||||
return -1;
|
||||
if (is_hotplug) {
|
||||
monitor_read_bdrv_key_start(bs, usb_msd_password_cb, dev);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(devname, "wacom-tablet")) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue