From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmOLR-0002hZ-2b for qemu-devel@nongnu.org; Wed, 14 Oct 2015 11:52:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmOLL-0002Ww-WA for qemu-devel@nongnu.org; Wed, 14 Oct 2015 11:52:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmOLL-0002W9-QL for qemu-devel@nongnu.org; Wed, 14 Oct 2015 11:51:55 -0400 References: <1444637004-20195-1-git-send-email-pbonzini@redhat.com> <1444637004-20195-15-git-send-email-pbonzini@redhat.com> <561BD204.7050307@redhat.com> <20151012154135.GF4886@var.bordeaux.inria.fr> From: Paolo Bonzini Message-ID: <561E7A17.6050906@redhat.com> Date: Wed, 14 Oct 2015 17:51:51 +0200 MIME-Version: 1.0 In-Reply-To: <20151012154135.GF4886@var.bordeaux.inria.fr> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 14/21] qemu-char: convert braille backend to data-driven creation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Samuel Thibault , Eric Blake Cc: qemu-devel@nongnu.org, armbru@redhat.com On 12/10/2015 17:41, Samuel Thibault wrote: > Eric Blake, le Mon 12 Oct 2015 09:30:12 -0600, a =E9crit : >> 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. >=20 > Yes. Such additional information is really useful to debug brlapi > issues. >=20 >> 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, >=20 > brlapi_error_t * brlapi_error_location(void); > const char * brlapi_strerror(const brlapi_error_t *error); >=20 > 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 *i= d, =20 baum->brlapi_fd =3D brlapi__openConnection(handle, NULL, NULL); if (baum->brlapi_fd =3D=3D -1) { - error_setg(errp, "baum_init: brlapi_openConnection"); + error_setg(errp, "brlapi__openConnection: %s", + brlapi_strerror(brlapi_error_location())); goto fail_handle; } =20 baum->cellCount_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, baum_cell= Count_timer_cb, baum); =20 if (brlapi__getDisplaySize(handle, &baum->x, &baum->y) =3D=3D -1) { - error_setg(errp, "baum_init: brlapi_getDisplaySize"); + error_setg(errp, "brlapi__getDisplaySize: %s", + brlapi_strerror(brlapi_error_location())); goto fail; } =20 @@ -612,7 +614,8 @@ static CharDriverState *chr_baum_init(const char *id, tty =3D BRLAPI_TTY_DEFAULT; =20 if (brlapi__enterTtyMode(handle, tty, NULL) =3D=3D -1) { - error_setg(errp, "baum_init: brlapi_enterTtyMode"); + error_setg(errp, "brlapi__enterTtyMode: %s", + brlapi_strerror(brlapi_error_location())); goto fail; } =20 Thanks for the help, Paolo