[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 14/21] qemu-char: convert braille backend to dat
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 14/21] qemu-char: convert braille backend to data-driven creation |
Date: |
Wed, 14 Oct 2015 17:51:51 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
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
- Re: [Qemu-devel] [PATCH 07/21] qemu-char: convert pipe backend to data-driven creation, (continued)
[Qemu-devel] [PATCH 19/21] qemu-char: convert vc backend to data-driven creation, Paolo Bonzini, 2015/10/15