On Feb 13, 2015, at 2:45 AM, Gerd Hoffmann wrote: > Hi, > >> We're going to need to automatically create and update >> the menu entries based on which consoles get created >> if we want this to work properly, I think. Gerd, any >> suggestions? Is there a hook for "list of active >> consoles has changed"? > > No. consoles are not hotpluggable. > >> What's the right way to get >> the printable name of a console? > > gd_vc_gfx_init() has code for gfx consoles (qemu_console_is_graphic() == > true). > > There is nothing for text consoles. > > Guess we should create a qemu_console_get_label() helper function in > ui/console.c, then move the code from gd_vc_gfx_init() to that place, > and for text consoles use QemuConsole->chr->label. > > cheers, > Gerd Thank you Gerd for your suggestion.
Here is my suggestion: int get_Graphics_Console_Index() int get_Serial_Console_Index() int get_Parallel_Console_Index() int get_Monitor_Console_Index() Then I would be able to do this: console_select(get_Serial_Console_Index()); The is simple and to the point. No having to have to search for a console. If the console does not exist, the function could return -1. Then the code would something like this: if(get_Serial_Console_Index() != -1) console_select(get_Serial_Console_Index()); else printf("Sorry but Serial console does not exist\n\a");