Currently BlueZ is reading a bunch of configuration from main.conf. However it hard-codes the default link policy to enable role switch, hold mode, park state and sniff mode. We've found that there're some Bluetooth devices such as Motorola HF850 can't work well when park state is enabled. Once the link is parked, the Motorola HF850 car-kit will fail to unpark and lose connection. After that the car-kit will keep re-connect and disconnect. Also, if it's the remote device who initiates connection, the connection will be stable but once the link is in park state, the SCO connection can't be setup. Feedback from accessory team is that park state often causes some interoperability problem so it's used rarely now. Because these devices have been available on market, one option is to turn off park state on the phone side. Instead of making a blacklist to include devices who have problem with park state, adding a single configuration item to disable park state will provide the flexibility with limited change. Default value for this configuration item will be false to keep current behavior unchanged. Here's the log captured with the HF850 and a Droid phone. Note entering park state at 14:58:40.534427 and the connection timeout at 2010-01-05 14:58:46.372714. The Droid will keep entering park state, detect timeout and accept re-connection. 2010-01-05 14:58:34.456210 > HCI Event: Mode Change (0x14) plen 6 status 0x00 handle 1 mode 0x02 interval 2048 Mode: Sniff 2010-01-05 14:58:34.940677 > ACL data: handle 1 flags 0x02 dlen 19 L2CAP(d): cid 0x0041 len 15 [psm 3] RFCOMM(d): UIH: cr 1 dlci 20 pf 1 ilen 10 fcs 0x2d credits 1 A T + N R E C = 0 . 2010-01-05 14:58:34.951480 < ACL data: handle 1 flags 0x02 dlen 14 L2CAP(d): cid 0x004d len 10 [psm 3] RFCOMM(d): UIH: cr 0 dlci 20 pf 0 ilen 6 fcs 0xeb . . O K . . 2010-01-05 14:58:36.217044 > HCI Event: Number of Completed Packets (0x13) plen 5 handle 1 packets 1 2010-01-05 14:58:37.500095 > ACL data: handle 1 flags 0x02 dlen 19 L2CAP(d): cid 0x0041 len 15 [psm 3] RFCOMM(d): UIH: cr 1 dlci 20 pf 1 ilen 10 fcs 0x2d credits 1 A T + C C W A = 1 . 2010-01-05 14:58:37.506900 < ACL data: handle 1 flags 0x02 dlen 14 L2CAP(d): cid 0x004d len 10 [psm 3] RFCOMM(d): UIH: cr 0 dlci 20 pf 0 ilen 6 fcs 0xeb . . O K . . 2010-01-05 14:58:38.777072 > HCI Event: Number of Completed Packets (0x13) plen 5 handle 1 packets 1 2010-01-05 14:58:40.062412 > HCI Event: Mode Change (0x14) plen 6 status 0x00 handle 1 mode 0x00 interval 0 Mode: Active 2010-01-05 14:58:40.534427 > HCI Event: Mode Change (0x14) plen 6 status 0x00 handle 1 mode 0x03 interval 1152 Mode: Park 2010-01-05 14:58:46.372714 > HCI Event: Disconn Complete (0x05) plen 4 status 0x00 handle 1 reason 0x08 Reason: Connection Timeout 2010-01-05 14:58:47.689975 > HCI Event: Connect Request (0x04) plen 10 bdaddr 00:50:CD:20:BA:E6 class 0x200404 type ACL 2010-01-05 14:58:47.690097 < HCI Command: Accept Connection Request (0x01|0x0009) plen 7 bdaddr 00:50:CD:20:BA:E6 role 0x00 Role: Master 2010-01-05 14:58:47.690616 > HCI Event: Command Status (0x0f) plen 4 Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1 2010-01-05 14:58:47.851596 > HCI Event: Role Change (0x12) plen 8 status 0x00 bdaddr 00:50:CD:20:BA:E6 role 0x00 Role: Master 2010-01-05 14:58:47.961978 > HCI Event: Link Key Request (0x17) plen 6 bdaddr 00:50:CD:20:BA:E6 2010-01-05 14:58:47.963748 < HCI Command: Link Key Request Reply (0x01|0x000b) plen 22 bdaddr 00:50:CD:20:BA:E6 key 9752FA7985E81F9282DCDD80FB9C2B40 2010-01-05 14:58:47.964450 > HCI Event: Command Complete (0x0e) plen 10 Link Key Request Reply (0x01|0x000b) ncmd 1 status 0x00 bdaddr 00:50:CD:20:BA:E6 2010-01-05 14:58:48.076389 > HCI Event: Connect Complete (0x03) plen 11 status 0x00 handle 1 bdaddr 00:50:CD:20:BA:E6 type ACL encrypt 0x01 2010-01-05 14:58:48.076541 < HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2 handle 1 2010-01-05 14:58:48.076602 > HCI Event: Page Scan Repetition Mode Change (0x20) plen 7 bdaddr 00:50:CD:20:BA:E6 mode 1 2010-01-05 14:58:48.077579 > HCI Event: Command Status (0x0f) plen 4 Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1 2010-01-05 14:58:48.079257 > HCI Event: Max Slots Change (0x1b) plen 3 handle 1 slots 5 2010-01-05 14:58:48.079776 > ACL data: handle 1 flags 0x02 dlen 12 L2CAP(s): Connect req: psm 1 scid 0x004e 2010-01-05 14:58:48.079898 < ACL data: handle 1 flags 0x02 dlen 16 L2CAP(s): Connect rsp: dcid 0x0040 scid 0x004e result 1 status 0 Connection pending - No futher information available 2010-01-05 14:58:48.079959 < ACL data: handle 1 flags 0x02 dlen 10 L2CAP(s): Info req: type 2 2010-01-05 14:58:48.083896 > HCI Event: Number of Completed Packets (0x13) plen 5 handle 1 packets 2 2010-01-05 14:58:48.092990 > HCI Event: Read Remote Supported Features (0x0b) plen 11 status 0x00 handle 1 Features: 0xff 0xff 0x8f 0xf8 0x18 0x18 0x00 0x80 2010-01-05 14:58:48.098422 < HCI Command: Remote Name Request (0x01|0x0019) plen 10 bdaddr 00:50:CD:20:BA:E6 mode 2 clkoffset 0x0000 2010-01-05 14:58:48.098941 > HCI Event: Command Status (0x0f) plen 4 Remote Name Request (0x01|0x0019) status 0x00 ncmd 1 2010-01-05 14:58:48.101444 > ACL data: handle 1 flags 0x02 dlen 16 L2CAP(s): Info rsp: type 2 result 0 Extended feature mask 0x0000 2010-01-05 14:58:48.101596 < ACL data: handle 1 flags 0x02 dlen 16 L2CAP(s): Connect rsp: dcid 0x0040 scid 0x004e result 0 status 0 Connection successful
From 331b120153c04694c73556c0287456a11874251f Mon Sep 17 00:00:00 2001 From: Tim Bao <tim.bao@xxxxxxxxx> 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 <tim.bao@xxxxxxxxx> --- 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