From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upj52-0005Vx-4b for qemu-devel@nongnu.org; Thu, 20 Jun 2013 13:55:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpiwK-0001yQ-Al for qemu-devel@nongnu.org; Thu, 20 Jun 2013 13:46:35 -0400 Received: from mail-wg0-x236.google.com ([2a00:1450:400c:c00::236]:49198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpiwK-0001xg-0Q for qemu-devel@nongnu.org; Thu, 20 Jun 2013 13:46:32 -0400 Received: by mail-wg0-f54.google.com with SMTP id n11so5675196wgh.21 for ; Thu, 20 Jun 2013 10:46:31 -0700 (PDT) From: "=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=" Date: Thu, 20 Jun 2013 19:46:01 +0200 Message-Id: <1371750371-18491-3-git-send-email-marcandre.lureau@redhat.com> In-Reply-To: <1371750371-18491-1-git-send-email-marcandre.lureau@redhat.com> References: <1371750371-18491-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 02/12] char: add qemu_chr_fe_event() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: spice-devel@lists.freedesktop.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Signed-off-by: Marc-André Lureau --- include/sysemu/char.h | 10 ++++++++++ qemu-char.c | 7 +++++++ spice-qemu-char.c | 10 ++++++++++ 3 files changed, 27 insertions(+) diff --git a/include/sysemu/char.h b/include/sysemu/char.h index 066c216..eee70fe 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -69,6 +69,7 @@ struct CharDriverState { void (*chr_accept_input)(struct CharDriverState *chr); void (*chr_set_echo)(struct CharDriverState *chr, bool echo); void (*chr_set_fe_open)(struct CharDriverState *chr, int fe_open); + void (*chr_fe_event)(struct CharDriverState *chr, int event); void *opaque; char *label; char *filename; @@ -136,6 +137,15 @@ void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo); void qemu_chr_fe_set_open(struct CharDriverState *chr, int fe_open); /** + * @qemu_chr_fe_event: + * + * Send an event from the back end to the front end. + * + * @event the event to send + */ +void qemu_chr_fe_event(CharDriverState *s, int event); + +/** * @qemu_chr_fe_printf: * * Write to a character backend using a printf style interface. diff --git a/qemu-char.c b/qemu-char.c index 2c3cfe6..14e268e 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3317,6 +3317,13 @@ void qemu_chr_fe_set_open(struct CharDriverState *chr, int fe_open) } } +void qemu_chr_fe_event(struct CharDriverState *chr, int event) +{ + if (chr->chr_fe_event) { + chr->chr_fe_event(chr, event); + } +} + int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond, GIOFunc func, void *user_data) { diff --git a/spice-qemu-char.c b/spice-qemu-char.c index 6d147a7..0d77f77 100644 --- a/spice-qemu-char.c +++ b/spice-qemu-char.c @@ -223,6 +223,15 @@ static void spice_chr_set_fe_open(struct CharDriverState *chr, int fe_open) } } +static void spice_chr_fe_event(struct CharDriverState *chr, int event) +{ +#if SPICE_SERVER_VERSION >= 0x000c02 + SpiceCharDriver *s = chr->opaque; + + spice_server_port_event(&s->sin, event); +#endif +} + static void print_allowed_subtypes(void) { const char** psubtype; @@ -256,6 +265,7 @@ static CharDriverState *chr_open(const char *subtype) chr->chr_close = spice_chr_close; chr->chr_set_fe_open = spice_chr_set_fe_open; chr->explicit_be_open = true; + chr->chr_fe_event = spice_chr_fe_event; QLIST_INSERT_HEAD(&spice_chars, s, next); -- 1.8.3.rc1.49.g8d97506