Support redirect -curses over a character driver
PATCH 1/1 Support redirect -curses over a character driver
I love the -curses feature but I really wanted to use it over a telnet:
character device. This patch enables this and changes the syntax of the
-curses argument to take a character device. 'stdio' is special cased to not
go through a character device. The rest use a pty to proxy the data to the character device. curses insists on a pty so we limit this feature to everything but WIN32 since I don't believe Windows supports ptys.
Using this patch, you can now do something like '-curses telnet::1028,nowait'. To get the old behavior, just use '-curses stdio'.
console.h +1 -1
@@ -141,7 +141,7 @@ int vnc_display_password(DisplayState *ds, const char *password);void do_info_vnc (void );/* curses.c */ -void curses_display_init (DisplayState *ds,int full_screen); +void curses_display_init (DisplayState *ds,CharDriverState *chr,int full_screen);/* x_keymap.c */ extern uint8_t _translate_keycode (const int key);
curses.c +92 -4
134 lines not on this page · raw message
vl.c +18 -8
@@ -172,7 +172,6 @@ BlockDriverState *bs_snapshots;int vga_ram_size;static DisplayState display_state;int nographic; -int curses;const char * keyboard_layout =NULL ;int64_t ticks_per_sec;int ram_size;
@@ -7691,7 +7690,7 @@ static void help(int exitcode) "-no-acpi disable ACPI\n"#endif #ifdef CONFIG_CURSES - "-curses use a curses/ncurses interface instead of SDL\n" + "-curses dev use a curses/ncurses to char driver 'dev' instead of SDL\n"#endif "-no-reboot exit instead of rebooting\n" "-loadvm file start right away with a saved state (loadvm in monitor)\n"
@@ -7896,7 +7895,7 @@ const QEMUOption qemu_options[] = { { "smp", HAS_ARG, QEMU_OPTION_smp }, { "vnc", HAS_ARG, QEMU_OPTION_vnc }, #ifdef CONFIG_CURSES - { "curses", 0, QEMU_OPTION_curses }, + { "curses", HAS_ARG, QEMU_OPTION_curses }, #endif/* temporary options */
@@ -8190,6 +8189,7 @@ int main(int argc, char **argv)int fds[2 ];const char *pid_file =NULL ;VLANState *vlan; +const char *curses_device =NULL ;LIST_INIT (&vm_change_state_head);#ifndef _WIN32
@@ -8234,7 +8234,6 @@ int main(int argc, char **argv)#endif snapshot =0 ; nographic =0 ; - curses =0 ; kernel_filename =NULL ; kernel_cmdline ="" ; cyls = heads = secs =0 ;
@@ -8411,7 +8410,7 @@ int main(int argc, char **argv)break ;#ifdef CONFIG_CURSES case QEMU_OPTION_curses: - curses =1 ; + curses_device = optarg;break ;#endif case QEMU_OPTION_portrait:
@@ -8956,7 +8955,7 @@ int main(int argc, char **argv)/* terminal init */ memset (&display_state,0 ,sizeof (display_state));if (nographic) { -if (curses) { +if (curses_device) {fprintf (stderr,"fatal: -nographic can't be used with -curses\n" );exit (1 ); }
@@ -8968,8 +8967,19 @@ int main(int argc, char **argv)exit (1 ); } else#if defined(CONFIG_CURSES ) -if (curses) { -curses_display_init (ds, full_screen); +if (curses_device) { +CharDriverState *chr =NULL ; + +#ifndef _WIN32 +if (strcmp (curses_device,"stdio" ) !=0 ) { + chr =qemu_chr_open (curses_device); +if (chr ==NULL ) { +fprintf (stderr,"fatal: could not open curses device\n" ); +exit (1 ); + } + } +#endif +curses_display_init (ds, chr, full_screen); } else#endif {
Anthony Liguori writes ("[Qemu-devel] [PATCH] Support redirect -curses
Quoted 4 lines
over a character driver"): I love the -curses feature but I really wanted to use it over a telnet: character device. This patch enables this and changes the syntax of the -curses argument to take a character device.
Surely it would be better to introduce a new option and leave the old one (which people might be using) behaving the old way ?
Ian.
Quoted 11 lines · Ian Jackson
Anthony Liguori writes ("[Qemu-devel] [PATCH] Support redirect -curses
Quoted 5 lines
over a character driver"): I love the -curses feature but I really wanted to use it over a telnet: character device. This patch enables this and changes the syntax of the -curses argument to take a character device.
Surely it would be better to introduce a new option and leave the old one (which people might be using) behaving the old way ?
I don't really feel strongly either way.
Regards,
Anthony Liguori
Quoted 4 lines
Ian.
Quoted 12 lines · Ian Jackson
Anthony Liguori writes ("[Qemu-devel] [PATCH] Support redirect -curses
Quoted 5 lines
over a character driver"): I love the -curses feature but I really wanted to use it over a telnet: character device. This patch enables this and changes the syntax of the -curses argument to take a character device.
Surely it would be better to introduce a new option and leave the old one (which people might be using) behaving the old way ?
-curses hasn't been in any official release (well, kvm-63 will be out soon), so users haven't yet had a chance to rely on it.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Quoted 9 lines · Avi Kivity
Quoted 8 lines · Ian Jackson
Anthony Liguori writes ("[Qemu-devel] [PATCH] Support redirect -curses
Quoted 5 lines
over a character driver"): I love the -curses feature but I really wanted to use it over a telnet: character device. This patch enables this and changes the syntax of the -curses argument to take a character device.
Quoted 7 lines
Quoted 4 lines
Surely it would be better to introduce a new option and leave the old one (which people might be using) behaving the old way ?
-curses hasn't been in any official release (well, kvm-63 will be out soon), so users haven't yet had a chance to rely on it.
I'm on the fence because while I like what I've posted, I'd like to eventually tunnel the curses data over VNC in which case, having a separate option makes sense. -curses would imply that the GUI would be rendered with curses.
So, 'qemu -curses' does what you think, 'qemu -cga telnet::1024,server -vnc :2' does what I want and still lets you interact with VNC, and then down the road 'qemu -cga vnc:org.qemu.vga -vnc :2' allows CGA tunneling over VNC.
But this is really future looking so I'm somewhat indifferent to what we do now. I'll update the patch according to whatever the consensus is.
Regards,
Anthony Liguori
Quoted 3 lines · Anthony Liguori
I'm on the fence because while I like what I've posted, I'd like to eventually tunnel the curses data over VNC in which case, having a separate option makes sense. -curses would imply that the GUI would be rendered with curses.
I'm lost. What does 'tunnel curses data over vnc' mean? A new character cell based encoding (vs. pixel-based)?
Quoted 4 lines
So, 'qemu -curses' does what you think, 'qemu -cga telnet::1024,server -vnc :2' does what I want and still lets you interact with VNC, and
then down the road 'qemu -cga vnc:org.qemu.vga -vnc :2' allows CGA tunneling over VNC.
What's -cga?
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Quoted 6 lines · Avi Kivity
Quoted 3 lines · Anthony Liguori
I'm on the fence because while I like what I've posted, I'd like to eventually tunnel the curses data over VNC in which case, having a separate option makes sense. -curses would imply that the GUI would be rendered with curses.
I'm lost. What does 'tunnel curses data over vnc' mean? A new character cell based encoding (vs. pixel-based)?
Yes. I was actually thinking of tunneling the curses data but another option would be a more proper character-based encoding. The advantage of that is that you could also send over fonts.
Quoted 5 lines
Quoted 3 lines
So, 'qemu -curses' does what you think, 'qemu -cga telnet::1024,server -vnc :2' does what I want and still lets you interact with VNC, and then down the road 'qemu -cga vnc:org.qemu.vga -vnc :2' allows CGA tunneling over VNC.
What's -cga?
That would be the second option which controlled what the CGA data was sent over. stdio would be the default. It doesn't have to be -cga.
Regards,
Anthony Liguori
Quoted 10 lines · Anthony Liguori
Quoted 6 lines · Avi Kivity
Quoted 3 lines · Anthony Liguori
I'm on the fence because while I like what I've posted, I'd like to eventually tunnel the curses data over VNC in which case, having a separate option makes sense. -curses would imply that the GUI would be rendered with curses.
I'm lost. What does 'tunnel curses data over vnc' mean? A new character cell based encoding (vs. pixel-based)?
Yes. I was actually thinking of tunneling the curses data but another option would be a more proper character-based encoding. The advantage of that is that you could also send over fonts.
curses is very un-vnc-like, it's a single stream an you need all of it to get something meaningful. Much more in the spirit of vnc is to encode 'character tiles', and to allow coalesced updates like the regular vnc protocol.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
So, 'qemu -curses' does what you think, 'qemu -cga telnet::1024,server -vnc :2' does what I want and still lets you interact with VNC, and then down the road 'qemu -cga vnc:org.qemu.vga -vnc :2' allows CGA tunneling over VNC.
What's -cga?
That would be the second option which controlled what the CGA data was sent over. stdio would be the default. It doesn't have to be -cga.
Ah, CGA as in color graphics adapter. Why not add the encoding to vnc and use the regular -vnc option? if both viewer and server support the feature, and if the display is in text mode, it would be used automatically.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Quoted 6 lines · Avi Kivity
Quoted 3 lines · Anthony Liguori
Yes. I was actually thinking of tunneling the curses data but another option would be a more proper character-based encoding. The advantage of that is that you could also send over fonts.
curses is very un-vnc-like, it's a single stream an you need all of it to get something meaningful. Much more in the spirit of vnc is to encode 'character tiles', and to allow coalesced updates like the regular vnc protocol.
Yes, my main interest in curses was to avoid having to deal with character mapping. I was planning on just using vte terminal to render the data. Maybe doing a proper encoding is the right thing to do though.
Quoted 1 line
Ah, CGA as in color graphics adapter. Why not add the encoding to vnc and use the regular -vnc option? if both viewer and server support the feature, and if the display is in text mode, it would be used automatically.
Yes, this is what I want. I still want to be able to connect to it via telnet though independent of VNC.
Regards,
Anthony Liguori