Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
qemu.820
0163-gtk-Fix-serial-vc.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0163-gtk-Fix-serial-vc.patch of Package qemu.820
From 2b308e42819d789d8c46d7f0e8e21f15867b56a4 Mon Sep 17 00:00:00 2001 From: Cole Robinson <crobinso@redhat.com> Date: Thu, 24 Apr 2014 13:35:54 -0400 Subject: [PATCH] gtk: Fix -serial vc Try kicking off a rhel5 text install over serial, the text menu navigation is all messed up, and some of the kernel boot messages are randomly corrupted. Drop use of a pty and just use vte infrastructure for reading and writing. This fixes the above corruption, and is simpler to boot. (I don't know what was wrong with the original code though. FWIW this is what virt-manager has done for years). Signed-off-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> (cherry picked from commit d4370741402a97b8b6d0c38fef18ab38bf25ab22) [LM: BNC#934517, BNC#934506] Signed-off-by: Lin Ma <lma@suse.com> --- ui/gtk.c | 41 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 461c65e..a73e35c 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -118,7 +118,6 @@ typedef struct VirtualConsole GtkWidget *scrolled_window; CharDriverState *chr; #endif - int fd; } VirtualConsole; typedef struct GtkDisplayState @@ -1170,9 +1169,12 @@ static gboolean gd_focus_out_event(GtkWidget *widget, static int gd_vc_chr_write(CharDriverState *chr, const uint8_t *buf, int len) { +#if defined(CONFIG_VTE) VirtualConsole *vc = chr->opaque; - return vc ? write(vc->fd, buf, len) : len; + vte_terminal_feed(VTE_TERMINAL(vc->terminal), (const char *)buf, len); +#endif + return len; } static int nb_vcs; @@ -1198,19 +1200,12 @@ void early_gtk_display_init(void) } #if defined(CONFIG_VTE) -static gboolean gd_vc_in(GIOChannel *chan, GIOCondition cond, void *opaque) +static gboolean gd_vc_in(VteTerminal *terminal, gchar *text, guint size, + gpointer user_data) { - VirtualConsole *vc = opaque; - uint8_t buffer[1024]; - ssize_t len; - - len = read(vc->fd, buffer, sizeof(buffer)); - if (len <= 0) { - return FALSE; - } - - qemu_chr_be_write(vc->chr, buffer, len); + VirtualConsole *vc = user_data; + qemu_chr_be_write(vc->chr, (uint8_t *)text, (unsigned int)size); return TRUE; } #endif @@ -1222,13 +1217,8 @@ static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSL const char *label; char buffer[32]; char path[32]; -#if VTE_CHECK_VERSION(0, 26, 0) - VtePty *pty; -#endif - GIOChannel *chan; GtkWidget *scrolled_window; GtkAdjustment *vadjustment; - int master_fd, slave_fd; snprintf(buffer, sizeof(buffer), "vc%d", index); snprintf(path, sizeof(path), "<QEMU>/View/VC%d", index); @@ -1247,16 +1237,7 @@ static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSL gtk_accel_map_add_entry(path, GDK_KEY_2 + index, HOTKEY_MODIFIERS); vc->terminal = vte_terminal_new(); - - master_fd = qemu_openpty_raw(&slave_fd, NULL); - g_assert(master_fd != -1); - -#if VTE_CHECK_VERSION(0, 26, 0) - pty = vte_pty_new_foreign(master_fd, NULL); - vte_terminal_set_pty_object(VTE_TERMINAL(vc->terminal), pty); -#else - vte_terminal_set_pty(VTE_TERMINAL(vc->terminal), master_fd); -#endif + g_signal_connect(vc->terminal, "commit", G_CALLBACK(gd_vc_in), vc); vte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->terminal), -1); @@ -1267,7 +1248,6 @@ static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSL vte_terminal_set_size(VTE_TERMINAL(vc->terminal), 80, 25); - vc->fd = slave_fd; vc->chr->opaque = vc; vc->scrolled_window = scrolled_window; @@ -1285,9 +1265,6 @@ static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSL vc->chr->init(vc->chr); } - chan = g_io_channel_unix_new(vc->fd); - g_io_add_watch(chan, G_IO_IN, gd_vc_in, vc); - #endif /* CONFIG_VTE */ return group; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor