public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add DisableNameResolving option to main.conf
@ 2009-05-07  2:08 Ilya Rubtsov
  2009-05-07  2:19 ` Ilya Rubtsov
  0 siblings, 1 reply; 6+ messages in thread
From: Ilya Rubtsov @ 2009-05-07  2:08 UTC (permalink / raw)
  To: linux-bluetooth

Hi!

This patch adds new option to main.conf - DisableNameResolving. If 
DisableNameResolving=true then we don't ask remote devices for their 
names after inquiry. Default value is false. That's all :)



diff --git a/src/adapter.c b/src/adapter.c
index 500f82f..02c6d9e 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1076,7 +1076,7 @@ static int start_inquiry(struct btd_adapter *adapter)
 
     hci_close_dev(dd);
 
-    adapter->state |= RESOLVE_NAME;
+    adapter->state |= main_opts.disable_nameres;
 
     return 0;
 }
@@ -1126,7 +1126,7 @@ static int start_periodic_inquiry(struct 
btd_adapter *adapter)
 
     hci_close_dev(dd);
 
-    adapter->state |= RESOLVE_NAME;
+    adapter->state |= main_opts.disable_nameres;
 
     return 0;
 }
@@ -2446,7 +2446,7 @@ struct btd_adapter *adapter_create(DBusConnection 
*conn, int id,
     }
 
     adapter->dev_id = id;
-    adapter->state |= RESOLVE_NAME;
+    adapter->state |= main_opts.disable_nameres;
     adapter->path = g_strdup(path);
     adapter->already_up = devup;
 
diff --git a/src/dbus-hci.c b/src/dbus-hci.c
index e52b4f6..014360b 100644
--- a/src/dbus-hci.c
+++ b/src/dbus-hci.c
@@ -458,7 +458,7 @@ void hcid_dbus_inquiry_start(bdaddr_t *local)
     /* Disable name resolution for non D-Bus clients */
     if (!adapter_has_discov_sessions(adapter)) {
         state = adapter_get_state(adapter);
-        state &= ~RESOLVE_NAME;
+        state &= ~main_opts.disable_nameres;
         adapter_set_state(adapter, state);
     }
 }
@@ -687,7 +687,7 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, 
bdaddr_t *peer, uint32_t class,
     }
 
     /* the inquiry result can be triggered by NON D-Bus client */
-    if (adapter_get_state(adapter) & RESOLVE_NAME)
+    if (adapter_get_state(adapter) & main_opts.disable_nameres)
         name_status = NAME_REQUIRED;
     else
         name_status = NAME_NOT_REQUIRED;
diff --git a/src/hcid.h b/src/hcid.h
index ae356d3..efefa6c 100644
--- a/src/hcid.h
+++ b/src/hcid.h
@@ -59,6 +59,7 @@ struct main_opts {
     uint16_t    link_policy;
     gboolean    remember_powered;
     gboolean    reverse_sdp;
+    int        disable_nameres;
 
     uint8_t        scan;
     uint8_t        mode;
diff --git a/src/main.c b/src/main.c
index 08bef4a..5358db1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -187,6 +187,18 @@ static void parse_config(GKeyFile *config)
     } else
         main_opts.reverse_sdp = boolean;
 
+    boolean = g_key_file_get_boolean(config, "General",
+                        "DisableNameResolving", &err);
+    if (err) {
+        debug("%s", err->message);
+        g_clear_error(&err);
+    } else {       
+        if (boolean)
+            main_opts.disable_nameres = 0x00;
+        else
+            main_opts.disable_nameres = 0x10;
+    }
+
     main_opts.link_mode = HCI_LM_ACCEPT;
 
     main_opts.link_policy = HCI_LP_RSWITCH | HCI_LP_SNIFF |
diff --git a/src/main.conf b/src/main.conf
index c736e49..7dad783 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -46,3 +46,7 @@ RememberPowered = true
 # doesn't like us doing reverse SDP for some test cases (though there 
could in
 # theory be other useful purposes for this too). Defaults to true.
 ReverseServiceDiscovery = true
+
+# Disable name resolving after inquiry. Set it to 'true' if you don't 
need remote
+# devices name and want shorter discovery cycle
+DisableNameRevolving = false

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-05-10 20:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-07  2:08 [PATCH] Add DisableNameResolving option to main.conf Ilya Rubtsov
2009-05-07  2:19 ` Ilya Rubtsov
2009-05-10  4:11   ` Ilya Rubtsov
2009-05-10  4:48     ` Ilya Rubtsov
2009-05-10 19:47       ` [PATCH] Add NameResolving " Ilya Rubtsov
2009-05-10 20:22         ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox