]> Git Repo - qemu.git/commitdiff
qemu-char: convert braille backend to data-driven creation
authorPaolo Bonzini <[email protected]>
Tue, 29 Sep 2015 13:31:26 +0000 (15:31 +0200)
committerPaolo Bonzini <[email protected]>
Mon, 19 Oct 2015 08:05:50 +0000 (10:05 +0200)
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
backends/baum.c
include/sysemu/char.h
qemu-char.c
stubs/Makefile.objs
stubs/chr-baum-init.c [deleted file]

index e86a019bbd618958c52b5b26767ce3d55e32e96b..723c658ac07dde381b5e6f8948b3109fe8ecf7bc 100644 (file)
@@ -561,7 +561,10 @@ static void baum_close(struct CharDriverState *chr)
     g_free(baum);
 }
 
-CharDriverState *chr_baum_init(void)
+static CharDriverState *chr_baum_init(const char *id,
+                                      ChardevBackend *backend,
+                                      ChardevReturn *ret,
+                                      Error **errp)
 {
     BaumDriverState *baum;
     CharDriverState *chr;
@@ -586,14 +589,16 @@ CharDriverState *chr_baum_init(void)
 
     baum->brlapi_fd = brlapi__openConnection(handle, NULL, NULL);
     if (baum->brlapi_fd == -1) {
-        brlapi_perror("baum_init: brlapi_openConnection");
+        error_setg(errp, "brlapi__openConnection: %s",
+                   brlapi_strerror(brlapi_error_location()));
         goto fail_handle;
     }
 
     baum->cellCount_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, baum_cellCount_timer_cb, baum);
 
     if (brlapi__getDisplaySize(handle, &baum->x, &baum->y) == -1) {
-        brlapi_perror("baum_init: brlapi_getDisplaySize");
+        error_setg(errp, "brlapi__getDisplaySize: %s",
+                   brlapi_strerror(brlapi_error_location()));
         goto fail;
     }
 
@@ -609,7 +614,8 @@ CharDriverState *chr_baum_init(void)
         tty = BRLAPI_TTY_DEFAULT;
 
     if (brlapi__enterTtyMode(handle, tty, NULL) == -1) {
-        brlapi_perror("baum_init: brlapi_enterTtyMode");
+        error_setg(errp, "brlapi__enterTtyMode: %s",
+                   brlapi_strerror(brlapi_error_location()));
         goto fail;
     }
 
@@ -630,7 +636,7 @@ fail_handle:
 static void register_types(void)
 {
     register_char_driver("braille", CHARDEV_BACKEND_KIND_BRAILLE, NULL,
-                         NULL);
+                         chr_baum_init);
 }
 
 type_init(register_types);
index 2fe827551cac971554d752bdff4997a5df4246c8..77415ec2eb8d6bd546febbba4eb341ca3cff09a4 100644 (file)
@@ -359,9 +359,6 @@ CharDriverState *qemu_char_get_next_serial(void);
 /* testdev.c */
 CharDriverState *chr_testdev_init(void);
 
-/* baum.c */
-CharDriverState *chr_baum_init(void);
-
 /* console.c */
 typedef CharDriverState *(VcHandler)(ChardevVC *vc);
 
index 64ca39761d2fefca66eaa572ed324cab1b16e238..f2e3a352f45b35ab97d352e2194e4420c21dfcd1 100644 (file)
@@ -4314,11 +4314,9 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
         case CHARDEV_BACKEND_KIND_MSMOUSE:
             abort();
             break;
-#ifdef CONFIG_BRLAPI
         case CHARDEV_BACKEND_KIND_BRAILLE:
-            chr = chr_baum_init();
+            abort();
             break;
-#endif
         case CHARDEV_BACKEND_KIND_TESTDEV:
             chr = chr_testdev_init();
             break;
index 63988ca75e488e8fd3999c7f6f1a89e2c2baa3ef..8cfa5a2f462e4eb8e58f300132ce4f4272925a1e 100644 (file)
@@ -1,6 +1,5 @@
 stub-obj-y += arch-query-cpu-def.o
 stub-obj-y += bdrv-commit-all.o
-stub-obj-y += chr-baum-init.o
 stub-obj-y += chr-testdev.o
 stub-obj-y += clock-warp.o
 stub-obj-y += cpu-get-clock.o
diff --git a/stubs/chr-baum-init.c b/stubs/chr-baum-init.c
deleted file mode 100644 (file)
index f5cc6ce..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "qemu-common.h"
-#include "sysemu/char.h"
-
-CharDriverState *chr_baum_init(void)
-{
-    return NULL;
-}
This page took 0.038244 seconds and 4 git commands to generate.