d21555ea34d15f0ccf66850f62efddbf33f1bf6f
[AGL/meta-agl-devel.git] /
1 From 39f578d2c44fef9fd2e105eb7594a2d249152e63 Mon Sep 17 00:00:00 2001
2 From: Thierry Bultel <thierry.bultel@iot.bzh>
3 Date: Mon, 10 Sep 2018 14:56:14 +0200
4 Subject: [PATCH] proxy plugin: close transport when null device is set
5
6 Simply closes the transport when bluealsa_proxy_set_remote_device
7 specifies a null device.
8 Also removed spurious log.
9
10 Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
11 ---
12  src/asound/bluealsa-pcm-proxy.c | 11 +++++++++--
13  1 file changed, 9 insertions(+), 2 deletions(-)
14
15 diff --git a/src/asound/bluealsa-pcm-proxy.c b/src/asound/bluealsa-pcm-proxy.c
16 index 4abab2b..7c59cd1 100644
17 --- a/src/asound/bluealsa-pcm-proxy.c
18 +++ b/src/asound/bluealsa-pcm-proxy.c
19 @@ -130,7 +130,7 @@ static void *io_thread(void *arg) {
20  
21  wait_pcm_fd:
22  
23 -       debug("PLUGIN io-thread: wait for pcm_fd\n");
24 +       //debug("PLUGIN io-thread: wait for pcm_fd\n");
25  
26         /* In the capture mode, the PCM FIFO is opened in the non-blocking mode.
27          * So right now, we have to synchronize write and read sides, otherwise
28 @@ -784,7 +784,14 @@ int bluealsa_proxy_set_remote_device(const char * interface, const char * device
29  
30         enum pcm_type type;
31  
32 -       if (device == NULL || str2ba(device, &the_pcm->addr) != 0) {
33 +       /* When the hardware address is NULL, just close the connection */
34 +       if (device == NULL ) {
35 +               close_bluez_connection();
36 +               ret = 0;
37 +               goto failed;
38 +       }
39 +
40 +       if ( str2ba(device, &the_pcm->addr) != 0) {
41                 SNDERR("Invalid BT device address: %s", device);
42                 ret = -EINVAL;
43                 goto failed;
44 -- 
45 2.16.4
46