Patchwork [5/9] chardev: add braille support to qapi

login
register
mail settings
Submitter Gerd Hoffmann
Date Feb. 25, 2013, 9:03 a.m.
Message ID <1361783023-10082-8-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/222882/
State New
Headers show

Comments

Gerd Hoffmann - Feb. 25, 2013, 9:03 a.m.
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      |    7 ++++++-
 4 files changed, 10 insertions(+), 4 deletions(-)

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 cd93707..f873451 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3161,7 +3161,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..156eade 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2998,7 +2998,7 @@  static const struct {
     { .name = "stdio",     .open = qemu_chr_open_stdio },
 #endif
 #ifdef CONFIG_BRLAPI
-    { .name = "braille",   .open = chr_baum_init },
+    { .name = "braille",   .kind  = CHARDEV_BACKEND_KIND_BRAILLE },
 #endif
 #ifdef HAVE_CHARDEV_TTY
     { .name = "tty",       .open = qemu_chr_open_tty },
@@ -3480,6 +3480,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;