On Wed, 2016-08-17 at 14:48 +0200, Peter Meerwald-Stadler wrote: > > From: Peter Meerwald <p.meerwald at bct-electronic.com> > > CID 1533121 > > > Signed-off-by: Peter Meerwald-Stadler <pmeerw at pmeerw.net> > > --- > v2: use pa_read() as Tanu suggested > --- > Â src/modules/bluetooth/backend-native.c | 8 +++++--- > Â 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/src/modules/bluetooth/backend-native.c b/src/modules/bluetooth/backend-native.c > index 86376c0..cf88126 100644 > --- a/src/modules/bluetooth/backend-native.c > +++ b/src/modules/bluetooth/backend-native.c > @@ -231,14 +231,17 @@ static void rfcomm_io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_i > Â Â Â Â Â Â Â Â Â ssize_t len; > Â Â Â Â Â Â Â Â Â int gain; > Â > -Â Â Â Â Â Â Â Â len = read(fd, buf, 511); > +Â Â Â Â Â Â Â Â len = pa_read(fd, buf, 511, NULL); > +Â Â Â Â Â Â Â Â if (len < 0) { > +Â Â Â Â Â Â Â Â Â Â Â Â pa_log_error("RFCOMM read error: %s", pa_cstrerror(errno)); > +Â Â Â Â Â Â Â Â Â Â Â Â goto fail; > +Â Â Â Â Â Â Â Â } > Â Â Â Â Â Â Â Â Â buf[len] = 0; > Â Â Â Â Â Â Â Â Â pa_log_debug("RFCOMM << %s", buf); > Â > Â Â Â Â Â Â Â Â Â if (sscanf(buf, "AT+VGS=%d", &gain) == 1) { > Â Â Â Â Â Â Â Â Â Â Â t->speaker_gain = gain; > Â Â Â Â Â Â Â Â Â Â Â pa_hook_fire(pa_bluetooth_discovery_hook(t->device->discovery, PA_BLUETOOTH_HOOK_TRANSPORT_SPEAKER_GAIN_CHANGED), t); > - > Â Â Â Â Â Â Â Â Â } else if (sscanf(buf, "AT+VGM=%d", &gain) == 1) { > Â Â Â Â Â Â Â Â Â Â Â t->microphone_gain = gain; > Â Â Â Â Â Â Â Â Â Â Â pa_hook_fire(pa_bluetooth_discovery_hook(t->device->discovery, PA_BLUETOOTH_HOOK_TRANSPORT_MICROPHONE_GAIN_CHANGED), t); > @@ -259,7 +262,6 @@ static void rfcomm_io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_i > Â fail: > Â Â Â Â Â pa_bluetooth_transport_unlink(t); > Â Â Â Â Â pa_bluetooth_transport_free(t); > -Â Â Â Â return; > Â } > Â > Â static void transport_destroy(pa_bluetooth_transport *t) { Looks good to me. --Â Tanu