From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=53331 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OmQoD-0003Th-Nw for qemu-devel@nongnu.org; Fri, 20 Aug 2010 08:34:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OmQoC-0001R3-Dy for qemu-devel@nongnu.org; Fri, 20 Aug 2010 08:34:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50350) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmQoC-0001Qt-2m for qemu-devel@nongnu.org; Fri, 20 Aug 2010 08:34:56 -0400 Message-ID: <4C6E766A.2000809@redhat.com> Date: Fri, 20 Aug 2010 14:34:50 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 6/9] spice: add keyboard References: <1282221625-29501-1-git-send-email-kraxel@redhat.com> <1282221625-29501-7-git-send-email-kraxel@redhat.com> <4C6D3E92.8060604@codemonkey.ws> In-Reply-To: <4C6D3E92.8060604@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org >> +static const SpiceKbdInterface kbd_interface = { >> + .base.type = SPICE_INTERFACE_KEYBOARD, >> + .base.description = "qemu keyboard", >> + .base.major_version = SPICE_INTERFACE_KEYBOARD_MAJOR, >> + .base.minor_version = SPICE_INTERFACE_KEYBOARD_MINOR, >> + .push_scan_freg = kbd_push_key, >> + .get_leds = kbd_get_leds, >> +}; >> + >> +static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag) >> +{ >> + kbd_put_keycode(frag); >> +} > > Instead of using this interface which includes multi-byte sequences, it > would probably make sense to use the same compressed encoding that VNC > uses and introduce a new function that takes this encoding type. The > advantage is that one call == one keycode so it's far less prone to > goofiness. Hmm? Not sure what you want here ... kbd_push_key is called by libspice which feeds us with a ps/2 data stream for the keyboard. Yes, one of those x86-isms in spice. Yes, the ps/2 data stream also travels over the wire, i.e. the spice client has to hop through loops to convert whatever it gets into a ps/2 data stream for us. Luckily ps/2 data is exactly what qemu expects to get via kbd_put_keycode, so I can simply pass on what I get, and it is IMHO pretty pointless to do something else ... > It's probably more robust in the long term to explicitly convert the > ledstate to from the QEMU format to the libspice format even if they > both happen to be the same. Ok. cheers, Gerd