All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] Qemu support for multiple keyboard devices
@ 2010-03-19 10:57 Shahar Havivi
  2010-03-19 10:57 ` [Qemu-devel] [PATCH 1/2] Support " Shahar Havivi
  2010-03-19 10:58 ` [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord' Shahar Havivi
  0 siblings, 2 replies; 14+ messages in thread
From: Shahar Havivi @ 2010-03-19 10:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dor Laor

Qemu support for multiple keyboard devices:

Patch #1 adding keyboard is done to list instead of "last added keyboard 
         wins", when removing keyboard via device_del - next keyboard
         selected.

Patch #2 adding 2 new monitor command to handle keyboard list: 
         'info keyboard' - show all keyboards and mark the current one
         'keyboard_set'  - set active keyboard by index as display in
                           'info keyboard' 
         

Shahar Havivi (2):
  Support for multiple keyboard devices
  Added monitor commands: 'keyboard_set' and 'info keybaord'

 console.h            |   16 +++++-
 hw/adb.c             |    2 +-
 hw/escc.c            |    3 +-
 hw/musicpal.c        |    2 +-
 hw/nseries.c         |    4 +-
 hw/palm.c            |    2 +-
 hw/ps2.c             |    2 +-
 hw/pxa2xx_keypad.c   |    2 +-
 hw/spitz.c           |    2 +-
 hw/stellaris_input.c |    2 +-
 hw/syborg_keyboard.c |    2 +-
 hw/usb-hid.c         |   10 ++-
 hw/xenfb.c           |    4 +-
 input.c              |  157 +++++++++++++++++++++++++++++++++++++++++++++++--
 monitor.c            |    8 +++
 qemu-monitor.hx      |   17 ++++++
 16 files changed, 211 insertions(+), 24 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 1/2] Support for multiple keyboard devices
  2010-03-19 10:57 [Qemu-devel] [PATCH 0/2] Qemu support for multiple keyboard devices Shahar Havivi
@ 2010-03-19 10:57 ` Shahar Havivi
  2010-03-19 10:58 ` [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord' Shahar Havivi
  1 sibling, 0 replies; 14+ messages in thread
From: Shahar Havivi @ 2010-03-19 10:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dor Laor

Currently you get segfault when trying to remove keyboard because no
keyboard handling is done.
This patch add keyboard list similar to the mouse device handlers.
Adding a keyboard add to the list, removing keyboard select the next
keyboard in list, and not leaving the keyboard handlers un-handled.

Signed-off-by: Shahar Havivi <shaharh@redhat.com>
---
 console.h            |   16 +++++++++-
 hw/adb.c             |    2 +-
 hw/escc.c            |    3 +-
 hw/musicpal.c        |    2 +-
 hw/nseries.c         |    4 +-
 hw/palm.c            |    2 +-
 hw/ps2.c             |    2 +-
 hw/pxa2xx_keypad.c   |    2 +-
 hw/spitz.c           |    2 +-
 hw/stellaris_input.c |    2 +-
 hw/syborg_keyboard.c |    2 +-
 hw/usb-hid.c         |   10 ++++--
 hw/xenfb.c           |    4 +-
 input.c              |   84 +++++++++++++++++++++++++++++++++++++++++++++----
 14 files changed, 113 insertions(+), 24 deletions(-)

diff --git a/console.h b/console.h
index 71e8ff2..56d0bbc 100644
--- a/console.h
+++ b/console.h
@@ -38,7 +38,17 @@ typedef struct QEMUPutLEDEntry {
     QTAILQ_ENTRY(QEMUPutLEDEntry) next;
 } QEMUPutLEDEntry;
 
-void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque);
+typedef struct QEMUPutKbdEntry {
+    char *qemu_put_kbd_name;
+    QEMUPutKBDEvent *qemu_put_kbd_event;
+    void *qemu_put_kbd_event_opaque;
+    struct QEMUPutKbdEntry *next;
+} QEMUPutKbdEntry;
+
+QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, 
+                                            void *opaque,
+                                            const char *name);
+void qemu_remove_kbd_event_handler(QEMUPutKbdEntry *entry);
 QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func,
                                                 void *opaque, int absolute,
                                                 const char *name);
@@ -63,6 +73,10 @@ void do_info_mice_print(Monitor *mon, const QObject *data);
 void do_info_mice(Monitor *mon, QObject **ret_data);
 void do_mouse_set(Monitor *mon, const QDict *qdict);
 
+void do_info_keyboard_print(Monitor *mon, const QObject *data);
+void do_info_keyboard(Monitor *mon, QObject **ret_data);
+void do_keyboard_set(Monitor *mon, const QDict *qdict);
+
 /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
    constants) */
 #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
diff --git a/hw/adb.c b/hw/adb.c
index 4fb7a62..09afcf9 100644
--- a/hw/adb.c
+++ b/hw/adb.c
@@ -304,7 +304,7 @@ void adb_kbd_init(ADBBusState *bus)
     s = qemu_mallocz(sizeof(KBDState));
     d = adb_register_device(bus, ADB_KEYBOARD, adb_kbd_request,
                             adb_kbd_reset, s);
-    qemu_add_kbd_event_handler(adb_kbd_put_keycode, d);
+    qemu_add_kbd_event_handler(adb_kbd_put_keycode, d, "adb");
     register_savevm("adb_kbd", -1, 1, adb_kbd_save,
                     adb_kbd_load, s);
 }
diff --git a/hw/escc.c b/hw/escc.c
index 6d2fd36..2b21d98 100644
--- a/hw/escc.c
+++ b/hw/escc.c
@@ -919,7 +919,8 @@ static int escc_init1(SysBusDevice *dev)
                                      "QEMU Sun Mouse");
     }
     if (s->chn[1].type == kbd) {
-        qemu_add_kbd_event_handler(sunkbd_event, &s->chn[1]);
+        qemu_add_kbd_event_handler(sunkbd_event, &s->chn[1],
+                                   "QEMU Sun Keyboard");
     }
 
     return 0;
diff --git a/hw/musicpal.c b/hw/musicpal.c
index b8af15e..166d1b0 100644
--- a/hw/musicpal.c
+++ b/hw/musicpal.c
@@ -1447,7 +1447,7 @@ static int musicpal_key_init(SysBusDevice *dev)
 
     qdev_init_gpio_out(&dev->qdev, s->out, ARRAY_SIZE(s->out));
 
-    qemu_add_kbd_event_handler(musicpal_key_event, s);
+    qemu_add_kbd_event_handler(musicpal_key_event, s, "Musicpal");
 
     return 0;
 }
diff --git a/hw/nseries.c b/hw/nseries.c
index 0273eee..abfcec3 100644
--- a/hw/nseries.c
+++ b/hw/nseries.c
@@ -262,7 +262,7 @@ static void n800_tsc_kbd_setup(struct n800_s *s)
         if (n800_keys[i] >= 0)
             s->keymap[n800_keys[i]] = i;
 
-    qemu_add_kbd_event_handler(n800_key_event, s);
+    qemu_add_kbd_event_handler(n800_key_event, s, "Nokia n800");
 
     tsc210x_set_transform(s->ts.chip, &n800_pointercal);
 }
@@ -371,7 +371,7 @@ static void n810_kbd_setup(struct n800_s *s)
         if (n810_keys[i] > 0)
             s->keymap[n810_keys[i]] = i;
 
-    qemu_add_kbd_event_handler(n810_key_event, s);
+    qemu_add_kbd_event_handler(n810_key_event, s, "Nokia n810");
 
     /* Attach the LM8322 keyboard to the I2C bus,
      * should happen in n8x0_i2c_setup and s->kbd be initialised here.  */
diff --git a/hw/palm.c b/hw/palm.c
index 6d19167..1b405d4 100644
--- a/hw/palm.c
+++ b/hw/palm.c
@@ -228,7 +228,7 @@ static void palmte_init(ram_addr_t ram_size,
 
     palmte_microwire_setup(cpu);
 
-    qemu_add_kbd_event_handler(palmte_button_event, cpu);
+    qemu_add_kbd_event_handler(palmte_button_event, cpu, "Palm Keyboard");
 
     palmte_gpio_setup(cpu);
 
diff --git a/hw/ps2.c b/hw/ps2.c
index f0b206a..886da37 100644
--- a/hw/ps2.c
+++ b/hw/ps2.c
@@ -596,7 +596,7 @@ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg)
     s->common.update_arg = update_arg;
     s->scancode_set = 2;
     vmstate_register(0, &vmstate_ps2_keyboard, s);
-    qemu_add_kbd_event_handler(ps2_put_keycode, s);
+    qemu_add_kbd_event_handler(ps2_put_keycode, s, "QEMU PS/2 Keyboard");
     qemu_register_reset(ps2_kbd_reset, s);
     return s;
 }
diff --git a/hw/pxa2xx_keypad.c b/hw/pxa2xx_keypad.c
index 060df58..7fa5af9 100644
--- a/hw/pxa2xx_keypad.c
+++ b/hw/pxa2xx_keypad.c
@@ -332,5 +332,5 @@ void pxa27x_register_keypad(PXA2xxKeyPadState *kp, struct keymap *map,
     }
 
     kp->map = map;
-    qemu_add_kbd_event_handler((QEMUPutKBDEvent *) pxa27x_keyboard_event, kp);
+    qemu_add_kbd_event_handler((QEMUPutKBDEvent *) pxa27x_keyboard_event, kp, "PXA keypad");
 }
diff --git a/hw/spitz.c b/hw/spitz.c
index 564519b..64e8a6e 100644
--- a/hw/spitz.c
+++ b/hw/spitz.c
@@ -506,7 +506,7 @@ static void spitz_keyboard_register(PXA2xxState *cpu)
         pxa2xx_gpio_out_set(cpu->gpio, spitz_gpio_key_strobe[i], s->strobe[i]);
 
     spitz_keyboard_pre_map(s);
-    qemu_add_kbd_event_handler((QEMUPutKBDEvent *) spitz_keyboard_handler, s);
+    qemu_add_kbd_event_handler((QEMUPutKBDEvent *) spitz_keyboard_handler, s, "Spitz keyboard");
 
     register_savevm("spitz_keyboard", 0, 0,
                     spitz_keyboard_save, spitz_keyboard_load, s);
diff --git a/hw/stellaris_input.c b/hw/stellaris_input.c
index 33395a4..775cb46 100644
--- a/hw/stellaris_input.c
+++ b/hw/stellaris_input.c
@@ -85,7 +85,7 @@ void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode)
         s->buttons[i].keycode = keycode[i];
     }
     s->num_buttons = n;
-    qemu_add_kbd_event_handler(stellaris_gamepad_put_key, s);
+    qemu_add_kbd_event_handler(stellaris_gamepad_put_key, s, "Stellaris Gamepad");
     register_savevm("stellaris_gamepad", -1, 1,
                     stellaris_gamepad_save, stellaris_gamepad_load, s);
 }
diff --git a/hw/syborg_keyboard.c b/hw/syborg_keyboard.c
index 4a562f8..d1651b4 100644
--- a/hw/syborg_keyboard.c
+++ b/hw/syborg_keyboard.c
@@ -218,7 +218,7 @@ static int syborg_keyboard_init(SysBusDevice *dev)
     }
     s->key_fifo = qemu_mallocz(s->fifo_size * sizeof(s->key_fifo[0]));
 
-    qemu_add_kbd_event_handler(syborg_keyboard_event, s);
+    qemu_add_kbd_event_handler(syborg_keyboard_event, s, "Syborg Keyboard");
 
     register_savevm("syborg_keyboard", -1, 1,
                     syborg_keyboard_save, syborg_keyboard_load, s);
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 2e4e647..078a536 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -55,6 +55,7 @@ typedef struct USBKeyboardState {
     uint8_t leds;
     uint8_t key[16];
     int keys;
+    QEMUPutKbdEntry *eh_entry;
 } USBKeyboardState;
 
 typedef struct USBHIDState {
@@ -635,7 +636,8 @@ static void usb_keyboard_handle_reset(USBDevice *dev)
 {
     USBHIDState *s = (USBHIDState *)dev;
 
-    qemu_add_kbd_event_handler(usb_keyboard_event, s);
+    s->kbd.eh_entry = qemu_add_kbd_event_handler(usb_keyboard_event, s,
+                                                 dev->product_desc);
     s->protocol = 1;
 }
 
@@ -856,9 +858,11 @@ static void usb_hid_handle_destroy(USBDevice *dev)
 {
     USBHIDState *s = (USBHIDState *)dev;
 
-    if (s->kind != USB_KEYBOARD)
+    if (s->kind != USB_KEYBOARD) {
         qemu_remove_mouse_event_handler(s->ptr.eh_entry);
-    /* TODO: else */
+    } else {
+        qemu_remove_kbd_event_handler(s->kbd.eh_entry);
+    }
 }
 
 static int usb_hid_initfn(USBDevice *dev, int kind)
diff --git a/hw/xenfb.c b/hw/xenfb.c
index 422cd53..2c700bd 100644
--- a/hw/xenfb.c
+++ b/hw/xenfb.c
@@ -373,7 +373,7 @@ static int input_connect(struct XenDevice *xendev)
     if (rc != 0)
 	return rc;
 
-    qemu_add_kbd_event_handler(xenfb_key_event, in);
+    qemu_add_kbd_event_handler(xenfb_key_event, in, "Xen Keyboard");
     in->qmouse = qemu_add_mouse_event_handler(xenfb_mouse_event, in,
 					      in->abs_pointer_wanted,
 					      "Xen PVFB Mouse");
@@ -388,7 +388,7 @@ static void input_disconnect(struct XenDevice *xendev)
 	qemu_remove_mouse_event_handler(in->qmouse);
 	in->qmouse = NULL;
     }
-    qemu_add_kbd_event_handler(NULL, NULL);
+    qemu_add_kbd_event_handler(NULL, NULL, NULL);
     common_unbind(&in->c);
 }
 
diff --git a/input.c b/input.c
index baaa4c6..4b86f48 100644
--- a/input.c
+++ b/input.c
@@ -29,16 +29,85 @@
 #include "qjson.h"
 
 
-static QEMUPutKBDEvent *qemu_put_kbd_event;
-static void *qemu_put_kbd_event_opaque;
+static QEMUPutKbdEntry *qemu_put_kbd_event_head;
+static QEMUPutKbdEntry *qemu_put_kbd_event_current;
 static QEMUPutMouseEntry *qemu_put_mouse_event_head;
 static QEMUPutMouseEntry *qemu_put_mouse_event_current;
 static QTAILQ_HEAD(, QEMUPutLEDEntry) led_handlers = QTAILQ_HEAD_INITIALIZER(led_handlers);
 
-void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque)
+QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, 
+                                            void *opaque,
+                                            const char *name)
 {
-    qemu_put_kbd_event_opaque = opaque;
-    qemu_put_kbd_event = func;
+    QEMUPutKbdEntry *s, *cursor;
+
+    cursor = qemu_put_kbd_event_head;
+    while (cursor) {
+        if (cursor->qemu_put_kbd_event == func &&
+            cursor->qemu_put_kbd_event_opaque == opaque) {
+
+            qemu_put_kbd_event_current = cursor;
+            return cursor;
+        }
+        cursor = cursor->next;
+    }
+
+    s = qemu_mallocz(sizeof(QEMUPutKbdEntry));
+
+    s->qemu_put_kbd_event_opaque = opaque;
+    s->qemu_put_kbd_event = func;
+    s->qemu_put_kbd_name = qemu_strdup(name);
+    s->next = NULL;
+
+    if (!qemu_put_kbd_event_head) {
+        qemu_put_kbd_event_head = s;
+        qemu_put_kbd_event_current = s;
+        return s;
+    }
+
+    cursor = qemu_put_kbd_event_head;
+    while (cursor->next) {
+        cursor = cursor->next;
+    }
+
+    cursor->next = s;
+    qemu_put_kbd_event_current = s;
+
+    return s;
+}
+
+void qemu_remove_kbd_event_handler(QEMUPutKbdEntry *entry)
+{
+    QEMUPutKbdEntry *prev = NULL, *cursor;
+
+    if (!qemu_put_kbd_event_head || !entry) {
+        return;
+    }
+
+    cursor = qemu_put_kbd_event_head;
+    while (cursor && cursor != entry) {
+        prev = cursor;
+        cursor = cursor->next;
+    }
+
+    if (cursor == NULL) {
+        return;
+    } else if (prev == NULL) {
+        qemu_put_kbd_event_head = cursor->next;
+        if (qemu_put_kbd_event_current == entry) {
+            qemu_put_kbd_event_current = cursor->next;
+        }
+        qemu_free(entry);
+        return;
+    }
+
+    prev->next = entry->next;
+
+    if (qemu_put_kbd_event_current == entry) {
+        qemu_put_kbd_event_current = prev;
+    }
+
+    qemu_free(entry);
 }
 
 QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func,
@@ -126,8 +195,9 @@ void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry)
 
 void kbd_put_keycode(int keycode)
 {
-    if (qemu_put_kbd_event) {
-        qemu_put_kbd_event(qemu_put_kbd_event_opaque, keycode);
+    if (qemu_put_kbd_event_current) {
+        qemu_put_kbd_event_current->qemu_put_kbd_event(
+            qemu_put_kbd_event_current->qemu_put_kbd_event_opaque, keycode);
     }
 }
 
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
  2010-03-19 10:57 [Qemu-devel] [PATCH 0/2] Qemu support for multiple keyboard devices Shahar Havivi
  2010-03-19 10:57 ` [Qemu-devel] [PATCH 1/2] Support " Shahar Havivi
@ 2010-03-19 10:58 ` Shahar Havivi
  2010-03-19 20:22   ` Luiz Capitulino
  1 sibling, 1 reply; 14+ messages in thread
From: Shahar Havivi @ 2010-03-19 10:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dor Laor

This new monitor command adding ability to handle which keyboard qemu will use
and to see which keyboard are currently available.


Signed-off-by: Shahar Havivi <shaharh@redhat.com>
---
 input.c         |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 monitor.c       |    8 ++++++
 qemu-monitor.hx |   17 +++++++++++++
 3 files changed, 98 insertions(+), 0 deletions(-)

diff --git a/input.c b/input.c
index 4b86f48..c883b5b 100644
--- a/input.c
+++ b/input.c
@@ -337,3 +337,76 @@ void do_mouse_set(Monitor *mon, const QDict *qdict)
     else
         monitor_printf(mon, "Mouse at given index not found\n");
 }
+
+static void info_keyboard_iter(QObject *data, void *opaque)
+{
+    QDict *kbd;
+    Monitor *mon = opaque;
+
+    kbd = qobject_to_qdict(data);
+    monitor_printf(mon, "%c Keyboard #%" PRId64 ": %s\n",
+                  (qdict_get_bool(kbd, "current") ? '*' : ' '),
+                  qdict_get_int(kbd, "index"), qdict_get_str(kbd, "name"));
+}
+
+void do_info_keyboard_print(Monitor *mon, const QObject *data)
+{
+    QList *kbd_list;
+
+    kbd_list = qobject_to_qlist(data);
+    if (qlist_empty(kbd_list)) {
+        monitor_printf(mon, "No keyboard devices connected\n");
+        return;
+    }
+
+    qlist_iter(kbd_list, info_keyboard_iter, mon);
+}
+
+void do_info_keyboard(Monitor *mon, QObject **ret_data)
+{
+    QEMUPutKbdEntry *cursor;
+    QList *kbd_list;
+    int index = 0;
+
+    kbd_list = qlist_new();
+
+    if (!qemu_put_kbd_event_head) {
+        goto out;
+    }
+
+    cursor = qemu_put_kbd_event_head;
+    while (cursor != NULL) {
+        QObject *obj;
+        obj = qobject_from_jsonf("{ 'name': %s, 'index': %d, 'current': %i }",
+                                 cursor->qemu_put_kbd_name,
+                                 index, cursor == qemu_put_kbd_event_current);
+        qlist_append_obj(kbd_list, obj);
+        index++;
+        cursor = cursor->next;
+    }
+out:
+    *ret_data = QOBJECT(kbd_list);
+}
+
+void do_keyboard_set(Monitor *mon, const QDict *qdict)
+{
+    QEMUPutKbdEntry *cursor;
+    int i = 0;
+    int index = qdict_get_int(qdict, "index");
+
+    if (!qemu_put_kbd_event_head) {
+        monitor_printf(mon, "No keyboard devices connected\n");
+        return;
+    }
+
+    cursor = qemu_put_kbd_event_head;
+    while (cursor != NULL && index != i) {
+        i++;
+        cursor = cursor->next;
+    }
+
+    if (cursor != NULL)
+        qemu_put_kbd_event_current = cursor;
+    else
+        monitor_printf(mon, "Keyboard at given index not found\n");
+}
diff --git a/monitor.c b/monitor.c
index 0448a70..cc95b3d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2783,6 +2783,14 @@ static const mon_cmd_t info_cmds[] = {
         .mhandler.info_new = do_info_mice,
     },
     {
+        .name       = "keyboard",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show which guest keyboard is receiving events",
+        .user_print = do_info_keyboard_print,
+        .mhandler.info_new = do_info_keyboard,
+    },
+    {
         .name       = "vnc",
         .args_type  = "",
         .params     = "",
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 5308f36..d86be17 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -659,6 +659,23 @@ info mice
 @end example
 ETEXI
 
+    {
+        .name       = "keyboard_set",
+        .args_type  = "index:i",
+        .params     = "index",
+        .help       = "set which keyboard device receives events",
+        .mhandler.cmd = do_keyboard_set,
+    },
+
+STEXI
+@item keyboard_set @var{index}
+@findex keyboard_set
+Set which keyboard device receives events at given @var{index}, index
+can be obtained with
+@example
+info keyboard
+@end example
+ETEXI
 #ifdef HAS_AUDIO
     {
         .name       = "wavcapture",
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
  2010-03-19 10:58 ` [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord' Shahar Havivi
@ 2010-03-19 20:22   ` Luiz Capitulino
  2010-03-19 21:03     ` Shahar Havivi
  2010-03-19 22:29     ` Shahar Havivi
  0 siblings, 2 replies; 14+ messages in thread
From: Luiz Capitulino @ 2010-03-19 20:22 UTC (permalink / raw)
  To: Shahar Havivi; +Cc: Dor Laor, qemu-devel

On Fri, 19 Mar 2010 12:58:43 +0200
Shahar Havivi <shaharh@redhat.com> wrote:

> This new monitor command adding ability to handle which keyboard qemu will use
> and to see which keyboard are currently available.
> 
> 
> Signed-off-by: Shahar Havivi <shaharh@redhat.com>
> ---
>  input.c         |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  monitor.c       |    8 ++++++
>  qemu-monitor.hx |   17 +++++++++++++
>  3 files changed, 98 insertions(+), 0 deletions(-)
> 
> diff --git a/input.c b/input.c
> index 4b86f48..c883b5b 100644
> --- a/input.c
> +++ b/input.c
> @@ -337,3 +337,76 @@ void do_mouse_set(Monitor *mon, const QDict *qdict)
>      else
>          monitor_printf(mon, "Mouse at given index not found\n");
>  }
> +
> +static void info_keyboard_iter(QObject *data, void *opaque)
> +{
> +    QDict *kbd;
> +    Monitor *mon = opaque;
> +
> +    kbd = qobject_to_qdict(data);
> +    monitor_printf(mon, "%c Keyboard #%" PRId64 ": %s\n",
> +                  (qdict_get_bool(kbd, "current") ? '*' : ' '),
> +                  qdict_get_int(kbd, "index"), qdict_get_str(kbd, "name"));
> +}
> +
> +void do_info_keyboard_print(Monitor *mon, const QObject *data)
> +{
> +    QList *kbd_list;
> +
> +    kbd_list = qobject_to_qlist(data);
> +    if (qlist_empty(kbd_list)) {
> +        monitor_printf(mon, "No keyboard devices connected\n");
> +        return;
> +    }
> +
> +    qlist_iter(kbd_list, info_keyboard_iter, mon);
> +}
> +
> +void do_info_keyboard(Monitor *mon, QObject **ret_data)
> +{

 Please, document the data you return, you can look at do_info_mice()
for an example.

> +    QEMUPutKbdEntry *cursor;
> +    QList *kbd_list;
> +    int index = 0;
> +
> +    kbd_list = qlist_new();
> +
> +    if (!qemu_put_kbd_event_head) {
> +        goto out;
> +    }
> +
> +    cursor = qemu_put_kbd_event_head;
> +    while (cursor != NULL) {
> +        QObject *obj;
> +        obj = qobject_from_jsonf("{ 'name': %s, 'index': %d, 'current': %i }",
> +                                 cursor->qemu_put_kbd_name,
> +                                 index, cursor == qemu_put_kbd_event_current);
> +        qlist_append_obj(kbd_list, obj);
> +        index++;
> +        cursor = cursor->next;
> +    }
> +out:
> +    *ret_data = QOBJECT(kbd_list);
> +}
> +
> +void do_keyboard_set(Monitor *mon, const QDict *qdict)
> +{
> +    QEMUPutKbdEntry *cursor;
> +    int i = 0;
> +    int index = qdict_get_int(qdict, "index");
> +
> +    if (!qemu_put_kbd_event_head) {
> +        monitor_printf(mon, "No keyboard devices connected\n");
> +        return;
> +    }
> +
> +    cursor = qemu_put_kbd_event_head;
> +    while (cursor != NULL && index != i) {
> +        i++;
> +        cursor = cursor->next;
> +    }
> +
> +    if (cursor != NULL)
> +        qemu_put_kbd_event_current = cursor;
> +    else
> +        monitor_printf(mon, "Keyboard at given index not found\n");
> +}
> diff --git a/monitor.c b/monitor.c
> index 0448a70..cc95b3d 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2783,6 +2783,14 @@ static const mon_cmd_t info_cmds[] = {
>          .mhandler.info_new = do_info_mice,
>      },
>      {
> +        .name       = "keyboard",
> +        .args_type  = "",
> +        .params     = "",
> +        .help       = "show which guest keyboard is receiving events",
> +        .user_print = do_info_keyboard_print,
> +        .mhandler.info_new = do_info_keyboard,
> +    },
> +    {
>          .name       = "vnc",
>          .args_type  = "",
>          .params     = "",
> diff --git a/qemu-monitor.hx b/qemu-monitor.hx
> index 5308f36..d86be17 100644
> --- a/qemu-monitor.hx
> +++ b/qemu-monitor.hx
> @@ -659,6 +659,23 @@ info mice
>  @end example
>  ETEXI
>  
> +    {
> +        .name       = "keyboard_set",
> +        .args_type  = "index:i",
> +        .params     = "index",
> +        .help       = "set which keyboard device receives events",
> +        .mhandler.cmd = do_keyboard_set,
> +    },

 keyboard_set is not available under QMP, do you have an special
reason to do so or you have just done like the do_mouse_set()?

 In any case, you should use mhandler.cmd_new as mhandler.cmd is
going to be deprecated (which also means you should use
qerror_report() to report errors).

> +
> +STEXI
> +@item keyboard_set @var{index}
> +@findex keyboard_set
> +Set which keyboard device receives events at given @var{index}, index
> +can be obtained with
> +@example
> +info keyboard
> +@end example
> +ETEXI
>  #ifdef HAS_AUDIO
>      {
>          .name       = "wavcapture",

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
  2010-03-19 20:22   ` Luiz Capitulino
@ 2010-03-19 21:03     ` Shahar Havivi
  2010-03-19 22:29     ` Shahar Havivi
  1 sibling, 0 replies; 14+ messages in thread
From: Shahar Havivi @ 2010-03-19 21:03 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: Dor Laor, qemu-devel

On Fri, Mar 19, 2010 at 05:22:05PM -0300, Luiz Capitulino wrote:
> Date: Fri, 19 Mar 2010 17:22:05 -0300
> From: Luiz Capitulino <lcapitulino@redhat.com>
> To: Shahar Havivi <shaharh@redhat.com>
> Cc: Dor Laor <dlaor@redhat.com>, qemu-devel@nongnu.org
> Subject: Re: [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set'
> 	and 'info keybaord'
> 
> On Fri, 19 Mar 2010 12:58:43 +0200
> Shahar Havivi <shaharh@redhat.com> wrote:
> 
> > This new monitor command adding ability to handle which keyboard qemu will use
> > and to see which keyboard are currently available.
> > 
> > 
> > Signed-off-by: Shahar Havivi <shaharh@redhat.com>
> > ---
> >  input.c         |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  monitor.c       |    8 ++++++
> >  qemu-monitor.hx |   17 +++++++++++++
> >  3 files changed, 98 insertions(+), 0 deletions(-)
> > 
> > diff --git a/input.c b/input.c
> > index 4b86f48..c883b5b 100644
> > --- a/input.c
> > +++ b/input.c
> > @@ -337,3 +337,76 @@ void do_mouse_set(Monitor *mon, const QDict *qdict)
> >      else
> >          monitor_printf(mon, "Mouse at given index not found\n");
> >  }
> > +
> > +static void info_keyboard_iter(QObject *data, void *opaque)
> > +{
> > +    QDict *kbd;
> > +    Monitor *mon = opaque;
> > +
> > +    kbd = qobject_to_qdict(data);
> > +    monitor_printf(mon, "%c Keyboard #%" PRId64 ": %s\n",
> > +                  (qdict_get_bool(kbd, "current") ? '*' : ' '),
> > +                  qdict_get_int(kbd, "index"), qdict_get_str(kbd, "name"));
> > +}
> > +
> > +void do_info_keyboard_print(Monitor *mon, const QObject *data)
> > +{
> > +    QList *kbd_list;
> > +
> > +    kbd_list = qobject_to_qlist(data);
> > +    if (qlist_empty(kbd_list)) {
> > +        monitor_printf(mon, "No keyboard devices connected\n");
> > +        return;
> > +    }
> > +
> > +    qlist_iter(kbd_list, info_keyboard_iter, mon);
> > +}
> > +
> > +void do_info_keyboard(Monitor *mon, QObject **ret_data)
> > +{
> 
>  Please, document the data you return, you can look at do_info_mice()
> for an example.
> 
> > +    QEMUPutKbdEntry *cursor;
> > +    QList *kbd_list;
> > +    int index = 0;
> > +
> > +    kbd_list = qlist_new();
> > +
> > +    if (!qemu_put_kbd_event_head) {
> > +        goto out;
> > +    }
> > +
> > +    cursor = qemu_put_kbd_event_head;
> > +    while (cursor != NULL) {
> > +        QObject *obj;
> > +        obj = qobject_from_jsonf("{ 'name': %s, 'index': %d, 'current': %i }",
> > +                                 cursor->qemu_put_kbd_name,
> > +                                 index, cursor == qemu_put_kbd_event_current);
> > +        qlist_append_obj(kbd_list, obj);
> > +        index++;
> > +        cursor = cursor->next;
> > +    }
> > +out:
> > +    *ret_data = QOBJECT(kbd_list);
> > +}
> > +
> > +void do_keyboard_set(Monitor *mon, const QDict *qdict)
> > +{
> > +    QEMUPutKbdEntry *cursor;
> > +    int i = 0;
> > +    int index = qdict_get_int(qdict, "index");
> > +
> > +    if (!qemu_put_kbd_event_head) {
> > +        monitor_printf(mon, "No keyboard devices connected\n");
> > +        return;
> > +    }
> > +
> > +    cursor = qemu_put_kbd_event_head;
> > +    while (cursor != NULL && index != i) {
> > +        i++;
> > +        cursor = cursor->next;
> > +    }
> > +
> > +    if (cursor != NULL)
> > +        qemu_put_kbd_event_current = cursor;
> > +    else
> > +        monitor_printf(mon, "Keyboard at given index not found\n");
> > +}
> > diff --git a/monitor.c b/monitor.c
> > index 0448a70..cc95b3d 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -2783,6 +2783,14 @@ static const mon_cmd_t info_cmds[] = {
> >          .mhandler.info_new = do_info_mice,
> >      },
> >      {
> > +        .name       = "keyboard",
> > +        .args_type  = "",
> > +        .params     = "",
> > +        .help       = "show which guest keyboard is receiving events",
> > +        .user_print = do_info_keyboard_print,
> > +        .mhandler.info_new = do_info_keyboard,
> > +    },
> > +    {
> >          .name       = "vnc",
> >          .args_type  = "",
> >          .params     = "",
> > diff --git a/qemu-monitor.hx b/qemu-monitor.hx
> > index 5308f36..d86be17 100644
> > --- a/qemu-monitor.hx
> > +++ b/qemu-monitor.hx
> > @@ -659,6 +659,23 @@ info mice
> >  @end example
> >  ETEXI
> >  
> > +    {
> > +        .name       = "keyboard_set",
> > +        .args_type  = "index:i",
> > +        .params     = "index",
> > +        .help       = "set which keyboard device receives events",
> > +        .mhandler.cmd = do_keyboard_set,
> > +    },
> 
>  keyboard_set is not available under QMP, do you have an special
> reason to do so or you have just done like the do_mouse_set()?
I use it just like the mouse.
> 
>  In any case, you should use mhandler.cmd_new as mhandler.cmd is
> going to be deprecated (which also means you should use
> qerror_report() to report errors).
Thanks for the comment I will change it.
Shahar.
> 
> > +
> > +STEXI
> > +@item keyboard_set @var{index}
> > +@findex keyboard_set
> > +Set which keyboard device receives events at given @var{index}, index
> > +can be obtained with
> > +@example
> > +info keyboard
> > +@end example
> > +ETEXI
> >  #ifdef HAS_AUDIO
> >      {
> >          .name       = "wavcapture",
> 
> 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
  2010-03-19 20:22   ` Luiz Capitulino
  2010-03-19 21:03     ` Shahar Havivi
@ 2010-03-19 22:29     ` Shahar Havivi
  2010-03-22  0:27       ` Luiz Capitulino
  1 sibling, 1 reply; 14+ messages in thread
From: Shahar Havivi @ 2010-03-19 22:29 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: Dor Laor, qemu-devel

Fix to Luiz comments.

Signed-off-by: Shahar Havivi <shaharh@redhat.com>
---
 console.h       |    4 ++
 input.c         |  104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 monitor.c       |    8 ++++
 qemu-monitor.hx |   17 +++++++++
 qerror.c        |    8 ++++
 qerror.h        |    6 +++
 6 files changed, 147 insertions(+), 0 deletions(-)

diff --git a/console.h b/console.h
index c81cd9d..27d36b4 100644
--- a/console.h
+++ b/console.h
@@ -73,6 +73,10 @@ void do_info_mice_print(Monitor *mon, const QObject *data);
 void do_info_mice(Monitor *mon, QObject **ret_data);
 void do_mouse_set(Monitor *mon, const QDict *qdict);
 
+void do_info_keyboard_print(Monitor *mon, const QObject *data);
+void do_info_keyboard(Monitor *mon, QObject **ret_data);
+int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data);
+
 /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
    constants) */
 #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
diff --git a/input.c b/input.c
index f75d480..1ce0754 100644
--- a/input.c
+++ b/input.c
@@ -337,3 +337,107 @@ void do_mouse_set(Monitor *mon, const QDict *qdict)
     else
         monitor_printf(mon, "Mouse at given index not found\n");
 }
+
+static void info_keyboard_iter(QObject *data, void *opaque)
+{
+    QDict *kbd;
+    Monitor *mon = opaque;
+
+    kbd = qobject_to_qdict(data);
+    monitor_printf(mon, "%c Keyboard #%" PRId64 ": %s\n",
+                  (qdict_get_bool(kbd, "current") ? '*' : ' '),
+                  qdict_get_int(kbd, "index"), qdict_get_str(kbd, "name"));
+}
+
+void do_info_keyboard_print(Monitor *mon, const QObject *data)
+{
+    QList *kbd_list;
+
+    kbd_list = qobject_to_qlist(data);
+    if (qlist_empty(kbd_list)) {
+        monitor_printf(mon, "No keyboard devices connected\n");
+        return;
+    }
+
+    qlist_iter(kbd_list, info_keyboard_iter, mon);
+}
+
+/*
+ * do_info_keyboard(): Show VM keyboard information
+ *
+ * Each keyboard is represented by a QDict, the returned QObject is
+ * a QList of all keyboards.
+ *
+ * The keyboard QDict contains the following:
+ *
+ * - "name": keyboard's name
+ * - "index": keyboard's index
+ * - "current": true if this keyboard is receiving events, false otherwise
+ *
+ * Example:
+ *
+ * [ { "name": "QEMU USB Keyboard", "index": 0, "current": false },
+ *   { "name": "QEMU PS/2 Keyboard", "index": 1, "current": true } ]
+ */
+void do_info_keyboard(Monitor *mon, QObject **ret_data)
+{
+    QEMUPutKbdEntry *cursor;
+    QList *kbd_list;
+    int index = 0;
+
+    kbd_list = qlist_new();
+
+    if (!qemu_put_kbd_event_head) {
+        goto out;
+    }
+
+    cursor = qemu_put_kbd_event_head;
+    while (cursor != NULL) {
+        QObject *obj;
+        obj = qobject_from_jsonf("{ 'name': %s, 'index': %d, 'current': %i }",
+                                 cursor->qemu_put_kbd_name,
+                                 index, cursor == qemu_put_kbd_event_current);
+        qlist_append_obj(kbd_list, obj);
+        index++;
+        cursor = cursor->next;
+    }
+out:
+    *ret_data = QOBJECT(kbd_list);
+}
+
+/*
+ * do_keyboard_set(): Set active keyboard
+ *
+ * Argument qdict contains
+ * - "index": the keyboard index to set
+ *
+ * Example:
+ *
+ * { "index": "0" }
+ */
+int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+    QEMUPutKbdEntry *cursor;
+    int i = 0;
+    int index = qdict_get_int(qdict, "index");
+
+    if (!qemu_put_kbd_event_head) {
+        qerror_report(QERR_KEYBOARD_NOT_FOUND);
+        return -1;
+    }
+
+    cursor = qemu_put_kbd_event_head;
+    while (cursor != NULL && index != i) {
+        i++;
+        cursor = cursor->next;
+    }
+
+    if (cursor != NULL) {
+        qemu_put_kbd_event_current = cursor;
+    }
+    else {
+        qerror_report(QERR_INVALID_KEYBOARD_INDEX, index);
+        return -1;
+    }
+    return 0;
+}
diff --git a/monitor.c b/monitor.c
index 0448a70..cc95b3d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2783,6 +2783,14 @@ static const mon_cmd_t info_cmds[] = {
         .mhandler.info_new = do_info_mice,
     },
     {
+        .name       = "keyboard",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show which guest keyboard is receiving events",
+        .user_print = do_info_keyboard_print,
+        .mhandler.info_new = do_info_keyboard,
+    },
+    {
         .name       = "vnc",
         .args_type  = "",
         .params     = "",
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 5308f36..d86be17 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -659,6 +659,23 @@ info mice
 @end example
 ETEXI
 
+    {
+        .name       = "keyboard_set",
+        .args_type  = "index:i",
+        .params     = "index",
+        .help       = "set which keyboard device receives events",
+        .mhandler.cmd_new = do_keyboard_set,
+    },
+
+STEXI
+@item keyboard_set @var{index}
+@findex keyboard_set
+Set which keyboard device receives events at given @var{index}, index
+can be obtained with
+@example
+info keyboard
+@end example
+ETEXI
 #ifdef HAS_AUDIO
     {
         .name       = "wavcapture",
diff --git a/qerror.c b/qerror.c
index d0aba61..41e7373 100644
--- a/qerror.c
+++ b/qerror.c
@@ -172,6 +172,14 @@ static const QErrorStringTable qerror_table[] = {
         .error_fmt = QERR_VNC_SERVER_FAILED,
         .desc      = "Could not start VNC server on %(target)",
     },
+    {
+        .error_fmt = QERR_KEYBOARD_NOT_FOUND,
+        .desc      = "No keyboard device found",
+    },
+    {
+        .error_fmt = QERR_INVALID_KEYBOARD_INDEX,
+        .desc      = "Invalid index '%(index)' for keyboard device",
+    },
     {}
 };
 
diff --git a/qerror.h b/qerror.h
index d96abe1..4086640 100644
--- a/qerror.h
+++ b/qerror.h
@@ -141,4 +141,10 @@ QError *qobject_to_qerror(const QObject *obj);
 #define QERR_VNC_SERVER_FAILED \
     "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
 
+#define QERR_KEYBOARD_NOT_FOUND \
+    "{ 'class': 'KeyboardNotFound', 'data': {} }"
+
+#define QERR_INVALID_KEYBOARD_INDEX \
+    "{ 'class': 'InvalidKeyboardIndex', 'data': { 'index': %d } }"
+
 #endif /* QERROR_H */
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
  2010-03-19 22:29     ` Shahar Havivi
@ 2010-03-22  0:27       ` Luiz Capitulino
  0 siblings, 0 replies; 14+ messages in thread
From: Luiz Capitulino @ 2010-03-22  0:27 UTC (permalink / raw)
  To: Shahar Havivi; +Cc: Dor Laor, qemu-devel

On Sat, 20 Mar 2010 00:29:25 +0200
Shahar Havivi <shaharh@redhat.com> wrote:

> Fix to Luiz comments.

 Better to resend the whole series with a 'v2' in it, also I think you'll
have to rebase against master because this series conflicts with latest
Anthony's series.

 I have some QError comments below.

> 
> Signed-off-by: Shahar Havivi <shaharh@redhat.com>
> ---
>  console.h       |    4 ++
>  input.c         |  104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  monitor.c       |    8 ++++
>  qemu-monitor.hx |   17 +++++++++
>  qerror.c        |    8 ++++
>  qerror.h        |    6 +++
>  6 files changed, 147 insertions(+), 0 deletions(-)
> 
> diff --git a/console.h b/console.h
> index c81cd9d..27d36b4 100644
> --- a/console.h
> +++ b/console.h
> @@ -73,6 +73,10 @@ void do_info_mice_print(Monitor *mon, const QObject *data);
>  void do_info_mice(Monitor *mon, QObject **ret_data);
>  void do_mouse_set(Monitor *mon, const QDict *qdict);
>  
> +void do_info_keyboard_print(Monitor *mon, const QObject *data);
> +void do_info_keyboard(Monitor *mon, QObject **ret_data);
> +int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data);
> +
>  /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
>     constants) */
>  #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
> diff --git a/input.c b/input.c
> index f75d480..1ce0754 100644
> --- a/input.c
> +++ b/input.c
> @@ -337,3 +337,107 @@ void do_mouse_set(Monitor *mon, const QDict *qdict)
>      else
>          monitor_printf(mon, "Mouse at given index not found\n");
>  }
> +
> +static void info_keyboard_iter(QObject *data, void *opaque)
> +{
> +    QDict *kbd;
> +    Monitor *mon = opaque;
> +
> +    kbd = qobject_to_qdict(data);
> +    monitor_printf(mon, "%c Keyboard #%" PRId64 ": %s\n",
> +                  (qdict_get_bool(kbd, "current") ? '*' : ' '),
> +                  qdict_get_int(kbd, "index"), qdict_get_str(kbd, "name"));
> +}
> +
> +void do_info_keyboard_print(Monitor *mon, const QObject *data)
> +{
> +    QList *kbd_list;
> +
> +    kbd_list = qobject_to_qlist(data);
> +    if (qlist_empty(kbd_list)) {
> +        monitor_printf(mon, "No keyboard devices connected\n");
> +        return;
> +    }
> +
> +    qlist_iter(kbd_list, info_keyboard_iter, mon);
> +}
> +
> +/*
> + * do_info_keyboard(): Show VM keyboard information
> + *
> + * Each keyboard is represented by a QDict, the returned QObject is
> + * a QList of all keyboards.
> + *
> + * The keyboard QDict contains the following:
> + *
> + * - "name": keyboard's name
> + * - "index": keyboard's index
> + * - "current": true if this keyboard is receiving events, false otherwise
> + *
> + * Example:
> + *
> + * [ { "name": "QEMU USB Keyboard", "index": 0, "current": false },
> + *   { "name": "QEMU PS/2 Keyboard", "index": 1, "current": true } ]
> + */
> +void do_info_keyboard(Monitor *mon, QObject **ret_data)
> +{
> +    QEMUPutKbdEntry *cursor;
> +    QList *kbd_list;
> +    int index = 0;
> +
> +    kbd_list = qlist_new();
> +
> +    if (!qemu_put_kbd_event_head) {
> +        goto out;
> +    }
> +
> +    cursor = qemu_put_kbd_event_head;
> +    while (cursor != NULL) {
> +        QObject *obj;
> +        obj = qobject_from_jsonf("{ 'name': %s, 'index': %d, 'current': %i }",
> +                                 cursor->qemu_put_kbd_name,
> +                                 index, cursor == qemu_put_kbd_event_current);
> +        qlist_append_obj(kbd_list, obj);
> +        index++;
> +        cursor = cursor->next;
> +    }
> +out:
> +    *ret_data = QOBJECT(kbd_list);
> +}
> +
> +/*
> + * do_keyboard_set(): Set active keyboard
> + *
> + * Argument qdict contains
> + * - "index": the keyboard index to set
> + *
> + * Example:
> + *
> + * { "index": "0" }
> + */
> +int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
> +{
> +    QEMUPutKbdEntry *cursor;
> +    int i = 0;
> +    int index = qdict_get_int(qdict, "index");
> +
> +    if (!qemu_put_kbd_event_head) {
> +        qerror_report(QERR_KEYBOARD_NOT_FOUND);
> +        return -1;
> +    }

 Couldn't you use QERR_DEVICE_NOT_FOUND?

> +
> +    cursor = qemu_put_kbd_event_head;
> +    while (cursor != NULL && index != i) {
> +        i++;
> +        cursor = cursor->next;
> +    }
> +
> +    if (cursor != NULL) {
> +        qemu_put_kbd_event_current = cursor;
> +    }
> +    else {
> +        qerror_report(QERR_INVALID_KEYBOARD_INDEX, index);
> +        return -1;
> +    }
> +    return 0;

 We're using something like:

qerror_report(QERR_INVALID_PARAMETER, "index");

 For this kind of error.

> +}
> diff --git a/monitor.c b/monitor.c
> index 0448a70..cc95b3d 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2783,6 +2783,14 @@ static const mon_cmd_t info_cmds[] = {
>          .mhandler.info_new = do_info_mice,
>      },
>      {
> +        .name       = "keyboard",
> +        .args_type  = "",
> +        .params     = "",
> +        .help       = "show which guest keyboard is receiving events",
> +        .user_print = do_info_keyboard_print,
> +        .mhandler.info_new = do_info_keyboard,
> +    },
> +    {
>          .name       = "vnc",
>          .args_type  = "",
>          .params     = "",
> diff --git a/qemu-monitor.hx b/qemu-monitor.hx
> index 5308f36..d86be17 100644
> --- a/qemu-monitor.hx
> +++ b/qemu-monitor.hx
> @@ -659,6 +659,23 @@ info mice
>  @end example
>  ETEXI
>  
> +    {
> +        .name       = "keyboard_set",
> +        .args_type  = "index:i",
> +        .params     = "index",
> +        .help       = "set which keyboard device receives events",
> +        .mhandler.cmd_new = do_keyboard_set,
> +    },
> +
> +STEXI
> +@item keyboard_set @var{index}
> +@findex keyboard_set
> +Set which keyboard device receives events at given @var{index}, index
> +can be obtained with
> +@example
> +info keyboard
> +@end example
> +ETEXI
>  #ifdef HAS_AUDIO
>      {
>          .name       = "wavcapture",
> diff --git a/qerror.c b/qerror.c
> index d0aba61..41e7373 100644
> --- a/qerror.c
> +++ b/qerror.c
> @@ -172,6 +172,14 @@ static const QErrorStringTable qerror_table[] = {
>          .error_fmt = QERR_VNC_SERVER_FAILED,
>          .desc      = "Could not start VNC server on %(target)",
>      },
> +    {
> +        .error_fmt = QERR_KEYBOARD_NOT_FOUND,
> +        .desc      = "No keyboard device found",
> +    },
> +    {
> +        .error_fmt = QERR_INVALID_KEYBOARD_INDEX,
> +        .desc      = "Invalid index '%(index)' for keyboard device",
> +    },
>      {}
>  };
>  
> diff --git a/qerror.h b/qerror.h
> index d96abe1..4086640 100644
> --- a/qerror.h
> +++ b/qerror.h
> @@ -141,4 +141,10 @@ QError *qobject_to_qerror(const QObject *obj);
>  #define QERR_VNC_SERVER_FAILED \
>      "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
>  
> +#define QERR_KEYBOARD_NOT_FOUND \
> +    "{ 'class': 'KeyboardNotFound', 'data': {} }"
> +
> +#define QERR_INVALID_KEYBOARD_INDEX \
> +    "{ 'class': 'InvalidKeyboardIndex', 'data': { 'index': %d } }"
> +
>  #endif /* QERROR_H */

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
  2010-03-31 15:10       ` Markus Armbruster
@ 2010-03-31 15:14         ` Shahar Havivi
  0 siblings, 0 replies; 14+ messages in thread
From: Shahar Havivi @ 2010-03-31 15:14 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

On Wed, Mar 31, 2010 at 05:10:22PM +0200, Markus Armbruster wrote:
> Date: Wed, 31 Mar 2010 17:10:22 +0200
> From: Markus Armbruster <armbru@redhat.com>
> To: Shahar Havivi <shaharh@redhat.com>
> Cc: qemu-devel@nongnu.org
> Subject: Re: [Qemu-devel] [PATCH 2/2] Added monitor commands:
>  'keyboard_set' and 'info keybaord'
> 
> Shahar Havivi <shaharh@redhat.com> writes:
> 
> > On Fri, Mar 26, 2010 at 10:57:58AM +0100, Markus Armbruster wrote:
> [...]
> >> Since the index is not a stable identifier of keyboards, and we support
> >> multiple monitors, you're prone to remove the wrong keyboard.
> >> 
> >>     Monitor#1                           Monitor#2
> >>     "info keyboard" to find the index
> >>                                         unplug a keyboard, invalidating
> >>                                         index
> >>     keyboard_set <index>
> >> 
> >> I think it's best to use a stable ID, like we do in other places.  We
> >> commonly let the user specify it, e.g. as id=ID in -netdev, -device and
> >> elswhere.
> > What do we do when user not specify id for device?
> 
> Two obvious options: make one up (problem: clashes), or stipulate "if
> you want to keyboard_set this keyboard, you must specify an id for it".
> 
> [...]
How about static auto incremented id like the mouse does?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
  2010-03-26 18:40     ` Shahar Havivi
@ 2010-03-31 15:10       ` Markus Armbruster
  2010-03-31 15:14         ` Shahar Havivi
  0 siblings, 1 reply; 14+ messages in thread
From: Markus Armbruster @ 2010-03-31 15:10 UTC (permalink / raw)
  To: Shahar Havivi; +Cc: qemu-devel

Shahar Havivi <shaharh@redhat.com> writes:

> On Fri, Mar 26, 2010 at 10:57:58AM +0100, Markus Armbruster wrote:
[...]
>> Since the index is not a stable identifier of keyboards, and we support
>> multiple monitors, you're prone to remove the wrong keyboard.
>> 
>>     Monitor#1                           Monitor#2
>>     "info keyboard" to find the index
>>                                         unplug a keyboard, invalidating
>>                                         index
>>     keyboard_set <index>
>> 
>> I think it's best to use a stable ID, like we do in other places.  We
>> commonly let the user specify it, e.g. as id=ID in -netdev, -device and
>> elswhere.
> What do we do when user not specify id for device?

Two obvious options: make one up (problem: clashes), or stipulate "if
you want to keyboard_set this keyboard, you must specify an id for it".

[...]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
  2010-03-31  8:15 [Qemu-devel] [PATCH 0/2 v3] Qemu support for multiple keyboard devices Shahar Havivi
@ 2010-03-31  8:16 ` Shahar Havivi
  0 siblings, 0 replies; 14+ messages in thread
From: Shahar Havivi @ 2010-03-31  8:16 UTC (permalink / raw)
  To: qemu-devel

Two new monitor commands: adding ability to handle which keyboard qemu will
use and to see which keyboard are currently available.

$ info keyboard
$ keyboard_set <index>

Signed-off-by: Shahar Havivi <shaharh@redhat.com>
---
 console.h       |    4 ++
 input.c         |  101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 monitor.c       |    8 ++++
 qemu-monitor.hx |   17 +++++++++
 4 files changed, 130 insertions(+), 0 deletions(-)

diff --git a/console.h b/console.h
index 91b66ea..889f5d5 100644
--- a/console.h
+++ b/console.h
@@ -87,6 +87,10 @@ void do_info_mice_print(Monitor *mon, const QObject *data);
 void do_info_mice(Monitor *mon, QObject **ret_data);
 void do_mouse_set(Monitor *mon, const QDict *qdict);
 
+void do_info_keyboard_print(Monitor *mon, const QObject *data);
+void do_info_keyboard(Monitor *mon, QObject **ret_data);
+int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data);
+
 /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
    constants) */
 #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
diff --git a/input.c b/input.c
index e6dda25..3cc33f0 100644
--- a/input.c
+++ b/input.c
@@ -329,3 +329,104 @@ void qemu_remove_mouse_mode_change_notifier(Notifier *notify)
 {
     notifier_list_remove(&mouse_mode_notifiers, notify);
 }
+
+static void info_keyboard_iter(QObject *data, void *opaque)
+{
+    QDict *kbd;
+    Monitor *mon = opaque;
+
+    kbd = qobject_to_qdict(data);
+    monitor_printf(mon, "%c Keyboard #%" PRId64 ": %s\n",
+                  (qdict_get_bool(kbd, "current") ? '*' : ' '),
+                  qdict_get_int(kbd, "index"), qdict_get_str(kbd, "name"));
+}
+
+void do_info_keyboard_print(Monitor *mon, const QObject *data)
+{
+    QList *kbd_list;
+
+    kbd_list = qobject_to_qlist(data);
+    if (qlist_empty(kbd_list)) {
+        monitor_printf(mon, "No keyboard devices connected\n");
+        return;
+    }
+
+    qlist_iter(kbd_list, info_keyboard_iter, mon);
+}
+
+/*
+ * do_info_keyboard(): Show VM keyboard information
+ *
+ * Each keyboard is represented by a QDict, the returned QObject is
+ * a QList of all keyboards.
+ *
+ * The keyboard QDict contains the following:
+ *
+ * - "name": keyboard's name
+ * - "index": keyboard's index
+ * - "current": true if this keyboard is receiving events, false otherwise
+ *
+ * Example:
+ *
+ * [ { "name": "QEMU USB Keyboard", "index": 0, "current": false },
+ *   { "name": "QEMU PS/2 Keyboard", "index": 1, "current": true } ]
+ */
+void do_info_keyboard(Monitor *mon, QObject **ret_data)
+{
+    QEMUPutKbdEntry *cursor;
+    QList *kbd_list;
+    int current;
+
+    kbd_list = qlist_new();
+
+    if (QTAILQ_EMPTY(&kbd_handlers)) {
+        goto out;
+    }
+
+    current = QTAILQ_FIRST(&kbd_handlers)->index;
+    QTAILQ_FOREACH(cursor, &kbd_handlers, node) {
+        QObject *obj;
+        obj = qobject_from_jsonf("{ 'name': %s,"
+                                 "  'index': %d,"
+                                 "  'current': %i }",
+                                 cursor->qemu_put_kbd_name,
+                                 cursor->index,
+                                 current == cursor->index);
+        qlist_append_obj(kbd_list, obj);
+    }
+out:
+    *ret_data = QOBJECT(kbd_list);
+}
+
+/*
+ * do_keyboard_set(): Set active keyboard
+ *
+ * Argument qdict contains
+ * - "index": the keyboard index to set
+ *
+ * Example:
+ *
+ * { "index": "0" }
+ */
+int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+    QEMUPutKbdEntry *cursor;
+    int index = qdict_get_int(qdict, "index");
+    int found = 0;
+
+    if (QTAILQ_EMPTY(&kbd_handlers)) {
+        qerror_report(QERR_DEVICE_NOT_FOUND, "keyboard");
+        return -1;
+    }
+
+    QTAILQ_FOREACH(cursor, &kbd_handlers, node) {
+        if (cursor->index == index) {
+            QTAILQ_REMOVE(&kbd_handlers, cursor, node);
+            QTAILQ_INSERT_HEAD(&kbd_handlers, cursor, node);
+            found = 1;
+            break;
+        }
+    }
+
+    return 0;
+}
diff --git a/monitor.c b/monitor.c
index 822dc27..f5474b1 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2781,6 +2781,14 @@ static const mon_cmd_t info_cmds[] = {
         .mhandler.info_new = do_info_mice,
     },
     {
+        .name       = "keyboard",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show which guest keyboard is receiving events",
+        .user_print = do_info_keyboard_print,
+        .mhandler.info_new = do_info_keyboard,
+    },
+    {
         .name       = "vnc",
         .args_type  = "",
         .params     = "",
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 5308f36..e9beb12 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -659,6 +659,23 @@ info mice
 @end example
 ETEXI
 
+    {
+        .name       = "keyboard_set",
+        .args_type  = "index:i",
+        .params     = "index",
+        .help       = "set which keyboard device receives events",
+        .mhandler.cmd_new = do_keyboard_set,
+    },
+
+STEXI
+@item keyboard_set @var{index}
+@findex keyboard_set
+Set which keyboard device receives events at given @var{index}, index
+can be obtained with
+@example
+info keyboard
+@end example
+ETEXI
 #ifdef HAS_AUDIO
     {
         .name       = "wavcapture",
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
  2010-03-26  9:57   ` Markus Armbruster
  2010-03-26 18:40     ` Shahar Havivi
@ 2010-03-27 18:15     ` Shahar Havivi
  1 sibling, 0 replies; 14+ messages in thread
From: Shahar Havivi @ 2010-03-27 18:15 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

Fix to Markus comments. 

---
 console.h       |    6 +++
 input.c         |  119 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 monitor.c       |    8 ++++
 qemu-monitor.hx |   17 ++++++++
 4 files changed, 141 insertions(+), 9 deletions(-)

diff --git a/console.h b/console.h
index 7d19407..c2af79c 100644
--- a/console.h
+++ b/console.h
@@ -45,6 +45,8 @@ typedef struct QEMUPutKbdEntry {
     char *qemu_put_kbd_name;
     QEMUPutKBDEvent *qemu_put_kbd_event;
     void *qemu_put_kbd_event_opaque;
+    int index;
+
     QTAILQ_ENTRY(QEMUPutKbdEntry) entry;
 } QEMUPutKbdEntry;
 
@@ -85,6 +87,10 @@ void do_info_mice_print(Monitor *mon, const QObject *data);
 void do_info_mice(Monitor *mon, QObject **ret_data);
 void do_mouse_set(Monitor *mon, const QDict *qdict);
 
+void do_info_keyboard_print(Monitor *mon, const QObject *data);
+void do_info_keyboard(Monitor *mon, QObject **ret_data);
+int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data);
+
 /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
    constants) */
 #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
diff --git a/input.c b/input.c
index c27a600..2af6e9d 100644
--- a/input.c
+++ b/input.c
@@ -30,7 +30,6 @@
 
 static QTAILQ_HEAD(, QEMUPutKbdEntry) kbd_handlers =
     QTAILQ_HEAD_INITIALIZER(kbd_handlers);
-static QEMUPutKbdEntry *kbd_current;
 static QTAILQ_HEAD(, QEMUPutLEDEntry) led_handlers = QTAILQ_HEAD_INITIALIZER(led_handlers);
 static QTAILQ_HEAD(, QEMUPutMouseEntry) mouse_handlers =
     QTAILQ_HEAD_INITIALIZER(mouse_handlers);
@@ -59,12 +58,12 @@ QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func,
                                             void *opaque,
                                             const char *name)
 {
+    static int mouse_index = 0;
     QEMUPutKbdEntry *s, *cursor;
 
     QTAILQ_FOREACH(cursor, &kbd_handlers, entry) {
         if (cursor->qemu_put_kbd_event == func &&
             cursor->qemu_put_kbd_event_opaque == opaque) {
-            kbd_current = cursor;
             return cursor;
         }
     }
@@ -74,9 +73,9 @@ QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func,
     s->qemu_put_kbd_event_opaque = opaque;
     s->qemu_put_kbd_event = func;
     s->qemu_put_kbd_name = qemu_strdup(name);
+    s->index = mouse_index++;
 
     QTAILQ_INSERT_TAIL(&kbd_handlers, s, entry);
-    kbd_current = s;
 
     return s;
 }
@@ -84,9 +83,6 @@ QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func,
 void qemu_remove_kbd_event_handler(QEMUPutKbdEntry *entry)
 {
     QTAILQ_REMOVE(&kbd_handlers, entry, entry);
-    if (kbd_current == entry) {
-        kbd_current = QTAILQ_FIRST(&kbd_handlers);
-    }
     qemu_free(entry);
 }
 
@@ -153,10 +149,14 @@ void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry)
 
 void kbd_put_keycode(int keycode)
 {
-    if (kbd_current) {
-        kbd_current->qemu_put_kbd_event(
-            kbd_current->qemu_put_kbd_event_opaque, keycode);
+    QEMUPutKbdEntry *entry;
+
+    if (QTAILQ_EMPTY(&kbd_handlers)) {
+        return;
     }
+
+    entry = QTAILQ_FIRST(&kbd_handlers);
+    entry->qemu_put_kbd_event(entry->qemu_put_kbd_event_opaque, keycode);
 }
 
 void kbd_put_ledstate(int ledstate)
@@ -329,3 +329,104 @@ void qemu_remove_mouse_mode_change_notifier(Notifier *notify)
 {
     notifier_list_remove(&mouse_mode_notifiers, notify);
 }
+
+static void info_keyboard_iter(QObject *data, void *opaque)
+{
+    QDict *kbd;
+    Monitor *mon = opaque;
+
+    kbd = qobject_to_qdict(data);
+    monitor_printf(mon, "%c Keyboard #%" PRId64 ": %s\n",
+                  (qdict_get_bool(kbd, "current") ? '*' : ' '),
+                  qdict_get_int(kbd, "index"), qdict_get_str(kbd, "name"));
+}
+
+void do_info_keyboard_print(Monitor *mon, const QObject *data)
+{
+    QList *kbd_list;
+
+    kbd_list = qobject_to_qlist(data);
+    if (qlist_empty(kbd_list)) {
+        monitor_printf(mon, "No keyboard devices connected\n");
+        return;
+    }
+
+    qlist_iter(kbd_list, info_keyboard_iter, mon);
+}
+
+/*
+ * do_info_keyboard(): Show VM keyboard information
+ *
+ * Each keyboard is represented by a QDict, the returned QObject is
+ * a QList of all keyboards.
+ *
+ * The keyboard QDict contains the following:
+ *
+ * - "name": keyboard's name
+ * - "index": keyboard's index
+ * - "current": true if this keyboard is receiving events, false otherwise
+ *
+ * Example:
+ *
+ * [ { "name": "QEMU USB Keyboard", "index": 0, "current": false },
+ *   { "name": "QEMU PS/2 Keyboard", "index": 1, "current": true } ]
+ */
+void do_info_keyboard(Monitor *mon, QObject **ret_data)
+{
+    QEMUPutKbdEntry *cursor;
+    QList *kbd_list;
+    int current;
+
+    kbd_list = qlist_new();
+
+    if (QTAILQ_EMPTY(&kbd_handlers)) {
+        goto out;
+    }
+
+    current = QTAILQ_FIRST(&kbd_handlers)->index;
+    QTAILQ_FOREACH(cursor, &kbd_handlers, entry) {
+        QObject *obj;
+        obj = qobject_from_jsonf("{ 'name': %s,"
+                                 "  'index': %d,"
+                                 "  'current': %i }",
+                                 cursor->qemu_put_kbd_name,
+                                 cursor->index,
+                                 current == cursor->index);
+        qlist_append_obj(kbd_list, obj);
+    }
+out:
+    *ret_data = QOBJECT(kbd_list);
+}
+
+/*
+ * do_keyboard_set(): Set active keyboard
+ *
+ * Argument qdict contains
+ * - "index": the keyboard index to set
+ *
+ * Example:
+ *
+ * { "index": "0" }
+ */
+int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+    QEMUPutKbdEntry *cursor;
+    int index = qdict_get_int(qdict, "index");
+    int found = 0;
+
+    if (QTAILQ_EMPTY(&kbd_handlers)) {
+        qerror_report(QERR_DEVICE_NOT_FOUND, "keyboard");
+        return -1;
+    }
+
+    QTAILQ_FOREACH(cursor, &kbd_handlers, entry) {
+        if (cursor->index == index) {
+            QTAILQ_REMOVE(&kbd_handlers, cursor, entry);
+            QTAILQ_INSERT_HEAD(&kbd_handlers, cursor, entry);
+            found = 1;
+            break;
+        }
+    }
+
+    return 0;
+}
diff --git a/monitor.c b/monitor.c
index 0448a70..cc95b3d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2783,6 +2783,14 @@ static const mon_cmd_t info_cmds[] = {
         .mhandler.info_new = do_info_mice,
     },
     {
+        .name       = "keyboard",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show which guest keyboard is receiving events",
+        .user_print = do_info_keyboard_print,
+        .mhandler.info_new = do_info_keyboard,
+    },
+    {
         .name       = "vnc",
         .args_type  = "",
         .params     = "",
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 5308f36..e9beb12 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -659,6 +659,23 @@ info mice
 @end example
 ETEXI
 
+    {
+        .name       = "keyboard_set",
+        .args_type  = "index:i",
+        .params     = "index",
+        .help       = "set which keyboard device receives events",
+        .mhandler.cmd_new = do_keyboard_set,
+    },
+
+STEXI
+@item keyboard_set @var{index}
+@findex keyboard_set
+Set which keyboard device receives events at given @var{index}, index
+can be obtained with
+@example
+info keyboard
+@end example
+ETEXI
 #ifdef HAS_AUDIO
     {
         .name       = "wavcapture",
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
  2010-03-26  9:57   ` Markus Armbruster
@ 2010-03-26 18:40     ` Shahar Havivi
  2010-03-31 15:10       ` Markus Armbruster
  2010-03-27 18:15     ` Shahar Havivi
  1 sibling, 1 reply; 14+ messages in thread
From: Shahar Havivi @ 2010-03-26 18:40 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

On Fri, Mar 26, 2010 at 10:57:58AM +0100, Markus Armbruster wrote:
> Date: Fri, 26 Mar 2010 10:57:58 +0100
> From: Markus Armbruster <armbru@redhat.com>
> To: Shahar Havivi <shaharh@redhat.com>
> Cc: qemu-devel@nongnu.org
> Subject: Re: [Qemu-devel] [PATCH 2/2] Added monitor commands:
>  'keyboard_set' and 'info keybaord'
> 
> Shahar Havivi <shaharh@redhat.com> writes:
> 
> > Two new monitor commands: adding ability to handle which keyboard qemu will
> > use and to see which keyboard are currently available.
> >
> > $ info keyboard
> > $ keyboard_set <index>
> >
> > Signed-off-by: Shahar Havivi <shaharh@redhat.com>
> > ---
> >  console.h       |    4 ++
> >  input.c         |  104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  monitor.c       |    8 ++++
> >  qemu-monitor.hx |   17 +++++++++
> >  qerror.c        |    8 ++++
> >  5 files changed, 141 insertions(+), 0 deletions(-)
> >
> > diff --git a/console.h b/console.h
> > index 16c9c3d..7efa88e 100644
> > --- a/console.h
> > +++ b/console.h
> > @@ -85,6 +85,10 @@ void do_info_mice_print(Monitor *mon, const QObject *data);
> >  void do_info_mice(Monitor *mon, QObject **ret_data);
> >  void do_mouse_set(Monitor *mon, const QDict *qdict);
> >  
> > +void do_info_keyboard_print(Monitor *mon, const QObject *data);
> > +void do_info_keyboard(Monitor *mon, QObject **ret_data);
> > +int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data);
> > +
> >  /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
> >     constants) */
> >  #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
> > diff --git a/input.c b/input.c
> > index 563ecad..4daaeb0 100644
> > --- a/input.c
> > +++ b/input.c
> > @@ -368,3 +368,107 @@ void qemu_remove_mouse_mode_change_notifier(Notifier *notify)
> >  {
> >      notifier_list_remove(&mouse_mode_notifiers, notify);
> >  }
> > +
> > +static void info_keyboard_iter(QObject *data, void *opaque)
> > +{
> > +    QDict *kbd;
> > +    Monitor *mon = opaque;
> > +
> > +    kbd = qobject_to_qdict(data);
> > +    monitor_printf(mon, "%c Keyboard #%" PRId64 ": %s\n",
> > +                  (qdict_get_bool(kbd, "current") ? '*' : ' '),
> > +                  qdict_get_int(kbd, "index"), qdict_get_str(kbd, "name"));
> > +}
> > +
> > +void do_info_keyboard_print(Monitor *mon, const QObject *data)
> > +{
> > +    QList *kbd_list;
> > +
> > +    kbd_list = qobject_to_qlist(data);
> > +    if (qlist_empty(kbd_list)) {
> > +        monitor_printf(mon, "No keyboard devices connected\n");
> > +        return;
> > +    }
> > +
> > +    qlist_iter(kbd_list, info_keyboard_iter, mon);
> > +}
> > +
> > +/*
> > + * do_info_keyboard(): Show VM keyboard information
> > + *
> > + * Each keyboard is represented by a QDict, the returned QObject is
> > + * a QList of all keyboards.
> > + *
> > + * The keyboard QDict contains the following:
> > + *
> > + * - "name": keyboard's name
> > + * - "index": keyboard's index
> > + * - "current": true if this keyboard is receiving events, false otherwise
> > + *
> > + * Example:
> > + *
> > + * [ { "name": "QEMU USB Keyboard", "index": 0, "current": false },
> > + *   { "name": "QEMU PS/2 Keyboard", "index": 1, "current": true } ]
> > + */
> > +void do_info_keyboard(Monitor *mon, QObject **ret_data)
> > +{
> > +    QEMUPutKbdEntry *cursor;
> > +    QList *kbd_list;
> > +    int index = 0;
> > +
> > +    kbd_list = qlist_new();
> > +
> > +    if (!qemu_put_kbd_event_head) {
> > +        goto out;
> > +    }
> > +
> > +    cursor = qemu_put_kbd_event_head;
> > +    while (cursor != NULL) {
> > +        QObject *obj;
> > +        obj = qobject_from_jsonf("{ 'name': %s, 'index': %d, 'current': %i }",
> > +                                 cursor->qemu_put_kbd_name,
> > +                                 index, cursor == qemu_put_kbd_event_current);
> > +        qlist_append_obj(kbd_list, obj);
> > +        index++;
> > +        cursor = cursor->next;
> > +    }
> > +out:
> > +    *ret_data = QOBJECT(kbd_list);
> > +}
> 
> Keyboard indexes change when keyboards other than the last one get
> removed.  Hmm.
> 
> > +
> > +/*
> > + * do_keyboard_set(): Set active keyboard
> > + *
> > + * Argument qdict contains
> > + * - "index": the keyboard index to set
> > + *
> > + * Example:
> > + *
> > + * { "index": "0" }
> > + */
> > +int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
> > +{
> > +    QEMUPutKbdEntry *cursor;
> > +    int i = 0;
> > +    int index = qdict_get_int(qdict, "index");
> > +
> > +    if (!qemu_put_kbd_event_head) {
> > +        qerror_report(QERR_DEVICE_NOT_FOUND, "keyboard");
> > +        return -1;
> > +    }
> > +
> > +    cursor = qemu_put_kbd_event_head;
> > +    while (cursor != NULL && index != i) {
> > +        i++;
> > +        cursor = cursor->next;
> > +    }
> > +
> > +    if (cursor != NULL) {
> > +        qemu_put_kbd_event_current = cursor;
> > +    }
> > +    else {
> > +        qerror_report(QERR_INVALID_PARAMETER, "index");
> > +        return -1;
> > +    }
> > +    return 0;
> > +}
> 
> Since the index is not a stable identifier of keyboards, and we support
> multiple monitors, you're prone to remove the wrong keyboard.
> 
>     Monitor#1                           Monitor#2
>     "info keyboard" to find the index
>                                         unplug a keyboard, invalidating
>                                         index
>     keyboard_set <index>
> 
> I think it's best to use a stable ID, like we do in other places.  We
> commonly let the user specify it, e.g. as id=ID in -netdev, -device and
> elswhere.
What do we do when user not specify id for device?
> 
> > diff --git a/monitor.c b/monitor.c
> > index 0448a70..cc95b3d 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -2783,6 +2783,14 @@ static const mon_cmd_t info_cmds[] = {
> >          .mhandler.info_new = do_info_mice,
> >      },
> >      {
> > +        .name       = "keyboard",
> > +        .args_type  = "",
> > +        .params     = "",
> > +        .help       = "show which guest keyboard is receiving events",
> > +        .user_print = do_info_keyboard_print,
> > +        .mhandler.info_new = do_info_keyboard,
> > +    },
> > +    {
> >          .name       = "vnc",
> >          .args_type  = "",
> >          .params     = "",
> > diff --git a/qemu-monitor.hx b/qemu-monitor.hx
> > index 5308f36..e9beb12 100644
> > --- a/qemu-monitor.hx
> > +++ b/qemu-monitor.hx
> > @@ -659,6 +659,23 @@ info mice
> >  @end example
> >  ETEXI
> >  
> > +    {
> > +        .name       = "keyboard_set",
> > +        .args_type  = "index:i",
> > +        .params     = "index",
> > +        .help       = "set which keyboard device receives events",
> > +        .mhandler.cmd_new = do_keyboard_set,
> > +    },
> > +
> > +STEXI
> > +@item keyboard_set @var{index}
> > +@findex keyboard_set
> > +Set which keyboard device receives events at given @var{index}, index
> > +can be obtained with
> > +@example
> > +info keyboard
> > +@end example
> > +ETEXI
> >  #ifdef HAS_AUDIO
> >      {
> >          .name       = "wavcapture",
> > diff --git a/qerror.c b/qerror.c
> > index d0aba61..42a5cf7 100644
> > --- a/qerror.c
> > +++ b/qerror.c
> > @@ -172,6 +172,14 @@ static const QErrorStringTable qerror_table[] = {
> >          .error_fmt = QERR_VNC_SERVER_FAILED,
> >          .desc      = "Could not start VNC server on %(target)",
> >      },
> > +    {
> > +        .error_fmt = QERR_DEVICE_NOT_FOUND,
> > +        .desc      = "No keyboard device found",
> > +    },
> > +    {
> > +        .error_fmt = QERR_INVALID_PARAMETER,
> > +        .desc      = "Invalid index '%(name)' for keyboard device",
> > +    },
> >      {}
> >  };
> 
> I'm afraid you're breaking all other uses of these errors here.
you right, my bad - this errors where not meant to be in this patch.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
  2010-03-23 19:58 ` [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord' Shahar Havivi
@ 2010-03-26  9:57   ` Markus Armbruster
  2010-03-26 18:40     ` Shahar Havivi
  2010-03-27 18:15     ` Shahar Havivi
  0 siblings, 2 replies; 14+ messages in thread
From: Markus Armbruster @ 2010-03-26  9:57 UTC (permalink / raw)
  To: Shahar Havivi; +Cc: qemu-devel

Shahar Havivi <shaharh@redhat.com> writes:

> Two new monitor commands: adding ability to handle which keyboard qemu will
> use and to see which keyboard are currently available.
>
> $ info keyboard
> $ keyboard_set <index>
>
> Signed-off-by: Shahar Havivi <shaharh@redhat.com>
> ---
>  console.h       |    4 ++
>  input.c         |  104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  monitor.c       |    8 ++++
>  qemu-monitor.hx |   17 +++++++++
>  qerror.c        |    8 ++++
>  5 files changed, 141 insertions(+), 0 deletions(-)
>
> diff --git a/console.h b/console.h
> index 16c9c3d..7efa88e 100644
> --- a/console.h
> +++ b/console.h
> @@ -85,6 +85,10 @@ void do_info_mice_print(Monitor *mon, const QObject *data);
>  void do_info_mice(Monitor *mon, QObject **ret_data);
>  void do_mouse_set(Monitor *mon, const QDict *qdict);
>  
> +void do_info_keyboard_print(Monitor *mon, const QObject *data);
> +void do_info_keyboard(Monitor *mon, QObject **ret_data);
> +int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data);
> +
>  /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
>     constants) */
>  #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
> diff --git a/input.c b/input.c
> index 563ecad..4daaeb0 100644
> --- a/input.c
> +++ b/input.c
> @@ -368,3 +368,107 @@ void qemu_remove_mouse_mode_change_notifier(Notifier *notify)
>  {
>      notifier_list_remove(&mouse_mode_notifiers, notify);
>  }
> +
> +static void info_keyboard_iter(QObject *data, void *opaque)
> +{
> +    QDict *kbd;
> +    Monitor *mon = opaque;
> +
> +    kbd = qobject_to_qdict(data);
> +    monitor_printf(mon, "%c Keyboard #%" PRId64 ": %s\n",
> +                  (qdict_get_bool(kbd, "current") ? '*' : ' '),
> +                  qdict_get_int(kbd, "index"), qdict_get_str(kbd, "name"));
> +}
> +
> +void do_info_keyboard_print(Monitor *mon, const QObject *data)
> +{
> +    QList *kbd_list;
> +
> +    kbd_list = qobject_to_qlist(data);
> +    if (qlist_empty(kbd_list)) {
> +        monitor_printf(mon, "No keyboard devices connected\n");
> +        return;
> +    }
> +
> +    qlist_iter(kbd_list, info_keyboard_iter, mon);
> +}
> +
> +/*
> + * do_info_keyboard(): Show VM keyboard information
> + *
> + * Each keyboard is represented by a QDict, the returned QObject is
> + * a QList of all keyboards.
> + *
> + * The keyboard QDict contains the following:
> + *
> + * - "name": keyboard's name
> + * - "index": keyboard's index
> + * - "current": true if this keyboard is receiving events, false otherwise
> + *
> + * Example:
> + *
> + * [ { "name": "QEMU USB Keyboard", "index": 0, "current": false },
> + *   { "name": "QEMU PS/2 Keyboard", "index": 1, "current": true } ]
> + */
> +void do_info_keyboard(Monitor *mon, QObject **ret_data)
> +{
> +    QEMUPutKbdEntry *cursor;
> +    QList *kbd_list;
> +    int index = 0;
> +
> +    kbd_list = qlist_new();
> +
> +    if (!qemu_put_kbd_event_head) {
> +        goto out;
> +    }
> +
> +    cursor = qemu_put_kbd_event_head;
> +    while (cursor != NULL) {
> +        QObject *obj;
> +        obj = qobject_from_jsonf("{ 'name': %s, 'index': %d, 'current': %i }",
> +                                 cursor->qemu_put_kbd_name,
> +                                 index, cursor == qemu_put_kbd_event_current);
> +        qlist_append_obj(kbd_list, obj);
> +        index++;
> +        cursor = cursor->next;
> +    }
> +out:
> +    *ret_data = QOBJECT(kbd_list);
> +}

Keyboard indexes change when keyboards other than the last one get
removed.  Hmm.

> +
> +/*
> + * do_keyboard_set(): Set active keyboard
> + *
> + * Argument qdict contains
> + * - "index": the keyboard index to set
> + *
> + * Example:
> + *
> + * { "index": "0" }
> + */
> +int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
> +{
> +    QEMUPutKbdEntry *cursor;
> +    int i = 0;
> +    int index = qdict_get_int(qdict, "index");
> +
> +    if (!qemu_put_kbd_event_head) {
> +        qerror_report(QERR_DEVICE_NOT_FOUND, "keyboard");
> +        return -1;
> +    }
> +
> +    cursor = qemu_put_kbd_event_head;
> +    while (cursor != NULL && index != i) {
> +        i++;
> +        cursor = cursor->next;
> +    }
> +
> +    if (cursor != NULL) {
> +        qemu_put_kbd_event_current = cursor;
> +    }
> +    else {
> +        qerror_report(QERR_INVALID_PARAMETER, "index");
> +        return -1;
> +    }
> +    return 0;
> +}

Since the index is not a stable identifier of keyboards, and we support
multiple monitors, you're prone to remove the wrong keyboard.

    Monitor#1                           Monitor#2
    "info keyboard" to find the index
                                        unplug a keyboard, invalidating
                                        index
    keyboard_set <index>

I think it's best to use a stable ID, like we do in other places.  We
commonly let the user specify it, e.g. as id=ID in -netdev, -device and
elswhere.

> diff --git a/monitor.c b/monitor.c
> index 0448a70..cc95b3d 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2783,6 +2783,14 @@ static const mon_cmd_t info_cmds[] = {
>          .mhandler.info_new = do_info_mice,
>      },
>      {
> +        .name       = "keyboard",
> +        .args_type  = "",
> +        .params     = "",
> +        .help       = "show which guest keyboard is receiving events",
> +        .user_print = do_info_keyboard_print,
> +        .mhandler.info_new = do_info_keyboard,
> +    },
> +    {
>          .name       = "vnc",
>          .args_type  = "",
>          .params     = "",
> diff --git a/qemu-monitor.hx b/qemu-monitor.hx
> index 5308f36..e9beb12 100644
> --- a/qemu-monitor.hx
> +++ b/qemu-monitor.hx
> @@ -659,6 +659,23 @@ info mice
>  @end example
>  ETEXI
>  
> +    {
> +        .name       = "keyboard_set",
> +        .args_type  = "index:i",
> +        .params     = "index",
> +        .help       = "set which keyboard device receives events",
> +        .mhandler.cmd_new = do_keyboard_set,
> +    },
> +
> +STEXI
> +@item keyboard_set @var{index}
> +@findex keyboard_set
> +Set which keyboard device receives events at given @var{index}, index
> +can be obtained with
> +@example
> +info keyboard
> +@end example
> +ETEXI
>  #ifdef HAS_AUDIO
>      {
>          .name       = "wavcapture",
> diff --git a/qerror.c b/qerror.c
> index d0aba61..42a5cf7 100644
> --- a/qerror.c
> +++ b/qerror.c
> @@ -172,6 +172,14 @@ static const QErrorStringTable qerror_table[] = {
>          .error_fmt = QERR_VNC_SERVER_FAILED,
>          .desc      = "Could not start VNC server on %(target)",
>      },
> +    {
> +        .error_fmt = QERR_DEVICE_NOT_FOUND,
> +        .desc      = "No keyboard device found",
> +    },
> +    {
> +        .error_fmt = QERR_INVALID_PARAMETER,
> +        .desc      = "Invalid index '%(name)' for keyboard device",
> +    },
>      {}
>  };

I'm afraid you're breaking all other uses of these errors here.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord'
  2010-03-23 19:57 [Qemu-devel] [PATCH 0/2] Qemu support for multiple keyboard devices - v2 Shahar Havivi
@ 2010-03-23 19:58 ` Shahar Havivi
  2010-03-26  9:57   ` Markus Armbruster
  0 siblings, 1 reply; 14+ messages in thread
From: Shahar Havivi @ 2010-03-23 19:58 UTC (permalink / raw)
  To: qemu-devel

Two new monitor commands: adding ability to handle which keyboard qemu will
use and to see which keyboard are currently available.

$ info keyboard
$ keyboard_set <index>

Signed-off-by: Shahar Havivi <shaharh@redhat.com>
---
 console.h       |    4 ++
 input.c         |  104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 monitor.c       |    8 ++++
 qemu-monitor.hx |   17 +++++++++
 qerror.c        |    8 ++++
 5 files changed, 141 insertions(+), 0 deletions(-)

diff --git a/console.h b/console.h
index 16c9c3d..7efa88e 100644
--- a/console.h
+++ b/console.h
@@ -85,6 +85,10 @@ void do_info_mice_print(Monitor *mon, const QObject *data);
 void do_info_mice(Monitor *mon, QObject **ret_data);
 void do_mouse_set(Monitor *mon, const QDict *qdict);
 
+void do_info_keyboard_print(Monitor *mon, const QObject *data);
+void do_info_keyboard(Monitor *mon, QObject **ret_data);
+int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data);
+
 /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
    constants) */
 #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
diff --git a/input.c b/input.c
index 563ecad..4daaeb0 100644
--- a/input.c
+++ b/input.c
@@ -368,3 +368,107 @@ void qemu_remove_mouse_mode_change_notifier(Notifier *notify)
 {
     notifier_list_remove(&mouse_mode_notifiers, notify);
 }
+
+static void info_keyboard_iter(QObject *data, void *opaque)
+{
+    QDict *kbd;
+    Monitor *mon = opaque;
+
+    kbd = qobject_to_qdict(data);
+    monitor_printf(mon, "%c Keyboard #%" PRId64 ": %s\n",
+                  (qdict_get_bool(kbd, "current") ? '*' : ' '),
+                  qdict_get_int(kbd, "index"), qdict_get_str(kbd, "name"));
+}
+
+void do_info_keyboard_print(Monitor *mon, const QObject *data)
+{
+    QList *kbd_list;
+
+    kbd_list = qobject_to_qlist(data);
+    if (qlist_empty(kbd_list)) {
+        monitor_printf(mon, "No keyboard devices connected\n");
+        return;
+    }
+
+    qlist_iter(kbd_list, info_keyboard_iter, mon);
+}
+
+/*
+ * do_info_keyboard(): Show VM keyboard information
+ *
+ * Each keyboard is represented by a QDict, the returned QObject is
+ * a QList of all keyboards.
+ *
+ * The keyboard QDict contains the following:
+ *
+ * - "name": keyboard's name
+ * - "index": keyboard's index
+ * - "current": true if this keyboard is receiving events, false otherwise
+ *
+ * Example:
+ *
+ * [ { "name": "QEMU USB Keyboard", "index": 0, "current": false },
+ *   { "name": "QEMU PS/2 Keyboard", "index": 1, "current": true } ]
+ */
+void do_info_keyboard(Monitor *mon, QObject **ret_data)
+{
+    QEMUPutKbdEntry *cursor;
+    QList *kbd_list;
+    int index = 0;
+
+    kbd_list = qlist_new();
+
+    if (!qemu_put_kbd_event_head) {
+        goto out;
+    }
+
+    cursor = qemu_put_kbd_event_head;
+    while (cursor != NULL) {
+        QObject *obj;
+        obj = qobject_from_jsonf("{ 'name': %s, 'index': %d, 'current': %i }",
+                                 cursor->qemu_put_kbd_name,
+                                 index, cursor == qemu_put_kbd_event_current);
+        qlist_append_obj(kbd_list, obj);
+        index++;
+        cursor = cursor->next;
+    }
+out:
+    *ret_data = QOBJECT(kbd_list);
+}
+
+/*
+ * do_keyboard_set(): Set active keyboard
+ *
+ * Argument qdict contains
+ * - "index": the keyboard index to set
+ *
+ * Example:
+ *
+ * { "index": "0" }
+ */
+int do_keyboard_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+    QEMUPutKbdEntry *cursor;
+    int i = 0;
+    int index = qdict_get_int(qdict, "index");
+
+    if (!qemu_put_kbd_event_head) {
+        qerror_report(QERR_DEVICE_NOT_FOUND, "keyboard");
+        return -1;
+    }
+
+    cursor = qemu_put_kbd_event_head;
+    while (cursor != NULL && index != i) {
+        i++;
+        cursor = cursor->next;
+    }
+
+    if (cursor != NULL) {
+        qemu_put_kbd_event_current = cursor;
+    }
+    else {
+        qerror_report(QERR_INVALID_PARAMETER, "index");
+        return -1;
+    }
+    return 0;
+}
diff --git a/monitor.c b/monitor.c
index 0448a70..cc95b3d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2783,6 +2783,14 @@ static const mon_cmd_t info_cmds[] = {
         .mhandler.info_new = do_info_mice,
     },
     {
+        .name       = "keyboard",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show which guest keyboard is receiving events",
+        .user_print = do_info_keyboard_print,
+        .mhandler.info_new = do_info_keyboard,
+    },
+    {
         .name       = "vnc",
         .args_type  = "",
         .params     = "",
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 5308f36..e9beb12 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -659,6 +659,23 @@ info mice
 @end example
 ETEXI
 
+    {
+        .name       = "keyboard_set",
+        .args_type  = "index:i",
+        .params     = "index",
+        .help       = "set which keyboard device receives events",
+        .mhandler.cmd_new = do_keyboard_set,
+    },
+
+STEXI
+@item keyboard_set @var{index}
+@findex keyboard_set
+Set which keyboard device receives events at given @var{index}, index
+can be obtained with
+@example
+info keyboard
+@end example
+ETEXI
 #ifdef HAS_AUDIO
     {
         .name       = "wavcapture",
diff --git a/qerror.c b/qerror.c
index d0aba61..42a5cf7 100644
--- a/qerror.c
+++ b/qerror.c
@@ -172,6 +172,14 @@ static const QErrorStringTable qerror_table[] = {
         .error_fmt = QERR_VNC_SERVER_FAILED,
         .desc      = "Could not start VNC server on %(target)",
     },
+    {
+        .error_fmt = QERR_DEVICE_NOT_FOUND,
+        .desc      = "No keyboard device found",
+    },
+    {
+        .error_fmt = QERR_INVALID_PARAMETER,
+        .desc      = "Invalid index '%(name)' for keyboard device",
+    },
     {}
 };
 
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-03-31 15:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-19 10:57 [Qemu-devel] [PATCH 0/2] Qemu support for multiple keyboard devices Shahar Havivi
2010-03-19 10:57 ` [Qemu-devel] [PATCH 1/2] Support " Shahar Havivi
2010-03-19 10:58 ` [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord' Shahar Havivi
2010-03-19 20:22   ` Luiz Capitulino
2010-03-19 21:03     ` Shahar Havivi
2010-03-19 22:29     ` Shahar Havivi
2010-03-22  0:27       ` Luiz Capitulino
2010-03-23 19:57 [Qemu-devel] [PATCH 0/2] Qemu support for multiple keyboard devices - v2 Shahar Havivi
2010-03-23 19:58 ` [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord' Shahar Havivi
2010-03-26  9:57   ` Markus Armbruster
2010-03-26 18:40     ` Shahar Havivi
2010-03-31 15:10       ` Markus Armbruster
2010-03-31 15:14         ` Shahar Havivi
2010-03-27 18:15     ` Shahar Havivi
2010-03-31  8:15 [Qemu-devel] [PATCH 0/2 v3] Qemu support for multiple keyboard devices Shahar Havivi
2010-03-31  8:16 ` [Qemu-devel] [PATCH 2/2] Added monitor commands: 'keyboard_set' and 'info keybaord' Shahar Havivi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.