[PATCH] Keyboard layout support for QEMU/KVM

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

 



This patch adds support for qemu's -k option, which is required to run
virt-manager with a non-US keymap. Without it, keys are remapped a number
of times, ending up with a completely unusable layout.

Even with this patch I am having problems using the AltGr key, returning a
scancode of 00. This seems to be a qemu problem though.

-- 
Daniel Hokka Zakrisson
Index: src/qemu_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_conf.c,v
retrieving revision 1.26
diff -u -p -r1.26 qemu_conf.c
--- src/qemu_conf.c	14 Jan 2008 14:05:25 -0000	1.26
+++ src/qemu_conf.c	14 Jan 2008 17:55:33 -0000
@@ -218,6 +218,7 @@ void qemudFreeVMDef(struct qemud_vm_def 
         input = input->next;
         free(prev);
     }
+    xmlFree(def->keymap);
     free(def);
 }
 
@@ -1245,6 +1246,7 @@ static struct qemud_vm_def *qemudParseXM
             else
                 strcpy(def->vncListen, driver->vncListen);
             def->vncListen[BR_INET_ADDR_MAXLEN-1] = '\0';
+            def->keymap = (char *) xmlGetProp(obj->nodesetval->nodeTab[0], BAD_CAST "keymap");
             xmlFree(vncport);
             xmlFree(vnclisten);
         } else if (!strcmp((char *)prop, "sdl")) {
@@ -1807,6 +1809,12 @@ int qemudBuildCommandLine(virConnectPtr 
             goto no_memory;
         if (!((*argv)[++n] = strdup(vncdisplay)))
             goto no_memory;
+        if (vm->def->keymap) {
+            if (!((*argv)[++n] = strdup("-k")))
+                goto no_memory;
+            if (!((*argv)[++n] = strdup(vm->def->keymap)))
+                goto no_memory;
+        }
     } else if (vm->def->graphicsType == QEMUD_GRAPHICS_NONE) {
         /* Nada - we added -nographic earlier in this function */
     } else {
@@ -2918,6 +2926,11 @@ char *qemudGenerateXML(virConnectPtr con
                               def->vncListen) < 0)
             goto no_memory;
 
+        if (def->keymap &&
+            virBufferVSprintf(buf, " keymap='%s'",
+                              def->keymap) < 0)
+            goto no_memory;
+
         if (virBufferAdd(buf, "/>\n", -1) < 0)
             goto no_memory;
         break;
Index: src/qemu_conf.h
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_conf.h,v
retrieving revision 1.15
diff -u -p -r1.15 qemu_conf.h
--- src/qemu_conf.h	14 Jan 2008 14:05:25 -0000	1.15
+++ src/qemu_conf.h	14 Jan 2008 17:55:33 -0000
@@ -206,6 +206,7 @@ struct qemud_vm_def {
     int vncPort;
     int vncActivePort;
     char vncListen[BR_INET_ADDR_MAXLEN];
+    char *keymap;
 
     int ndisks;
     struct qemud_vm_disk_def *disks;
--
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]