[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item |
Date: |
Tue, 8 Sep 2015 17:17:06 +0100 |
On 2 September 2015 at 01:56, Programmingkid <address@hidden> wrote:
> Add "Mount Image File..." and a "Eject Image File" menu items to
> cocoa interface. This patch makes sharing files between the
> host and the guest user-friendly.
>
> The "Mount Image File..." menu item displays a dialog box having the
> user pick an image file to use in QEMU. The image file is setup as
> a USB flash drive. The user can do the equivalent of removing the
> flash drive by selecting the file in the "Eject Image File" submenu.
>
> Signed-off-by: John Arbuckle <address@hidden>
>
> ---
> ui/cocoa.m | 212
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 210 insertions(+), 1 deletions(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 334e6f6..6c0ec18 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -52,6 +52,9 @@
> #endif
>
>
>
> #define cgrect(nsrect) (*(CGRect *)&(nsrect))
> +#define USB_DISK_ID "USB_DISK"
> +#define EJECT_IMAGE_FILE_TAG 2099
>
>
>
> typedef struct {
> int width;
> @@ -263,6 +266,43 @@ static void handleAnyDeviceErrors(Error * err)
> }
> }
>
>
>
> +/* Sends a command to the monitor console */
> +static void sendMonitorCommand(const char * commandString)
> +{
> + int index;
> + char * consoleName;
> + static QemuConsole *monitor;
> +
> + /* If the monitor console hasn't been found yet */
> + if(!monitor) {
> + index = 0;
> + /* Find the monitor console */
> + while (qemu_console_lookup_by_index(index) != NULL) {
> + consoleName =
> qemu_console_get_label(qemu_console_lookup_by_index(index));
> + if(strstr(consoleName, "monitor")) {
> + monitor = qemu_console_lookup_by_index(index);
> + break;
> + }
> + index++;
> + }
> + }
> +
> + /* If the monitor console was not found */
> + if(!monitor) {
> + NSBeep();
> + QEMU_Alert(@"Failed to find the monitor console!");
> + return;
> + }
> +
> + /* send each letter in the commandString to the monitor */
> + for (index = 0; index < strlen(commandString); index++) {
> + kbd_put_keysym_console(monitor, commandString[index]);
> + }
We're doing this by sending a string to the human monitor?
That definitely doesn't seem like the right way to do this
(and there might not even be a human monitor to talk to)...
What happens on machines with no USB bus?
thanks
-- PMM
- [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item, Programmingkid, 2015/09/01
- Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item, Markus Armbruster, 2015/09/02
- Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item,
Peter Maydell <=
- Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item, Programmingkid, 2015/09/08
- Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item, Peter Maydell, 2015/09/08
- Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item, Markus Armbruster, 2015/09/08
- Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item, Programmingkid, 2015/09/08
- Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item, Markus Armbruster, 2015/09/09
- Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item, Programmingkid, 2015/09/09
- Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item, Eric Blake, 2015/09/09
- Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item, Eric Blake, 2015/09/09
- Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item, Programmingkid, 2015/09/09
- Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item, Programmingkid, 2015/09/09