Re: [PATCH 1/2] Fix keymap used to talk with QEMU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 25, 2011 at 11:20:18AM -0600, Eric Blake wrote:
> On 08/25/2011 10:49 AM, Daniel P. Berrange wrote:
> >From: "Daniel P. Berrange"<berrange@xxxxxxxxxx>
> >
> >The QEMU 'sendkey' command expects keys to be encoded in the same
> >way as the RFB extended keycode set. Specfically it wants extended
> 
> s/Specfically/Specifically/
> 
> >keys to have the high bit of the first byte set, while the Linux
> >XT KBD driver codeset uses the low bit of the second byte. To deal
> >with this we introduce a new keymap 'RFB' and use that in the QEMU
> >driver
> >
> >* include/libvirt/libvirt.h.in: Add VIR_KEYCODE_SET_RFB
> >* src/qemu/qemu_driver.c: Use RFB keycode set instead of XT KBD
> >* src/util/virkeycode-mapgen.py: Auto-generate the RFB keycode
> >   set from the XT KBD set
> >* src/util/virkeycode.c: Add RFB keycode entry to table. Add a
> >   verify check on cardinality of the codeOffset table
> >---
> >  include/libvirt/libvirt.h.in  |    1 +
> >  src/qemu/qemu_driver.c        |    8 ++++----
> >  src/util/virkeycode-mapgen.py |   12 ++++++++++++
> >  src/util/virkeycode.c         |    5 +++++
> >  4 files changed, 22 insertions(+), 4 deletions(-)
> 
> >@@ -62,7 +63,10 @@ static unsigned int codeOffset[] = {
> >          offsetof(struct keycode, usb),
> >      [VIR_KEYCODE_SET_WIN32] =
> >          offsetof(struct keycode, win32),
> >+    [VIR_KEYCODE_SET_RFB] =
> >+        offsetof(struct keycode, rfb),
> >  };
> >+extern int (*codeOffsetVerify(void)) [verify_true (ARRAY_CARDINALITY(codeOffset) == VIR_KEYCODE_SET_LAST)]; \
> 
> Why the trailing backslash?
> 
> Also, open-coding this verify is dangerous; gcc warnings have
> changed over time, rendering certain verification styles that were
> once safe into something that trips up -Werror.  It is safer (and
> shorter!) to let gnulib worry about gcc quirks, by changing this
> line to just be:
> 
> verify(ARRAY_CARDINALITY(codeOffset) == VIR_KEYCODE_SET_LAST);

Yeah it was a stupid cut+paste from src/util/util.h where we had to
open-code it for the enums, because the gnulib macro resulted in
clashing symbols when used more than one.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]