diff mbox

[braille] : Error out if the real braille device is not connected

Message ID 20140907213537.GA25610@type.youpi.perso.aquilenet.fr
State New
Headers show

Commit Message

Samuel Thibault Sept. 7, 2014, 9:35 p.m. UTC
When the real braille device which will be used to render the output of
the virtual one is not plugged, brlapi can not provide the size, and
reports 0.  This makes the baum virtual device basically ignore all
display packets, thus failing probes from device drivers, without the
possibility for any message to the user to understand what is happening.

This change makes qemu refuse to configure the character device in such
case, and let the user know what to fix.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
diff mbox

Patch

diff --git a/backends/baum.c b/backends/baum.c
index 759003f..f5fcdaa 100644
--- a/backends/baum.c
+++ b/backends/baum.c
@@ -597,6 +597,11 @@  CharDriverState *chr_baum_init(void)
         goto fail;
     }
 
+    if (baum->x == 0 || baum->y == 0) {
+        fprintf(stderr, "baum_init: braille display size is %dx%d!  Is a braille device connected on the host?\n", baum->x, baum->y);
+        goto fail;
+    }
+
 #if defined(CONFIG_SDL)
 #if SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 0)
     memset(&info, 0, sizeof(info));