OSDN Git Service

tools/btiotest: Fix applying voice setting for incoming connections
authorJohan Hedberg <johan.hedberg@intel.com>
Thu, 8 Aug 2013 09:48:37 +0000 (12:48 +0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 8 Aug 2013 09:48:37 +0000 (12:48 +0300)
tools/btiotest.c

index 9950fa9..a77eba1 100644 (file)
@@ -46,6 +46,7 @@ struct io_data {
        int reject;
        int disconn;
        int accept;
+       int voice;
 };
 
 static void io_data_unref(struct io_data *data)
@@ -238,6 +239,14 @@ static void confirm_cb(GIOChannel *io, gpointer user_data)
                return;
        }
 
+       if (data->voice) {
+               if (!bt_io_set(io, &err, BT_IO_OPT_VOICE, data->voice,
+                                                       BT_IO_OPT_INVALID)) {
+                       printf("bt_io_set(OPT_VOICE): %s\n", err->message);
+                       g_clear_error(&err);
+               }
+       }
+
        data->io = g_io_channel_ref(io);
        io_data_ref(data);
 
@@ -499,6 +508,8 @@ static void sco_listen(const char *src, gboolean defer, int reject,
 
        data = io_data_new(NULL, reject, disconn, accept);
 
+       data->voice = voice;
+
        if (src)
                sco_srv = bt_io_listen(conn, cfm, data,
                                        (GDestroyNotify) io_data_unref,