qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] console/gtk: add qemu_console_get_label


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH] console/gtk: add qemu_console_get_label
Date: Wed, 18 Feb 2015 09:18:17 +0100

  Hi,

> Thanks for this code. Is this how I should display the Serial console?


> void myDisplaySerialConsole()
> {
>     QemuConsole *con;
>     char *name;
>     int index = 0;
>     
>     con = qemu_console_lookup_by_index(0);
>     while(con != NULL) {
>         name = qemu_console_get_label(con);
>         
>         /* If we found the console */
>         if (strstr(name, "Serial")) {
>             console_select(index);
>             break;
>         }        
>         index++;
>         con = qemu_console_lookup_by_index(index);

This mixes up several things.

When initializing the UI you'll loop over the consoles, like this:

    QemuConsole *con;
    int i;

    for (i = 0;; i++) {
        con = qemu_console_lookup_by_index(i);
        if (!con) {
            break;
        }
        /*
         * add a menu entry for the console here,
         * using qemu_console_get_label() to get
         * the text for the menu entry
         */    
    }

When the menu entry is activated by the user use console_select() to
switch.

cheers,
  Gerd





reply via email to

[Prev in Thread] Current Thread [Next in Thread]