From 331b120153c04694c73556c0287456a11874251f Mon Sep 17 00:00:00 2001 From: Tim Bao Date: Wed, 24 Feb 2010 20:48:29 +0800 Subject: [PATCH] Allow disable park state in main.conf Currently BlueZ is hard-coding the default link policy to include hold mode, role switch, sniff mode and park state. However, some device will have problem to maintain the connection or setup SCO if they are in park state. Making the park state configurable in main.conf improves flexibility so it can be disabled when needed. Signed-off-by: Tim Bao --- src/main.c | 13 +++++++++---- src/main.conf | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 014d8b6..977c87b 100644 --- a/src/main.c +++ b/src/main.c @@ -201,10 +201,12 @@ static void parse_config(GKeyFile *config) else main_opts.name_resolv = boolean; - main_opts.link_mode = HCI_LM_ACCEPT; - - main_opts.link_policy = HCI_LP_RSWITCH | HCI_LP_SNIFF | - HCI_LP_HOLD | HCI_LP_PARK; + boolean = g_key_file_get_boolean(config, "General", + "DisableParkState", &err); + if (err) + g_clear_error(&err); + else if (boolean) + main_opts.link_policy &= (~HCI_LP_PARK); } /* @@ -276,6 +278,9 @@ static void init_defaults(void) main_opts.remember_powered = TRUE; main_opts.reverse_sdp = TRUE; main_opts.name_resolv = TRUE; + main_opts.link_mode = HCI_LM_ACCEPT; + main_opts.link_policy = HCI_LP_RSWITCH | HCI_LP_SNIFF | + HCI_LP_HOLD | HCI_LP_PARK; if (gethostname(main_opts.host_name, sizeof(main_opts.host_name) - 1) < 0) strcpy(main_opts.host_name, "noname"); diff --git a/src/main.conf b/src/main.conf index b252a82..6f975fc 100644 --- a/src/main.conf +++ b/src/main.conf @@ -50,3 +50,8 @@ ReverseServiceDiscovery = true # Enable name resolving after inquiry. Set it to 'false' if you don't need # remote devices name and want shorter discovery cycle. Defaults to 'true'. NameResolving = true + +# Disable park state in default link policy. Some devices have connection +# stability issue or fail to setup SCO when the link is in park state. Defaults +# to 'false'. +DisableParkState = false -- 1.5.6.3