~ubuntu-branches/ubuntu/vivid/bluez/vivid

« back to all changes in this revision

Viewing changes to debian/patches/dont_enable_discoverable_during_init_with_if_valid_timeout.patch

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo
  • Date: 2015-03-08 18:47:09 UTC
  • Revision ID: package-import@ubuntu.com-20150308184709-km6t4a62635dlrdn
Tags: 4.101-0ubuntu24
* dont_enable_discoverable_during_init_with_if_valid_timeout.patch:
  - Backport from upstream to avoid enabling discoverable if there is a
    valid timeout value (LP: #1419874)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Author: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
 
2
Description: Don't enable discoverable during init if timeout is valid
 
3
 
 
4
Backport of the upstream patch 8819626.
 
5
 
 
6
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/1419874
 
7
 
 
8
Index: bluez-4.101/plugins/mgmtops.c
 
9
===================================================================
 
10
--- bluez-4.101.orig/plugins/mgmtops.c
 
11
+++ bluez-4.101/plugins/mgmtops.c
 
12
@@ -223,7 +223,8 @@ static int mgmt_set_discoverable(int ind
 
13
        struct mgmt_hdr *hdr = (void *) buf;
 
14
        struct mgmt_cp_set_discoverable *cp = (void *) &buf[sizeof(*hdr)];
 
15
 
 
16
-       DBG("index %d discoverable %d", index, discoverable);
 
17
+       DBG("index %d discoverable %d timeout %d", index,
 
18
+                                       discoverable, timeout);
 
19
 
 
20
        memset(buf, 0, sizeof(buf));
 
21
        hdr->opcode = htobs(MGMT_OP_SET_DISCOVERABLE);
 
22
@@ -322,7 +323,11 @@ static void update_settings(struct btd_a
 
23
        if (on_mode == MODE_DISCOVERABLE && !mgmt_discoverable(settings)) {
 
24
                if(!mgmt_connectable(settings))
 
25
                        mgmt_set_connectable(index, TRUE);
 
26
-               mgmt_set_discoverable(index, TRUE, discoverable_timeout);
 
27
+               if (discoverable_timeout > 0) {
 
28
+                       /* Ensure that discoverable mode is off */
 
29
+                       mgmt_set_discoverable(index, FALSE, 0);
 
30
+               } else
 
31
+                       mgmt_set_discoverable(index, TRUE, discoverable_timeout);
 
32
        } else if (on_mode == MODE_CONNECTABLE && !mgmt_connectable(settings)) {
 
33
                mgmt_set_connectable(index, TRUE);
 
34
        } else if (mgmt_powered(settings)) {