From patchwork Tue Mar 9 16:09:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 47171 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6732CB7D0D for ; Wed, 10 Mar 2010 03:44:59 +1100 (EST) Received: from localhost ([127.0.0.1]:35774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Np2YC-0002fX-2B for incoming@patchwork.ozlabs.org; Tue, 09 Mar 2010 11:44:56 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Np1zv-0006BD-FB for qemu-devel@nongnu.org; Tue, 09 Mar 2010 11:09:31 -0500 Received: from [199.232.76.173] (port=37392 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Np1zu-0006AM-Ro for qemu-devel@nongnu.org; Tue, 09 Mar 2010 11:09:30 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Np1zt-0006fY-CL for qemu-devel@nongnu.org; Tue, 09 Mar 2010 11:09:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49153) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Np1zs-0006fM-Vp for qemu-devel@nongnu.org; Tue, 09 Mar 2010 11:09:29 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o29G9RSO009374 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 9 Mar 2010 11:09:27 -0500 Received: from zweiblum.home.kraxel.org (vpn2-9-70.ams2.redhat.com [10.36.9.70]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o29G9PZ4006188; Tue, 9 Mar 2010 11:09:26 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id BA9527010F; Tue, 9 Mar 2010 17:09:24 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 9 Mar 2010 17:09:24 +0100 Message-Id: <1268150964-20302-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH] vnc: add noledsync option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add an option to disable syncing capslock/numlock leds state with capslock/numlock keyboard state. Needed for guests which use the keyboard leds for something else. Signed-off-by: Gerd Hoffmann --- vnc.c | 10 ++++++++-- vnc.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/vnc.c b/vnc.c index 38690e2..007ce31 100644 --- a/vnc.c +++ b/vnc.c @@ -1111,7 +1111,8 @@ static void vnc_disconnect_finish(VncState *vs) } vnc_remove_timer(vs->vd); - qemu_remove_led_event_handler(vs->led); + if (vs->vd->ledsync) + qemu_remove_led_event_handler(vs->led); qemu_free(vs); } @@ -2424,7 +2425,8 @@ static void vnc_connect(VncDisplay *vd, int csock) vnc_flush(vs); vnc_read_when(vs, protocol_version, 12); reset_keys(vs); - vs->led = qemu_add_led_event_handler(kbd_leds, vs); + if (vs->vd->ledsync) + vs->led = qemu_add_led_event_handler(kbd_leds, vs); vnc_init_timer(vd); @@ -2545,6 +2547,7 @@ int vnc_display_open(DisplayState *ds, const char *display) int saslErr; #endif int acl = 0; + int ledsync = 1; if (!vnc_display) return -1; @@ -2562,6 +2565,8 @@ int vnc_display_open(DisplayState *ds, const char *display) password = 1; /* Require password auth */ } else if (strncmp(options, "reverse", 7) == 0) { reverse = 1; + } else if (strncmp(options, "noledsync", 9) == 0) { + ledsync = 0; #ifdef CONFIG_VNC_SASL } else if (strncmp(options, "sasl", 4) == 0) { sasl = 1; /* Require SASL auth */ @@ -2707,6 +2712,7 @@ int vnc_display_open(DisplayState *ds, const char *display) return -1; } #endif + vs->ledsync = ledsync; if (reverse) { /* connect to viewer */ diff --git a/vnc.h b/vnc.h index 0fc89bd..bdaea46 100644 --- a/vnc.h +++ b/vnc.h @@ -99,6 +99,7 @@ struct VncDisplay int lsock; DisplayState *ds; kbd_layout_t *kbd_layout; + int ledsync; struct VncSurface guest; /* guest visible surface (aka ds->surface) */ DisplaySurface *server; /* vnc server surface */