diff mbox

[05/17] chardev: add braille support to qapi

Message ID 1362037809-27836-6-git-send-email-kraxel@redhat.com
State New
Headers show

Commit Message

Gerd Hoffmann Feb. 28, 2013, 7:49 a.m. UTC
This patch adds 'braille' support to qapi and also switches over
the braille chardev initialization to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/baum.c        |    2 +-
 hw/baum.h        |    2 +-
 qapi-schema.json |    3 ++-
 qemu-char.c      |    9 ++++++---
 4 files changed, 10 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/hw/baum.c b/hw/baum.c
index 09dcb9c..7f0384c 100644
--- a/hw/baum.c
+++ b/hw/baum.c
@@ -562,7 +562,7 @@  static void baum_close(struct CharDriverState *chr)
     g_free(baum);
 }
 
-CharDriverState *chr_baum_init(QemuOpts *opts)
+CharDriverState *chr_baum_init(void)
 {
     BaumDriverState *baum;
     CharDriverState *chr;
diff --git a/hw/baum.h b/hw/baum.h
index 7635884..6fcb627 100644
--- a/hw/baum.h
+++ b/hw/baum.h
@@ -25,6 +25,6 @@ 
 #define HW_BAUM_H 1
 
 /* char device */
-CharDriverState *chr_baum_init(QemuOpts *opts);
+CharDriverState *chr_baum_init(void);
 
 #endif
diff --git a/qapi-schema.json b/qapi-schema.json
index b14c5c7..5dcfbfe 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3211,7 +3211,8 @@ 
                                        'pty'    : 'ChardevDummy',
                                        'null'   : 'ChardevDummy',
                                        'mux'    : 'ChardevMux',
-                                       'msmouse': 'ChardevDummy' } }
+                                       'msmouse': 'ChardevDummy',
+                                       'braille': 'ChardevDummy' } }
 
 ##
 # @ChardevReturn:
diff --git a/qemu-char.c b/qemu-char.c
index c824ed8..5dc391d 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2997,9 +2997,7 @@  static const struct {
     { .name = "pipe",      .open = qemu_chr_open_pipe },
     { .name = "stdio",     .open = qemu_chr_open_stdio },
 #endif
-#ifdef CONFIG_BRLAPI
-    { .name = "braille",   .open = chr_baum_init },
-#endif
+    { .name = "braille",   .kind  = CHARDEV_BACKEND_KIND_BRAILLE },
 #ifdef HAVE_CHARDEV_TTY
     { .name = "tty",       .open = qemu_chr_open_tty },
     { .name = "serial",    .open = qemu_chr_open_tty },
@@ -3480,6 +3478,11 @@  ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
     case CHARDEV_BACKEND_KIND_MSMOUSE:
         chr = qemu_chr_open_msmouse();
         break;
+#ifdef CONFIG_BRLAPI
+    case CHARDEV_BACKEND_KIND_BRAILLE:
+        chr = chr_baum_init();
+        break;
+#endif
     default:
         error_setg(errp, "unknown chardev backend (%d)", backend->kind);
         break;