Patchwork [17/19] baum: Chardev open error reporting, braille part

login
register
mail settings
Submitter Markus Armbruster
Date Feb. 7, 2012, 2:09 p.m.
Message ID <1328623766-12287-18-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/139955/
State New
Headers show

Comments

Markus Armbruster - Feb. 7, 2012, 2:09 p.m.
Convert to error_report().  Improves user-hostile messages like this
one

    baum_init: brlapi_openConnection: connect: No such file or directory
    chardev: opening backend "braille" failed

to

    qemu-system-x86_64: -chardev braille,id=foo: Can't open braille: connect: No such file or directory
    chardev: opening backend "braille" failed

The uninformative extra "opening backend failed" message will be
cleaned up shortly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/baum.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/hw/baum.c b/hw/baum.c
index 3e94f84..7453a15 100644
--- a/hw/baum.c
+++ b/hw/baum.c
@@ -585,14 +585,16 @@  CharDriverState *chr_baum_init(QemuOpts *opts)
 
     baum->brlapi_fd = brlapi__openConnection(handle, NULL, NULL);
     if (baum->brlapi_fd == -1) {
-        brlapi_perror("baum_init: brlapi_openConnection");
+        error_report("Can't open braille: %s",
+                     brlapi_strerror(&brlapi_error));
         goto fail_handle;
     }
 
     baum->cellCount_timer = qemu_new_timer_ns(vm_clock, baum_cellCount_timer_cb, baum);
 
     if (brlapi__getDisplaySize(handle, &baum->x, &baum->y) == -1) {
-        brlapi_perror("baum_init: brlapi_getDisplaySize");
+        error_report("Can't get braille display size: %s",
+                     brlapi_strerror(&brlapi_error));
         goto fail;
     }
 
@@ -606,7 +608,8 @@  CharDriverState *chr_baum_init(QemuOpts *opts)
         tty = BRLAPI_TTY_DEFAULT;
 
     if (brlapi__enterTtyMode(handle, tty, NULL) == -1) {
-        brlapi_perror("baum_init: brlapi_enterTtyMode");
+        error_report("Can't configure braille: %s",
+                     brlapi_strerror(&brlapi_error));
         goto fail;
     }