On 12/10/2015 17:41, Samuel Thibault wrote: > Eric Blake, le Mon 12 Oct 2015 09:30:12 -0600, a écrit : >> Also, I assume that brlapi_perror() adds additional information to >> the error message it prints, such as conversion of a brlapi-specific >> error message in the same manner in which perror() converts errno and in >> which error_setg_errno() would be used. > > Yes. Such additional information is really useful to debug brlapi > issues. > >> So I don't know if this >> conversion is the best. But I'm unfamiliar with brlapi_* in general, to >> know if there is anything better to use, > > brlapi_error_t * brlapi_error_location(void); > const char * brlapi_strerror(const brlapi_error_t *error); > > So brlapi_strerror(brlapi_error_location()) will return what you want, > i.e. the string that brlapi_error() would have printed.
Is it okay to squash this? diff --git a/backends/baum.c b/backends/baum.c index 281be30..723c658 100644 --- a/backends/baum.c +++ b/backends/baum.c @@ -589,14 +589,16 @@ static CharDriverState *chr_baum_init(const char *id, baum->brlapi_fd = brlapi__openConnection(handle, NULL, NULL); if (baum->brlapi_fd == -1) { - error_setg(errp, "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) { - error_setg(errp, "baum_init: brlapi_getDisplaySize"); + error_setg(errp, "brlapi__getDisplaySize: %s", + brlapi_strerror(brlapi_error_location())); goto fail; } @@ -612,7 +614,8 @@ static CharDriverState *chr_baum_init(const char *id, tty = BRLAPI_TTY_DEFAULT; if (brlapi__enterTtyMode(handle, tty, NULL) == -1) { - error_setg(errp, "baum_init: brlapi_enterTtyMode"); + error_setg(errp, "brlapi__enterTtyMode: %s", + brlapi_strerror(brlapi_error_location())); goto fail; } Thanks for the help, Paolo