Linux bluetooth development
 help / color / mirror / Atom feed
* Re: [PATCH] Removed unused define
From: Johan Hedberg @ 2010-11-29 15:02 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth
In-Reply-To: <1291037054-22247-1-git-send-email-claudio.takahasi@openbossa.org>

Hi Claudio,

On Mon, Nov 29, 2010, Claudio Takahasi wrote:
> ---
>  src/device.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/src/device.c b/src/device.c
> index 77353a4..65acc08 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -57,7 +57,6 @@
>  #include "storage.h"
>  #include "btio.h"
>  
> -#define DEFAULT_XML_BUF_SIZE	1024
>  #define DISCONNECT_TIMER	2
>  #define DISCOVERY_TIMER		2

Pushed upstream. Thanks.

Johan

^ permalink raw reply

* [PATCH v3] Bluetooth: Fix error handling for l2cap_init()
From: Anderson Lizardo @ 2010-11-29 16:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

create_singlethread_workqueue() may fail with errors such as -ENOMEM. If
this happens, the return value is not set to a negative value and the
module load will succeed. It will then crash on module unload because of
a destroy_workqueue() call on a NULL pointer.

Additionally, the _busy_wq workqueue is not being destroyed if any
errors happen on l2cap_init().

Signed-off-by: Anderson Lizardo <anderson.lizardo@openbossa.org>
---
 net/bluetooth/l2cap.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 12b4aa2..a1c7ae8 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -4871,8 +4871,10 @@ static int __init l2cap_init(void)
 		return err;
 
 	_busy_wq = create_singlethread_workqueue("l2cap");
-	if (!_busy_wq)
-		goto error;
+	if (!_busy_wq) {
+		proto_unregister(&l2cap_proto);
+		return -ENOMEM;
+	}
 
 	err = bt_sock_register(BTPROTO_L2CAP, &l2cap_sock_family_ops);
 	if (err < 0) {
@@ -4900,6 +4902,7 @@ static int __init l2cap_init(void)
 	return 0;
 
 error:
+	destroy_workqueue(_busy_wq);
 	proto_unregister(&l2cap_proto);
 	return err;
 }
-- 
1.7.0.4


^ permalink raw reply related

* Re: [PATCH 1/5] Implements primary service search when creating a device
From: Johan Hedberg @ 2010-11-29 17:21 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth
In-Reply-To: <1290565847-17382-1-git-send-email-claudio.takahasi@openbossa.org>

Hi Claudio,

On Wed, Nov 24, 2010, Claudio Takahasi wrote:
> Discover primary services implemented inside the device entity to allow
> proper integration of attribute plugin. Implements a single entry point
> to the attribute plugin no matter the transport(BR/EDR or LE), the device
> probe callback is called for both types.
> 
> Add a new function to discover all primary services without additional
> calls to fetch the remaining primary services, sub-procedure iterations
> is handled inside this function.
> 
> The next action are: clean the attribute client removing implicity service
> and characteristics discovery, issue the Discover Primary Service based on
> the remote properties and fetch the characteristic on demand.
> ---
>  attrib/manager.c  |   27 +++-------
>  src/device.c      |  106 +++++++++++++++++++++++++++++++-------
>  src/glib-helper.c |  147 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  src/glib-helper.h |    5 ++
>  4 files changed, 246 insertions(+), 39 deletions(-)

All five patches have been pushed upstream. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH] Attrib server should truncate attribute value to pdu length
From: Johan Hedberg @ 2010-11-29 17:25 UTC (permalink / raw)
  To: Sheldon Demario; +Cc: linux-bluetooth
In-Reply-To: <1291034662-6138-1-git-send-email-sheldon.demario@openbossa.org>

Hi Sheldon,

On Mon, Nov 29, 2010, Sheldon Demario wrote:
> When the size of attribute value is greater than pdu size, it should be
> truncated to the pdu length - 2
> ---
>  attrib/att.c |   15 +++++++--------
>  1 files changed, 7 insertions(+), 8 deletions(-)

Pushed upstream. Thanks.

Johan

^ permalink raw reply

* [PATCH v2] Emit Connect signal for LE capable devices
From: Sheldon Demario @ 2010-11-29 18:36 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sheldon Demario
In-Reply-To: <20101129125208.GA15399@jh-x301>

---
 plugins/hciops.c |   61 +++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/plugins/hciops.c b/plugins/hciops.c
index e5678d7..c446fd0 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -1266,6 +1266,42 @@ static inline void conn_complete(int index, void *ptr)
 		free(str);
 }
 
+static inline void le_conn_complete(int index, void *ptr)
+{
+	evt_le_connection_complete *evt = ptr;
+	char filename[PATH_MAX];
+	char local_addr[18], peer_addr[18], *str;
+	struct btd_adapter *adapter;
+
+	adapter = manager_find_adapter(&BDADDR(index));
+	if (!adapter) {
+		error("Unable to find matching adapter");
+		return;
+	}
+
+	btd_event_conn_complete(&BDADDR(index), evt->status,
+					btohs(evt->handle), &evt->peer_bdaddr);
+
+	if (evt->status)
+		return;
+
+	update_lastused(&BDADDR(index), &evt->peer_bdaddr);
+
+	/* check if the remote version needs be requested */
+	ba2str(&BDADDR(index), local_addr);
+	ba2str(&evt->peer_bdaddr, peer_addr);
+
+	create_name(filename, sizeof(filename), STORAGEDIR, local_addr,
+							"manufacturers");
+
+	str = textfile_get(filename, peer_addr);
+	if (!str)
+		btd_adapter_get_remote_version(adapter, btohs(evt->handle),
+									TRUE);
+	else
+		free(str);
+}
+
 static inline void disconn_complete(int index, void *ptr)
 {
 	evt_disconn_complete *evt = ptr;
@@ -1306,17 +1342,11 @@ static inline void conn_request(int index, void *ptr)
 	btd_event_remote_class(&BDADDR(index), &evt->bdaddr, class);
 }
 
-static inline void le_metaevent(int index, void *ptr)
+static inline void le_advertising_report(int index, evt_le_meta_event *meta)
 {
-	evt_le_meta_event *meta = ptr;
 	le_advertising_info *info;
 	uint8_t num, i;
 
-	DBG("hci%d LE Meta Event %u", index, meta->subevent);
-
-	if (meta->subevent != EVT_LE_ADVERTISING_REPORT)
-		return;
-
 	num = meta->data[0];
 	info = (le_advertising_info *) (meta->data + 1);
 
@@ -1326,6 +1356,23 @@ static inline void le_metaevent(int index, void *ptr)
 	}
 }
 
+static inline void le_metaevent(int index, void *ptr)
+{
+	evt_le_meta_event *meta = ptr;
+
+	DBG("hci%d LE Meta Event %u", index, meta->subevent);
+
+	switch (meta->subevent) {
+	case EVT_LE_ADVERTISING_REPORT:
+		le_advertising_report(index, meta);
+		break;
+
+	case EVT_LE_CONN_COMPLETE:
+		le_conn_complete(index, meta->data);
+		break;
+	}
+}
+
 static void stop_hci_dev(int index)
 {
 	GIOChannel *chan = CHANNEL(index);
-- 
1.7.3.2


^ permalink raw reply related

* Re: [PATCH v2] Emit Connect signal for LE capable devices
From: Johan Hedberg @ 2010-11-29 20:22 UTC (permalink / raw)
  To: Sheldon Demario; +Cc: linux-bluetooth
In-Reply-To: <1291055789-3733-1-git-send-email-sheldon.demario@openbossa.org>

Hi Sheldon,

On Mon, Nov 29, 2010, Sheldon Demario wrote:
> ---
>  plugins/hciops.c |   61 +++++++++++++++++++++++++++++++++++++++++++++++------
>  1 files changed, 54 insertions(+), 7 deletions(-)

Pushed upstream. Thanks.

Johan

^ permalink raw reply

* Re: sdptool hanging remote
From: Grahame Jordan @ 2010-11-29 21:19 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <AANLkTi=Yzpo-CuhgdOuD1T8ByAV=4sse93XZt55eo+b7@mail.gmail.com>


On 25/11/10 09:55, Vinicius Gomes wrote:
>>     handle 256 packets 1
>> 2000-01-02 07:35:12.430756>  ACL data: handle 256 flags 0x02 dlen 12
>>     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0041
>> 2000-01-02 07:35:12.430979<  ACL data: handle 256 flags 0x02 dlen 12
>>     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0041
>> 2000-01-02 07:35:12.440583>  HCI Event: Number of Completed Packets (0x13)
>> plen 5
>>     handle 256 packets 1
>> 2000-01-02 07:35:12.460651>  ACL data: ha
>> # Hang here
>>
>> # Resumed after about 10 seconds
>> ndle 256 flags 0x02 dlen 12
>>     L2CAP(s): Connect req: psm 1 scid 0x0042
>> 2000-01-02 07:35:12.460904<  ACL data: handle 256 flags 0x02 dlen 16
>>     L2CAP(s)i2c: error: timeout
>>
> This ("i2c: error: timeout") looks strange. But could be unrelated.

Mmmm? I have another problem that the whole thing locks up usually when 
BT disconnects.
There is a daemon that is using the I2C bus. When it is not running the 
lockup issue goes away?
Not sure if it is I2C causing the lockup or not. It just locks up 
silently and sometimes gets a dump from SOFT_LOCK.
Anyway weather the daemon is running or not we still get this ping of 
death from sdptool.

> Another thing that could be interesting to have is the hcidump of an
> attempt using Ubuntu 8.04 (that you said that had no problems).

Please see below

> The output of "sdptool browse local", from the gumstix would be also useful.

root@test:~# sdptool browse local
Browsing FF:FF:FF:00:00:00 ...
Service Name: Group Network Service
Service RecHandle: 0x10000
Service Class ID List:
    "PAN Group Network" (0x1117)
Protocol Descriptor List:
    "L2CAP" (0x0100)
      PSM: 15
    "BNEP" (0x000f)
      Version: 0x0100
Profile Descriptor List:
    "PAN Group Network" (0x1117)
      Version: 0x0100

Thanks
>> 2000-01-02 07:35:34.250696>  HCI Event: Number of Completed Packets (0x13)
>> plen 5
>>     handle 256 packets 1
>> 2000-01-02 07:35:34.250733>  ACL data: handle 256 flags 0x02 dlen 12
>>     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0041
>> 2000-01-02 07:35:34.250962<  ACL data: handle 256 flags 0x02 dlen 12
>>     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0041
>> 2000-01-02
>> # Hang here
>>
>> # Pressed CTL-C on remote "sdptool records 00:80:37:2F:5A:77"
>> 07:35:34.260581>  HCI Event: Number of Completed Packets (0x13) plen 5
>>     handle 256 packets 1
>> 2000-01-02 07:35:34.280679>  ACL data: handle 256 flags 0x02 dlen 12
>>     L2CAP(s): Connect req: psm 1 scid 0x0042
>> 2000-01-02 07:35:34.280930<  ACL data: handle 256 flags 0x02 dlen 16
>>     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 0 status 0
>>       Connection successful
>> 2000-01-02 07:35:34.300522>  HCI Event: Number of Completed Packets (0x13)
>> plen 5
>>     handle 256 packets 1
>>
>> ...
>>
>>
>> Thanks
>>
>> Grahame Jordan
>>
>>
>> On 24/11/10 04:51, Vinicius Costa Gomes wrote:
>>
>>> On 16:37 Tue 23 Nov     , Grahame Jordan wrote:
>>>
>>>
>>>> Hi,
>>>>
>>>> I am using bluez-4.77 on a Gumstix Verdex kernel 2.4.32 patch 21
>>>>
>>>> When I run:
>>>> sdptool records 00:80:37:2F:06:08"
>>>> from the Workstation Ubuntu 10.04 Bluez-4.6? to the Gumstix the Gumstix
>>>> hangs.
>>>> It does not hang completely but is very busy. It hangs for about 20
>>>> seconds and then releases for about 1 second
>>>> before it locks up again.
>>>>
>>>>
>>> I couldn't find anything that could solve this kind of problem in the logs
>>> between 4.6 and the git head. But anyway, could you give a try to 4.80, or
>>> better yet, the git head[1]? and see if the problem still happens?
>>>
>>>
>>>
>>>> I have tried this on several different Gumstix with the same issue.
>>>>
>>>> Changing workstations from Ubuntu 10.04 to Ubuntu 8.04 does make a
>>>> difference.
>>>>   From Ubuntu 8.04 there seems to be no problem. blue-utils 3.26?
>>>>
>>>>
>>>>
>>> A really helpful piece of information that you could provide is the
>>> hcidump[2]
>>> logs of both cases, just be sure to give hcidump the options "-V" (verbose
>>> output) and "-t" (timestamps, to see where the hang happens).
>>>
>>>
>>>
>>>> Appreciate help
>>>>
>>>>
>>>> Thanks
>>>>
>>>> Grahame Jordan
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe
>>>> linux-bluetooth" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>>
>>>>
>>> Cheers,
>>>
>>>
>>
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
>> in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>
>
> Cheers,
>

# sdptool records from Ubuntu 8.04
HCI sniffer - Bluetooth packet analyzer ver 1.42
device: hci0 snap_len: 1028 filter: 0xffffffff
 > ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo rsp: dlen 44
 > ACL data: handle 256 flags 0x02 dlen 67
     L2CAP(d): cid 0x0040 len 63 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 67
     L2CAP(d): cid 0x0040 len 63 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > ACL data: handle 256 flags 0x02 dlen 229
     L2CAP(d): cid 0x0040 len 225 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
< ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo req: dlen 44
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo rsp: dlen 44
< ACL data: handle 256 flags 0x02 dlen 269
     L2CAP(d): cid 0x0040 len 265 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0000 scid 0x0041 result 4 status 0
       Connection refused - no resources available
 > HCI Event: Number of Completed Packets (0x13) plen 5
< ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo req: dlen 44
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo rsp: dlen 44
 > ACL data: handle 256 flags 0x02 dlen 67
     L2CAP(d): cid 0x0040 len 63 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 67
     L2CAP(d): cid 0x0040 len 63 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > ACL data: handle 256 flags 0x02 dlen 229
     L2CAP(d): cid 0x0040 len 225 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
< ACL data: handle 256 flags 0x02 dlen 269
     L2CAP(d): cid 0x0040 len 265 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0000 scid 0x0041 result 4 status 0
       Connection refused - no resources available
 > HCI Event: Number of Completed Packets (0x13) plen 5
< ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo req: dlen 44
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo rsp: dlen 44
 > ACL data: handle 256 flags 0x02 dlen 67
     L2CAP(d): cid 0x0040 len 63 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 67
     L2CAP(d): cid 0x0040 len 63 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > ACL data: handle 256 flags 0x02 dlen 229
     L2CAP(d): cid 0x0040 len 225 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0000 scid 0x0041 result 4 status 0
       Connection refused - no resources available
 > HCI Event: Number of Completed Packets (0x13) plen 5
< ACL data: handle 256 flags 0x02 dlen 269
     L2CAP(d): cid 0x0040 len 265 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo req: dlen 44
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo rsp: dlen 44
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0041 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x10000
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 98
     L2CAP(d): cid 0x0041 len 94 [psm 1]
         SDP SA Rsp: tid 0x0 len 0x59
           count 86
           aid 0x0000 (SrvRecHndl)
              uint 0x10000
           aid 0x0001 (SrvClassIDList)
              < uuid-16 0x1117 (GN) >
           aid 0x0004 (ProtocolDescList)
              < < uuid-16 0x0100 (L2CAP) uint 0xf > <
              uuid-16 0x000f (BNEP) uint 0x100 > >
           aid 0x0005 (BrwGrpList)
              < uuid-16 0x1002 (PubBrwsGrp) >
           aid 0x0009 (BTProfileDescList)
              < < uuid-16 0x1117 (GN) uint 0x100 > >
           aid 0x0100 (SrvName)
              str "Group Network Service"
           cont 00
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0041
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0042 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0042 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x10001
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0042 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0042
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0041 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x10002
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0041 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0041
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0042
 > ACL data: handle 256 flags 0x02 dlen 67
     L2CAP(d): cid 0x0040 len 63 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 0 status 0
       Connection successful
< ACL data: handle 256 flags 0x02 dlen 67
     L2CAP(d): cid 0x0040 len 63 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0042 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0042 flags 0x00 clen 0
 > ACL data: handle 256 flags 0x02 dlen 229
     L2CAP(d): cid 0x0040 len 225 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x10003
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0042 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0042
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0041 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
< ACL data: handle 256 flags 0x02 dlen 269
     L2CAP(d): cid 0x0040 len 265 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x10004
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0041 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0041
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 0 status 0
       Connection successful
< ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo req: dlen 44
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0042 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0042 flags 0x00 clen 0
 > ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo rsp: dlen 44
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x10005
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0042 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0042
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0041 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x10006
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0041 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0041
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0042 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0042 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x10007
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0042 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0042
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0041 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x10008
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0041 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0041
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0042 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0042 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x10009
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0042 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0042
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0041 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x1000a
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0041 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0041
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0042 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0042 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x1000b
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0042 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0042
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0041 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x1000c
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0041 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0041
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0042 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0042 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x1000d
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0042 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
< ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo req: dlen 44
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0042
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0041 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 52
     L2CAP(s): Echo rsp: dlen 44
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x1000e
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0041 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0041
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0042
 > ACL data: handle 256 flags 0x02 dlen 67
     L2CAP(d): cid 0x0040 len 63 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0042 result 0 status 0
       Connection successful
< ACL data: handle 256 flags 0x02 dlen 67
     L2CAP(d): cid 0x0040 len 63 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0042 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0042 flags 0x00 clen 0
 > ACL data: handle 256 flags 0x02 dlen 229
     L2CAP(d): cid 0x0040 len 225 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x1000f
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00
< ACL data: handle 256 flags 0x02 dlen 11
     L2CAP(d): cid 0x0042 len 7 [psm 1]
         SDP Error Rsp: tid 0x0 len 0x2
           code 0x2 info none
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn req: dcid 0x0041 scid 0x0042
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0042
< ACL data: handle 256 flags 0x02 dlen 16
     L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0041 result 0 status 0
       Connection successful
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
< ACL data: handle 256 flags 0x02 dlen 269
     L2CAP(d): cid 0x0040 len 265 [psm 0]
< ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
< ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
< ACL data: handle 256 flags 0x02 dlen 12
     L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 0
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > HCI Event: Number of Completed Packets (0x13) plen 5
 > ACL data: handle 256 flags 0x02 dlen 59
     L2CAP(d): cid 0x0040 len 55 [psm 0]
 > ACL data: handle 256 flags 0x02 dlen 18
     L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
       MTU 672
 > ACL data: handle 256 flags 0x02 dlen 23
     L2CAP(d): cid 0x0041 len 19 [psm 1]
         SDP SA Req: tid 0x0 len 0xe
           handle 0x10010
           max 65535
           aid(s) 0x0000 - 0xffff
           cont 00



^ permalink raw reply

* Re: [PATCH v3] Bluetooth: Fix error handling for l2cap_init()
From: Gustavo F. Padovan @ 2010-11-30  1:05 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1291047350-32126-1-git-send-email-anderson.lizardo@openbossa.org>

Hi Anderson,

* Anderson Lizardo <anderson.lizardo@openbossa.org> [2010-11-29 12:15:50 -0400]:

> create_singlethread_workqueue() may fail with errors such as -ENOMEM. If
> this happens, the return value is not set to a negative value and the
> module load will succeed. It will then crash on module unload because of
> a destroy_workqueue() call on a NULL pointer.
> 
> Additionally, the _busy_wq workqueue is not being destroyed if any
> errors happen on l2cap_init().
> 
> Signed-off-by: Anderson Lizardo <anderson.lizardo@openbossa.org>

Patch has been applied, thanks a lot.

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply

* Re: [RFC 2/4] Bluetooth: clean up rfcomm code
From: Gustavo F. Padovan @ 2010-11-30  1:09 UTC (permalink / raw)
  To: Emeltchenko Andrei; +Cc: linux-bluetooth, marcel
In-Reply-To: <1290784965-4508-3-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

* Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com> [2010-11-26 17:22:43 +0200]:

> From: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
> 
> Remove extra spaces, assignments in if statement, zeroing static
> variables.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
> ---
>  include/net/bluetooth/rfcomm.h |   18 +++++++++---------
>  net/bluetooth/rfcomm/core.c    |    8 ++++----
>  net/bluetooth/rfcomm/sock.c    |    5 +++--
>  net/bluetooth/rfcomm/tty.c     |   28 ++++++++++++++++------------
>  4 files changed, 32 insertions(+), 27 deletions(-)
> 
> diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
> index 71047bc..6eac4a7 100644
> --- a/include/net/bluetooth/rfcomm.h
> +++ b/include/net/bluetooth/rfcomm.h
> @@ -1,5 +1,5 @@
> -/* 
> -   RFCOMM implementation for Linux Bluetooth stack (BlueZ).
> +/*
> +   RFCOMM implementation for Linux Bluetooth stack (BlueZ)
>     Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
>     Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org>
>  
> @@ -11,13 +11,13 @@
>     OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
>     IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
> -   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 
> -   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 
> -   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 
> +   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
> +   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> +   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
>     OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>  
> -   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 
> -   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 
> +   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
> +   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
>     SOFTWARE IS DISCLAIMED.

Marcel refused a patch from me in the past because its was touching legal
stuff, so or you remove these changes for your patches or wait for
Marcel's comments here.

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply

* Re: [RFC] Interface to set LE connection parameters
From: Gustavo F. Padovan @ 2010-11-30  1:37 UTC (permalink / raw)
  To: Ville Tervo; +Cc: ext tim.howes@accenture.com, linux-bluetooth@vger.kernel.org
In-Reply-To: <20101115151739.GD16464@null>

Hi Ville,

* Ville Tervo <ville.tervo@nokia.com> [2010-11-15 17:17:39 +0200]:

> Hi Tim,
> 
> Please stop top posting on this ml.
> 
> On Mon, Nov 15, 2010 at 03:24:29PM +0100, ext tim.howes@accenture.com wrote:
> > Hi Ville,
> > 
> > As you note the different profiles would likely have different connection parameters.  The different profiles may be running on the same LE link (indeed the same L2CAP [fixed] channel).
> > 
> 
> I guess the latency should override power requirements. Low power profile can
> operate on low latency link but low latency profile fails on high latency. Of
> course this gets much more complicated if there are more requirements.
> 
> Are these (latency and power) the only characteristics we need to deal with.
> There might be some also. I'm not too familiar with profile drafts.
> 
> > Do you have a view on how the different profiles - on the same link - would have different requests arbitrated, and where that arbitration would be done?  I'd imagine that the API towards the profiles should be of the abstract form - such as you mention (eg BT_LE_LOW_LAT).  This would make it easier to arbitrate the different requests, as compared to if the profiles see an API of the "numerical" form (eg interval = N ms).  I guess the arbitration could happen in user or kernel space; as long as there is something with singleton-like semantics to do it.
> > 
> 
> I think I need to get more details from profile specs and try to find out the
> requirements from them.
> 
> Right now I'm trying to find out what would be the right interface from kernel
> to user space. 

If you go with the abstraction in userspace (inside bluetoothd) will be easy to
create usage profiles on top of it or even do a fine tune of the parameters
for a specific usage. New profiles should be created in the future and we
can't foresee its requirements. And I'm seeing that we will have many
many different use cases for LE in the future.  It can be hard to extend
the API if we do the abstraction in the kernel because we can't break
the API that we are going to create.

We also have to check if we really need all the parameters you are
proposing, maybe we can simplify that API. What about you send a e-mail
explaining why we should add each parameter to the API?

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply

* Re: [PATCH] ath3k: reduce memory usage
From: Gustavo F. Padovan @ 2010-11-30  1:52 UTC (permalink / raw)
  To: Alexander Holler
  Cc: Marcel Holtmann, Alicke Xu, Luis R. Rodriguez, Vikram Kandukuri,
	linux-bluetooth
In-Reply-To: <1290456541-3812-1-git-send-email-holler@ahsoftware.de>

Hi Alexander,

* Alexander Holler <holler@ahsoftware.de> [2010-11-22 21:09:01 +0100]:

> There is no need to hold the firmware in memory.
> 
> Signed-off-by: Alexander Holler <holler@ahsoftware.de>
> ---
>  drivers/bluetooth/ath3k.c |   75 ++++++++++++---------------------------------
>  1 files changed, 20 insertions(+), 55 deletions(-)
> 
> diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
> index 128cae4..81cd1ed 100644
> --- a/drivers/bluetooth/ath3k.c
> +++ b/drivers/bluetooth/ath3k.c
> @@ -43,46 +43,40 @@ MODULE_DEVICE_TABLE(usb, ath3k_table);
>  #define USB_REQ_DFU_DNLOAD	1
>  #define BULK_SIZE		4096
>  
> -struct ath3k_data {
> -	struct usb_device *udev;
> -	u8 *fw_data;
> -	u32 fw_size;
> -	u32 fw_sent;
> -};
> -
> -static int ath3k_load_firmware(struct ath3k_data *data,
> -				unsigned char *firmware,
> -				int count)
> +static int ath3k_load_firmware(struct usb_device *udev,
> +				const struct firmware *firmware)
>  {
>  	u8 *send_buf;
>  	int err, pipe, len, size, sent = 0;
> +	int count = firmware->size;
>  
> -	BT_DBG("ath3k %p udev %p", data, data->udev);
> +	BT_DBG("udev %p", udev);
>  
> -	pipe = usb_sndctrlpipe(data->udev, 0);
> +	pipe = usb_sndctrlpipe(udev, 0);
>  
> -	if ((usb_control_msg(data->udev, pipe,
> +	send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC);
> +	if (!send_buf) {
> +		BT_ERR("Can't allocate memory chunk for firmware");
> +		return -ENOMEM;
> +	}
> +
> +	memcpy(send_buf, firmware->data, 20);
> +	if ((err = usb_control_msg(udev, pipe,
>  				USB_REQ_DFU_DNLOAD,
>  				USB_TYPE_VENDOR, 0, 0,
> -				firmware, 20, USB_CTRL_SET_TIMEOUT)) < 0) {
> +				send_buf, 20, USB_CTRL_SET_TIMEOUT)) < 0) {
>  		BT_ERR("Can't change to loading configuration err");
> -		return -EBUSY;
> +		goto error;
>  	}
>  	sent += 20;
>  	count -= 20;

Patch looks good to me,  but I have a question here: what's 20 here? I
didn't figured out.

Vikram, what's your opinion on this patch? Can you ack/nack it?

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply

* Re: wi2wi bluecore4
From: Brad Midgley @ 2010-11-30  5:24 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <AANLkTi=VPn1k=kLdo7QbM4epc88fdcW2XsbLyFeYt9y4@mail.gmail.com>

Hey

I think I am a little closer, just wanted to see if anyone has any ideas.

I rebuilt bccmd so it would connect at 115k instead of 38k. Not sure
why it's hardcoded if the chip cares (this chip refuses to respond at
38k). In any case, now bccmd can set and reset the chip apparently:

# cat pskey.psr
// PSKEY_UART_BAUDRATE
&01be = 0ebf
// PSKEY_SCO_MAPPING
&01ab = 0
# bccmd.115 -t H4 -d /dev/ttyS1 psload -r pskey.psr
Loading PSKEY_UART_BAUDRATE ... done
Loading PSKEY_HOSTIO_MAP_SCO_PCM ... done
#

But the hciattach still fails with "Initialization timed out.". The
chip returns a single byte...

# strace -s 64 hciattach ttyS1 csr 921600 noflow
...
open("/dev/ttyS1", O_RDWR|O_NOCTTY)     = 3
ioctl(3, TCFLSH, 0x2)                   = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon
-echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon
-echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon
-echo ...}) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
write(3, "\1\0\374\27\302\0\0\t\0\0\0\31(\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 27) = 27
read(3, "\374", 1)                      = 1
read(3, 0xbed819dc, 1)                  = ? ERESTARTSYS (To be restarted)
--- SIGALRM (Alarm clock) @ 0 (0) ---

What is the chip saying to us when we read \374? Why is hciattach
initializing at 115k when i told it to use 921k? So I tried setting
the init speed too:

# strace -s 64 hciattach -s 921600 ttyS1 csr 921600 noflow
...
open("/dev/ttyS1", O_RDWR|O_NOCTTY)     = 3
ioctl(3, TCFLSH, 0x2)                   = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon
-echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon
-echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B921600 -opost -isig -icanon
-echo ...}) = 0
ioctl(3, TCFLSH, 0x2)                   = 0
write(3, "\1\0\374\27\302\0\0\t\0\0\0\31(\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 27) = 27
read(3, 0xbeebf9cc, 1)                  = ? ERESTARTSYS (To be restarted)
--- SIGALRM (Alarm clock) @ 0 (0) ---

this time it didn't even get one junk byte. Is there anything else I can check?

Brad

^ permalink raw reply

* Re: [PATCH] Bluetooth: Add new PID for Atheros 3011
From: Bala Shanmugam @ 2010-11-30  5:59 UTC (permalink / raw)
  To: Alexander Holler
  Cc: Shanmugamkamatchi Balashanmugam, Marcel Holtmann,
	linux-bluetooth@vger.kernel.org
In-Reply-To: <4CF38E4B.9070807@ahsoftware.de>

Alexander Holler wrote:
> Am 29.11.2010 07:09, schrieb Bala Shanmugam:
>
>   
>> This patch is for Atheros 3011 with sflash firmware.
>> This device gets identified Generic bluetooth USB device when plugged in.
>> We are blacklisting 3002 in btusb to load actual firmware in ath3k.
>> Latest firmware comes up with PID 3005 and not 3002.
>>     
>
> Thanks for the explanation. Is there a place in the web where the latest 
> firmware could be found?
>
> The only place I've found to look at was the linux-firmware repository 
> and that repo currently has no new firmware for the ath3k.
>
> Btw., did you have a look at the small patch for ath3k I posted lately:
>
> http://marc.info/?l=linux-bluetooth&m=129045856314243
>
> This avoids storing the firmware in RAM (I don't see a reason to do 
> that, it is never used again) and simplifies the small driver a bit.
>
> Regards,
>
> Alexander
>   
Alex,

I am waiting for official release for the firmware and will upload the 
same today or tomorrow.
I had look at your patch its good.  I did these changes few months 
before and it didn't work for me.
I couldn't find time to debug it that time.
Will test it now and update you.

Regards,
Bala.

^ permalink raw reply

* Re: [PATCH v7] Bluetooth: btwilink driver
From: Pavan Savoy @ 2010-11-30  7:29 UTC (permalink / raw)
  To: padovan, marcel; +Cc: linux-bluetooth, linux-kernel, Pavan Savoy
In-Reply-To: <1290763257-12382-1-git-send-email-pavan_savoy@ti.com>

On Fri, Nov 26, 2010 at 2:50 PM,  <pavan_savoy@ti.com> wrote:
> From: Pavan Savoy <pavan_savoy@ti.com>
>
Marcel, Gustavo,

Please find some time to comment and also answer some of the
concerns I have below,

Thanks & Regards,
Pavan Savoy.

> comments attended to from v5 and v6,
>
> 1. Inside ti_st_open, I previously only checked for EINPROGRESS & EPERM,
> Now I handle for EINPROGRESS - which is not really an error and
> return during all other error cases.
>
> 2. _write is still a function pointer and not an exported function, I
> need to change the underlying driver's code for this.
> However, previous lkml comments on the underlying driver's code
> suggested it to be kept as a function pointer and not EXPORT.
> Gustavo, Marcel - Please comment on this.
> Is this absolutely required? If so why?
>
> 3. test_and_set_bit of HCI_RUNNING is done at beginning of
> ti_st_open, and did not see issues during firmware download.
> However ideally I would still like to set HCI_RUNNING once the firmware
> download is done, because I don't want to allow a _send_frame during
> firmware download - Marcel, Gustavo - Please comment.
>
> 4. test_and_clear of HCI_RUNNING now done @ beginning of close.
>
> 5. EAGAIN on failure of st_write is to suggest to try and write again.
> I have never this happen - However only if UART goes bad this case may
> occur.
>
> 6. ti_st_tx_complete is very similar to hci_ldisc's tx_complete - in
> fact the code is pretty much borrowed from there.
> Marcel, Gustavo - Please suggest where should it be done? If not here.
>
> 7. comments cleaned-up + hst memory leak fixed when hci_alloc_dev fails.
>
> 8. platform_driver registration inside module_init now is similar to
> other drivers.
>
> 9. Dan Carpenter's comments on leaking hst memory on failed
> hci_register_dev and empty space after quotes in debug statements
> fixed.
>
> Thanks for the comments...
> Sorry, for previously not being very clear on which comments were
> handled and which were not.
>
> -- patch description --
>
> This is the bluetooth protocol driver for the TI WiLink7 chipsets.
> Texas Instrument's WiLink chipsets combine wireless technologies
> like BT, FM, GPS and WLAN onto a single chip.
>
> This Bluetooth driver works on top of the TI_ST shared transport
> line discipline driver which also allows other drivers like
> FM V4L2 and GPS character driver to make use of the same UART interface.
>
> Kconfig and Makefile modifications to enable the Bluetooth
> driver for Texas Instrument's WiLink 7 chipset.
>
> Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
> ---
> =C2=A0drivers/bluetooth/Kconfig =C2=A0 =C2=A0| =C2=A0 10 ++
> =C2=A0drivers/bluetooth/Makefile =C2=A0 | =C2=A0 =C2=A01 +
> =C2=A0drivers/bluetooth/btwilink.c | =C2=A0363 ++++++++++++++++++++++++++=
++++++++++++++++
> =C2=A03 files changed, 374 insertions(+), 0 deletions(-)
> =C2=A0create mode 100644 drivers/bluetooth/btwilink.c
>
> diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
> index 02deef4..8e0de9a 100644
> --- a/drivers/bluetooth/Kconfig
> +++ b/drivers/bluetooth/Kconfig
> @@ -219,4 +219,14 @@ config BT_ATH3K
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Say Y here to compile support for "Athe=
ros firmware download driver"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0into the kernel or say M to compile it =
as module (ath3k).
>
> +config BT_WILINK
> + =C2=A0 =C2=A0 =C2=A0 tristate "Texas Instruments WiLink7 driver"
> + =C2=A0 =C2=A0 =C2=A0 depends on TI_ST
> + =C2=A0 =C2=A0 =C2=A0 help
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 This enables the Bluetooth driver for Texas=
 Instrument's BT/FM/GPS
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 combo devices. This makes use of shared tra=
nsport line discipline
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 core driver to communicate with the BT core=
 of the combo chip.
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 Say Y here to compile support for Texas Ins=
trument's WiLink7 driver
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 into the kernel or say M to compile it as m=
odule.
> =C2=A0endmenu
> diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
> index 71bdf13..f4460f4 100644
> --- a/drivers/bluetooth/Makefile
> +++ b/drivers/bluetooth/Makefile
> @@ -18,6 +18,7 @@ obj-$(CONFIG_BT_HCIBTSDIO) =C2=A0 =C2=A0+=3D btsdio.o
> =C2=A0obj-$(CONFIG_BT_ATH3K) =C2=A0 =C2=A0 =C2=A0 =C2=A0 +=3D ath3k.o
> =C2=A0obj-$(CONFIG_BT_MRVL) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+=3D btmrvl=
.o
> =C2=A0obj-$(CONFIG_BT_MRVL_SDIO) =C2=A0 =C2=A0 +=3D btmrvl_sdio.o
> +obj-$(CONFIG_BT_WILINK) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0+=3D btwilink.o
>
> =C2=A0btmrvl-y =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 :=3D btmrvl_main.o
> =C2=A0btmrvl-$(CONFIG_DEBUG_FS) =C2=A0 =C2=A0 =C2=A0+=3D btmrvl_debugfs.o
> diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
> new file mode 100644
> index 0000000..71e69f8
> --- /dev/null
> +++ b/drivers/bluetooth/btwilink.c
> @@ -0,0 +1,363 @@
> +/*
> + * =C2=A0Texas Instrument's Bluetooth Driver For Shared Transport.
> + *
> + * =C2=A0Bluetooth Driver acts as interface between HCI core and
> + * =C2=A0TI Shared Transport Layer.
> + *
> + * =C2=A0Copyright (C) 2009-2010 Texas Instruments
> + * =C2=A0Author: Raja Mani <raja_mani@ti.com>
> + * =C2=A0 =C2=A0 Pavan Savoy <pavan_savoy@ti.com>
> + *
> + * =C2=A0This program is free software; you can redistribute it and/or m=
odify
> + * =C2=A0it under the terms of the GNU General Public License version 2 =
as
> + * =C2=A0published by the Free Software Foundation.
> + *
> + * =C2=A0This program is distributed in the hope that it will be useful,
> + * =C2=A0but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =C2=A0See =
the
> + * =C2=A0GNU General Public License for more details.
> + *
> + * =C2=A0You should have received a copy of the GNU General Public Licen=
se
> + * =C2=A0along with this program; if not, write to the Free Software
> + * =C2=A0Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA =C2=A0=
02111-1307 =C2=A0USA
> + *
> + */
> +
> +#include <linux/platform_device.h>
> +#include <net/bluetooth/bluetooth.h>
> +#include <net/bluetooth/hci_core.h>
> +
> +#include <linux/ti_wilink_st.h>
> +
> +/* Bluetooth Driver Version */
> +#define VERSION =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "1.0"
> +
> +/* Number of seconds to wait for registration completion
> + * when ST returns PENDING status.
> + */
> +#define BT_REGISTER_TIMEOUT =C2=A0 6000 =C2=A0 =C2=A0 /* 6 sec */
> +
> +/**
> + * struct ti_st - driver operation structure
> + * @hdev: hci device pointer which binds to bt driver
> + * @reg_status: ST registration callback status
> + * @st_write: write function provided by the ST driver
> + * =C2=A0 =C2=A0 to be used by the driver during send_frame.
> + * @wait_reg_completion - completion sync between ti_st_open
> + * =C2=A0 =C2=A0 and ti_st_registration_completion_cb.
> + */
> +struct ti_st {
> + =C2=A0 =C2=A0 =C2=A0 struct hci_dev *hdev;
> + =C2=A0 =C2=A0 =C2=A0 char reg_status;
> + =C2=A0 =C2=A0 =C2=A0 long (*st_write) (struct sk_buff *);
> + =C2=A0 =C2=A0 =C2=A0 struct completion wait_reg_completion;
> +};
> +
> +/* Increments HCI counters based on pocket ID (cmd,acl,sco) */
> +static inline void ti_st_tx_complete(struct ti_st *hst, int pkt_type)
> +{
> + =C2=A0 =C2=A0 =C2=A0 struct hci_dev *hdev =3D hst->hdev;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Update HCI stat counters */
> + =C2=A0 =C2=A0 =C2=A0 switch (pkt_type) {
> + =C2=A0 =C2=A0 =C2=A0 case HCI_COMMAND_PKT:
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hdev->stat.cmd_tx++;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;
> +
> + =C2=A0 =C2=A0 =C2=A0 case HCI_ACLDATA_PKT:
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hdev->stat.acl_tx++;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;
> +
> + =C2=A0 =C2=A0 =C2=A0 case HCI_SCODATA_PKT:
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hdev->stat.sco_tx++;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;
> + =C2=A0 =C2=A0 =C2=A0 }
> +}
> +
> +/* ------- Interfaces to Shared Transport ------ */
> +
> +/* Called by ST layer to indicate protocol registration completion
> + * status.ti_st_open() function will wait for signal from this
> + * API when st_register() function returns ST_PENDING.
> + */
> +static void st_registration_completion_cb(void *priv_data, char data)
> +{
> + =C2=A0 =C2=A0 =C2=A0 struct ti_st *lhst =3D priv_data;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Save registration status for use in ti_st_open(=
) */
> + =C2=A0 =C2=A0 =C2=A0 lhst->reg_status =3D data;
> + =C2=A0 =C2=A0 =C2=A0 /* complete the wait in ti_st_open() */
> + =C2=A0 =C2=A0 =C2=A0 complete(&lhst->wait_reg_completion);
> +}
> +
> +/* Called by Shared Transport layer when receive data is
> + * available */
> +static long st_receive(void *priv_data, struct sk_buff *skb)
> +{
> + =C2=A0 =C2=A0 =C2=A0 struct ti_st *lhst =3D priv_data;
> + =C2=A0 =C2=A0 =C2=A0 int err;
> +
> + =C2=A0 =C2=A0 =C2=A0 if (!skb)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EFAULT;
> +
> + =C2=A0 =C2=A0 =C2=A0 if (!lhst) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfree_skb(skb);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EFAULT;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 skb->dev =3D (void *) lhst->hdev;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Forward skb to HCI core layer */
> + =C2=A0 =C2=A0 =C2=A0 err =3D hci_recv_frame(skb);
> + =C2=A0 =C2=A0 =C2=A0 if (err < 0) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("Unable to push=
 skb to HCI core(%d)", err);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return err;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 lhst->hdev->stat.byte_rx +=3D skb->len;
> +
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +}
> +
> +/* ------- Interfaces to HCI layer ------ */
> +/* protocol structure registered with shared transport */
> +static struct st_proto_s ti_st_proto =3D {
> + =C2=A0 =C2=A0 =C2=A0 .type =3D ST_BT,
> + =C2=A0 =C2=A0 =C2=A0 .recv =3D st_receive,
> + =C2=A0 =C2=A0 =C2=A0 .reg_complete_cb =3D st_registration_completion_cb=
,
> +};
> +
> +/* Called from HCI core to initialize the device */
> +static int ti_st_open(struct hci_dev *hdev)
> +{
> + =C2=A0 =C2=A0 =C2=A0 unsigned long timeleft;
> + =C2=A0 =C2=A0 =C2=A0 struct ti_st *hst;
> + =C2=A0 =C2=A0 =C2=A0 int err;
> +
> + =C2=A0 =C2=A0 =C2=A0 BT_DBG("%s %p", hdev->name, hdev);
> + =C2=A0 =C2=A0 =C2=A0 if (test_and_set_bit(HCI_RUNNING, &hdev->flags)) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("btwilink alrea=
dy opened");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EBUSY;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 /* provide contexts for callbacks from ST */
> + =C2=A0 =C2=A0 =C2=A0 hst =3D hdev->driver_data;
> + =C2=A0 =C2=A0 =C2=A0 ti_st_proto.priv_data =3D hst;
> +
> + =C2=A0 =C2=A0 =C2=A0 err =3D st_register(&ti_st_proto);
> + =C2=A0 =C2=A0 =C2=A0 if (err =3D=3D -EINPROGRESS) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* ST is busy with eit=
her protocol registration or firmware
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* download.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Prepare wait-for-co=
mpletion handler data structures.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 init_completion(&hst->=
wait_reg_completion);
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Reset ST registrati=
on callback status flag , this value
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* will be update=
d in ti_st_registration_completion_cb()
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* function whene=
ver it called from ST driver.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hst->reg_status =3D -E=
INPROGRESS;
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_DBG("waiting for re=
gistration completion signal from ST");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 timeleft =3D wait_for_=
completion_timeout
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 (&hst->wait_reg_completion,
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0msecs_to_jiffies(BT_REGISTER_TIMEOUT));
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!timeleft) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 clear_bit(HCI_RUNNING, &hdev->flags);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 BT_ERR("Timeout(%d sec),didn't get reg "
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "completion =
signal from ST",
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_REGISTER_=
TIMEOUT / 1000);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 return -ETIMEDOUT;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Is ST registration =
callback called with ERROR status? */
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (hst->reg_status !=
=3D 0) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 clear_bit(HCI_RUNNING, &hdev->flags);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 BT_ERR("ST registration completed with invalid "
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "status %d",=
 hst->reg_status);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 return -EAGAIN;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 err =3D 0;
> + =C2=A0 =C2=A0 =C2=A0 } else if (err !=3D 0) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 clear_bit(HCI_RUNNING,=
 &hdev->flags);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("st_register fa=
iled %d", err);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return err;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 /* ti_st_proto.write is filled up by the underlyin=
g shared
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* transport driver upon registration
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 hst->st_write =3D ti_st_proto.write;
> + =C2=A0 =C2=A0 =C2=A0 if (!hst->st_write) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("undefined ST w=
rite function");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 clear_bit(HCI_RUNNING,=
 &hdev->flags);
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Undo registration w=
ith ST */
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 err =3D st_unregister(=
ST_BT);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (err)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 BT_ERR("st_unregister() failed with error %d", err);
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hst->st_write =3D NULL=
;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return err;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 return err;
> +}
> +
> +/* Close device */
> +static int ti_st_close(struct hci_dev *hdev)
> +{
> + =C2=A0 =C2=A0 =C2=A0 int err;
> + =C2=A0 =C2=A0 =C2=A0 struct ti_st *hst =3D hdev->driver_data;
> +
> + =C2=A0 =C2=A0 =C2=A0 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)=
)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* continue to unregister from transport */
> + =C2=A0 =C2=A0 =C2=A0 err =3D st_unregister(ST_BT);
> + =C2=A0 =C2=A0 =C2=A0 if (err)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("st_unregister(=
) failed with error %d", err);
> +
> + =C2=A0 =C2=A0 =C2=A0 hst->st_write =3D NULL;
> +
> + =C2=A0 =C2=A0 =C2=A0 return err;
> +}
> +
> +static int ti_st_send_frame(struct sk_buff *skb)
> +{
> + =C2=A0 =C2=A0 =C2=A0 struct hci_dev *hdev;
> + =C2=A0 =C2=A0 =C2=A0 struct ti_st *hst;
> + =C2=A0 =C2=A0 =C2=A0 long len;
> +
> + =C2=A0 =C2=A0 =C2=A0 hdev =3D (struct hci_dev *)skb->dev;
> +
> + =C2=A0 =C2=A0 =C2=A0 if (!test_bit(HCI_RUNNING, &hdev->flags))
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EBUSY;
> +
> + =C2=A0 =C2=A0 =C2=A0 hst =3D hdev->driver_data;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Prepend skb with frame type */
> + =C2=A0 =C2=A0 =C2=A0 memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1)=
;
> +
> + =C2=A0 =C2=A0 =C2=A0 BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb=
)->pkt_type,
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 skb->len);
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Insert skb to shared transport layer's transmit=
 queue.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* Freeing skb memory is taken care in shared=
 transport layer,
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* so don't free skb memory here.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 len =3D hst->st_write(skb);
> + =C2=A0 =C2=A0 =C2=A0 if (len < 0) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfree_skb(skb);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("ST write faile=
d (%ld)", len);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Try Again, would on=
ly fail if UART has gone bad */
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EAGAIN;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 /* ST accepted our skb. So, Go ahead and do rest *=
/
> + =C2=A0 =C2=A0 =C2=A0 hdev->stat.byte_tx +=3D len;
> + =C2=A0 =C2=A0 =C2=A0 ti_st_tx_complete(hst, bt_cb(skb)->pkt_type);
> +
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +}
> +
> +static void ti_st_destruct(struct hci_dev *hdev)
> +{
> + =C2=A0 =C2=A0 =C2=A0 BT_DBG("%s", hdev->name);
> + =C2=A0 =C2=A0 =C2=A0 kfree(hdev->driver_data);
> +}
> +
> +static int bt_ti_probe(struct platform_device *pdev)
> +{
> + =C2=A0 =C2=A0 =C2=A0 static struct ti_st *hst;
> + =C2=A0 =C2=A0 =C2=A0 struct hci_dev *hdev;
> + =C2=A0 =C2=A0 =C2=A0 int err;
> +
> + =C2=A0 =C2=A0 =C2=A0 hst =3D kzalloc(sizeof(struct ti_st), GFP_KERNEL);
> + =C2=A0 =C2=A0 =C2=A0 if (!hst)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENOMEM;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Expose "hciX" device to user space */
> + =C2=A0 =C2=A0 =C2=A0 hdev =3D hci_alloc_dev();
> + =C2=A0 =C2=A0 =C2=A0 if (!hdev) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfree(hst);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENOMEM;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 BT_DBG("hdev %p", hdev);
> +
> + =C2=A0 =C2=A0 =C2=A0 hst->hdev =3D hdev;
> + =C2=A0 =C2=A0 =C2=A0 hdev->bus =3D HCI_UART;
> + =C2=A0 =C2=A0 =C2=A0 hdev->driver_data =3D hst;
> + =C2=A0 =C2=A0 =C2=A0 hdev->open =3D ti_st_open;
> + =C2=A0 =C2=A0 =C2=A0 hdev->close =3D ti_st_close;
> + =C2=A0 =C2=A0 =C2=A0 hdev->flush =3D NULL;
> + =C2=A0 =C2=A0 =C2=A0 hdev->send =3D ti_st_send_frame;
> + =C2=A0 =C2=A0 =C2=A0 hdev->destruct =3D ti_st_destruct;
> + =C2=A0 =C2=A0 =C2=A0 hdev->owner =3D THIS_MODULE;
> +
> + =C2=A0 =C2=A0 =C2=A0 err =3D hci_register_dev(hdev);
> + =C2=A0 =C2=A0 =C2=A0 if (err < 0) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("Can't register=
 HCI device error %d", err);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfree(hst);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hci_free_dev(hdev);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return err;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 BT_DBG("HCI device registered (hdev %p)", hdev);
> +
> + =C2=A0 =C2=A0 =C2=A0 dev_set_drvdata(&pdev->dev, hst);
> + =C2=A0 =C2=A0 =C2=A0 return err;
> +}
> +
> +static int bt_ti_remove(struct platform_device *pdev)
> +{
> + =C2=A0 =C2=A0 =C2=A0 struct hci_dev *hdev;
> + =C2=A0 =C2=A0 =C2=A0 struct ti_st *hst =3D dev_get_drvdata(&pdev->dev);
> +
> + =C2=A0 =C2=A0 =C2=A0 if (!hst)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EFAULT;
> +
> + =C2=A0 =C2=A0 =C2=A0 hdev =3D hst->hdev;
> + =C2=A0 =C2=A0 =C2=A0 ti_st_close(hdev);
> + =C2=A0 =C2=A0 =C2=A0 hci_unregister_dev(hdev);
> +
> + =C2=A0 =C2=A0 =C2=A0 hci_free_dev(hdev);
> + =C2=A0 =C2=A0 =C2=A0 kfree(hst);
> +
> + =C2=A0 =C2=A0 =C2=A0 dev_set_drvdata(&pdev->dev, NULL);
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +}
> +
> +static struct platform_driver btwilink_driver =3D {
> + =C2=A0 =C2=A0 =C2=A0 .probe =3D bt_ti_probe,
> + =C2=A0 =C2=A0 =C2=A0 .remove =3D bt_ti_remove,
> + =C2=A0 =C2=A0 =C2=A0 .driver =3D {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .name =3D "btwilink",
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .owner =3D THIS_MODULE=
,
> + =C2=A0 =C2=A0 =C2=A0 },
> +};
> +
> +/* ------- Module Init/Exit interfaces ------ */
> +static int __init btwilink_init(void)
> +{
> + =C2=A0 =C2=A0 =C2=A0 BT_INFO("Bluetooth Driver for TI WiLink - Version =
%s", VERSION);
> +
> + =C2=A0 =C2=A0 =C2=A0 return platform_driver_register(&btwilink_driver);
> +}
> +
> +static void __exit btwilink_exit(void)
> +{
> + =C2=A0 =C2=A0 =C2=A0 platform_driver_unregister(&btwilink_driver);
> +}
> +
> +module_init(btwilink_init);
> +module_exit(btwilink_exit);
> +
> +/* ------ Module Info ------ */
> +
> +MODULE_AUTHOR("Raja Mani <raja_mani@ti.com>");
> +MODULE_DESCRIPTION("Bluetooth Driver for TI Shared Transport" VERSION);
> +MODULE_VERSION(VERSION);
> +MODULE_LICENSE("GPL");
> --
> 1.5.6.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth=
" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at =C2=A0http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply

* Re: [RFC 2/4] Bluetooth: clean up rfcomm code
From: Andrei Emeltchenko @ 2010-11-30  8:41 UTC (permalink / raw)
  To: Gustavo F. Padovan; +Cc: linux-bluetooth, marcel
In-Reply-To: <20101130010939.GB5919@vigoh>

Gustavo,

On Tue, Nov 30, 2010 at 3:09 AM, Gustavo F. Padovan
<padovan@profusion.mobi> wrote:
> Hi Andrei,
>
> * Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com> [2010-11-26 17:2=
2:43 +0200]:
>
>> From: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
>>
>> Remove extra spaces, assignments in if statement, zeroing static
>> variables.
>>
>> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
>> ---
>> =A0include/net/bluetooth/rfcomm.h | =A0 18 +++++++++---------
>> =A0net/bluetooth/rfcomm/core.c =A0 =A0| =A0 =A08 ++++----
>> =A0net/bluetooth/rfcomm/sock.c =A0 =A0| =A0 =A05 +++--
>> =A0net/bluetooth/rfcomm/tty.c =A0 =A0 | =A0 28 ++++++++++++++++---------=
---
>> =A04 files changed, 32 insertions(+), 27 deletions(-)
>>
>> diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfco=
mm.h
>> index 71047bc..6eac4a7 100644
>> --- a/include/net/bluetooth/rfcomm.h
>> +++ b/include/net/bluetooth/rfcomm.h
>> @@ -1,5 +1,5 @@
>> -/*
>> - =A0 RFCOMM implementation for Linux Bluetooth stack (BlueZ).
>> +/*
>> + =A0 RFCOMM implementation for Linux Bluetooth stack (BlueZ)
>> =A0 =A0 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
>> =A0 =A0 Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org>
>>
>> @@ -11,13 +11,13 @@
>> =A0 =A0 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCH=
ANTABILITY,
>> =A0 =A0 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PA=
RTY RIGHTS.
>> =A0 =A0 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABL=
E FOR ANY
>> - =A0 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DA=
MAGES
>> - =A0 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN=
 AN
>> - =A0 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING O=
UT OF
>> + =A0 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DA=
MAGES
>> + =A0 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN=
 AN
>> + =A0 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING O=
UT OF
>> =A0 =A0 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>>
>> - =A0 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS=
,
>> - =A0 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
>> + =A0 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS=
,
>> + =A0 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
>> =A0 =A0 SOFTWARE IS DISCLAIMED.
>
> Marcel refused a patch from me in the past because its was touching legal
> stuff, so or you remove these changes for your patches or wait for
> Marcel's comments here.

I fixed extra spaces at the end of the sentences, no legal stuff
touched in legal terms :-)
I believe that it is better to have legal text identical to other
parts of the kernel otherwise
the legal stuff looks different when comparing with diff tools.

Regards,
Andrei

>
> --
> Gustavo F. Padovan
> http://profusion.mobi
>

^ permalink raw reply

* Re: [PATCH] ath3k: reduce memory usage
From: Alexander Holler @ 2010-11-30  8:50 UTC (permalink / raw)
  To: Gustavo F. Padovan
  Cc: Alicke Xu, Luis R. Rodriguez, Vikram Kandukuri, linux-bluetooth
In-Reply-To: <20101130015200.GD5919@vigoh>

Hello,

Am 30.11.2010 02:52, schrieb Gustavo F. Padovan:
>> -	if ((usb_control_msg(data->udev, pipe,
>> +	send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC);
>> +	if (!send_buf) {
>> +		BT_ERR("Can't allocate memory chunk for firmware");
>> +		return -ENOMEM;
>> +	}
>> +
>> +	memcpy(send_buf, firmware->data, 20);
>> +	if ((err = usb_control_msg(udev, pipe,
>>   				USB_REQ_DFU_DNLOAD,
>>   				USB_TYPE_VENDOR, 0, 0,
>> -				firmware, 20, USB_CTRL_SET_TIMEOUT))<  0) {
>> +				send_buf, 20, USB_CTRL_SET_TIMEOUT))<  0) {
>>   		BT_ERR("Can't change to loading configuration err");
>> -		return -EBUSY;
>> +		goto error;
>>   	}
>>   	sent += 20;
>>   	count -= 20;
>
> Patch looks good to me,  but I have a question here: what's 20 here? I
> didn't figured out.

I don't know. I assume it's a stub which has to be send before the real 
firmware. It already was there and I haven't touched that.

Regards,

Alexander

^ permalink raw reply

* [PATCH] Populate adapter services list
From: Daniel Örstadius @ 2010-11-30  9:51 UTC (permalink / raw)
  To: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 46 bytes --]

Attaching patch proposal for review.

/Daniel

[-- Attachment #2: 0001-Populate-adapter-services-list.patch --]
[-- Type: text/x-patch, Size: 2841 bytes --]

From aa9b2a347d19f50575e6b2864f503e9d4540369c Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@nokia.com>
Date: Tue, 30 Nov 2010 11:42:08 +0200
Subject: [PATCH] Populate adapter services list

In case that service records have been added to bluetoothd before
a new adapter is registered, the added records which are shared by
all adapters (indicated by having an address set to BDADDR_ANY)
need to be added to the services list of the new adapter. This
patch adds a function for this on adapter initialization.

The issue could be reproduced by running bluetoothd and obexd on a
PC and briefly removing the BT dongle. The service records from
obexd would not be present in the adapter's local list (which is
used to set the class of device).
---
 src/adapter.c       |    1 +
 src/sdpd-database.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 src/sdpd.h          |    2 ++
 3 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 999f369..7d05098 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2319,6 +2319,7 @@ proceed:
 		return err;
 
 	if (adapter->initialized == FALSE) {
+		sdp_populate_services(&adapter->bdaddr);
 		load_drivers(adapter);
 		clear_blocked(adapter);
 		load_devices(adapter);
diff --git a/src/sdpd-database.c b/src/sdpd-database.c
index da3bc7d..111371d 100644
--- a/src/sdpd-database.c
+++ b/src/sdpd-database.c
@@ -81,6 +81,19 @@ static int access_sort(const void *r1, const void *r2)
 	return rec1->handle - rec2->handle;
 }
 
+static int find_device(const void *r1, const void *r2)
+{
+	const sdp_access_t *rec1 = r1;
+	const sdp_access_t *rec2 = r2;
+
+	if (!rec1 || !rec2) {
+		error("NULL RECORD LIST FATAL");
+		return -1;
+	}
+
+	return bacmp(&rec1->device, &rec2->device);
+}
+
 static void access_free(void *p)
 {
 	free(p);
@@ -306,3 +319,33 @@ uint32_t sdp_next_handle(void)
 
 	return handle;
 }
+
+void sdp_populate_services(bdaddr_t *device)
+{
+	sdp_record_t *rec;
+	sdp_list_t *p;
+	sdp_access_t ref_adr;
+	sdp_access_t *access;
+
+	SDPDBG("");
+
+	if (!access_db)
+		return;
+
+	bacpy(&ref_adr.device, BDADDR_ANY);
+	p = sdp_list_find(access_db, &ref_adr, find_device);
+
+	while (p) {
+		access = (sdp_access_t*) (p->data);
+
+		rec = sdp_record_find(access->handle);
+
+		if (rec) {
+			SDPDBG("adding record with handle %d", access->handle);
+			adapter_service_insert(device, rec);
+		}
+
+		p = p->next ?
+			(sdp_list_find(p->next, &ref_adr, find_device)) : NULL;
+	}
+}
diff --git a/src/sdpd.h b/src/sdpd.h
index f8e6ee7..b69034a 100644
--- a/src/sdpd.h
+++ b/src/sdpd.h
@@ -106,3 +106,5 @@ int remove_record_from_server(uint32_t handle);
 void create_ext_inquiry_response(const char *name,
 					int8_t tx_power, sdp_list_t *services,
 					uint8_t *data);
+
+void sdp_populate_services(bdaddr_t *device);
-- 
1.6.0.4


^ permalink raw reply related

* [PATCH 0/2] Sim Access Prifile API
From: Waldemar Rymarkiewicz @ 2010-11-30 10:36 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, linux-bluetooth; +Cc: Waldemar Rymarkiewicz

Hi,

I'am posting modified SAP API again in a seperate mail to keep better track of this.
Comments and new ideas will be appreciated.

Thanks,
/Waldek

^ permalink raw reply

* [PATCH 1/2] Sim Access Profile API
From: Waldemar Rymarkiewicz @ 2010-11-30 10:36 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, linux-bluetooth; +Cc: Waldemar Rymarkiewicz
In-Reply-To: <1291113364-6401-1-git-send-email-waldemar.rymarkiewicz@tieto.com>

New API for Sim Access Profile.
---
 Makefile.am     |    2 +-
 doc/sap-api.txt |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 1 deletions(-)
 create mode 100644 doc/sap-api.txt

diff --git a/Makefile.am b/Makefile.am
index 5f96975..97345a3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -354,7 +354,7 @@ EXTRA_DIST += doc/manager-api.txt \
 		doc/service-api.txt doc/agent-api.txt doc/attribute-api.txt \
 		doc/serial-api.txt doc/network-api.txt \
 		doc/input-api.txt doc/audio-api.txt doc/control-api.txt \
-		doc/hfp-api.txt doc/assigned-numbers.txt
+		doc/hfp-api.txt doc/assigned-numbers.txt doc/sap-api.txt
 
 AM_YFLAGS = -d
 
diff --git a/doc/sap-api.txt b/doc/sap-api.txt
new file mode 100644
index 0000000..4e5626e
--- /dev/null
+++ b/doc/sap-api.txt
@@ -0,0 +1,47 @@
+BlueZ D-Bus Sim Access Profile API description
+***********************************
+
+Copyright (C) 2010 ST-Ericsson SA
+
+
+Sim Access Profile hierarchy
+============================
+
+Service		org.bluez
+Interface	org.bluez.SimAccess
+Object path	[variable prefix]/{hci0,hci1,...}
+
+Methods		void Disconnect()
+
+			Disconnects SAP client from the server.
+
+			Possible errors: org.bluez.Error.Failed
+
+		void SetProperty(string name, variant value)
+
+			Changes the value of the specified property. Only
+			properties that are listed a read-write are changeable.
+
+			Possible Errors: org.bluez.Error.DoesNotExist
+					 org.bluez.Error.InvalidArguments
+
+		dict GetProperties()
+
+			Return all properties for the interface. See the
+			properties section for available properties.
+
+			Possible Errors: org.bluez.Error.Failed
+
+Signals		PropertyChanged(string name, variant value)
+
+			This signal indicates a changed value of the given
+			property.
+
+Properties	boolean Enabled [readwrite]
+
+			Set to true to start-up SAP server and register SDP record for
+			it. Set to false to shutdown SAP server and remove the SDP record.
+
+		boolean Connected [readonly]
+
+			Indicates if SAP client is connected to the server.
-- 
1.7.0.4

^ permalink raw reply related

* Re: [PATCH] Populate adapter services list
From: Daniel Örstadius @ 2010-11-30 11:33 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <AANLkTik7su9-KfW-+ZC-yc_SrXq+5K3PvZtu5kKxiJhG@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 58 bytes --]

Updated patch after offline feedback from Johan.

/Daniel

[-- Attachment #2: 0001-Initialize-adapter-services-list.patch --]
[-- Type: text/x-patch, Size: 2248 bytes --]

From 42edf146231aa053bbcc97d80fd9dd3aa3f247ec Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@nokia.com>
Date: Tue, 30 Nov 2010 13:27:57 +0200
Subject: [PATCH] Initialize adapter services list

In case service records have been added to bluetoothd before a new
adapter is registered, the records which are shared by all adapters
(indicated by having the address set to BDADDR_ANY) need to be added
to the services list of the new adapter. This patch adds a function
for this on adapter initialization.

The issue could be reproduced by running bluetoothd and obexd on a
PC and briefly removing the BT dongle. The service records from
obexd would not be present in the adapter's local list (which is
used to set the class of device).
---
 src/adapter.c       |    1 +
 src/sdpd-database.c |   24 ++++++++++++++++++++++++
 src/sdpd.h          |    2 ++
 3 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 999f369..62afc0c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2319,6 +2319,7 @@ proceed:
 		return err;
 
 	if (adapter->initialized == FALSE) {
+		sdp_init_services_list(&adapter->bdaddr);
 		load_drivers(adapter);
 		clear_blocked(adapter);
 		load_devices(adapter);
diff --git a/src/sdpd-database.c b/src/sdpd-database.c
index da3bc7d..f3538ae 100644
--- a/src/sdpd-database.c
+++ b/src/sdpd-database.c
@@ -306,3 +306,27 @@ uint32_t sdp_next_handle(void)
 
 	return handle;
 }
+
+void sdp_init_services_list(bdaddr_t *device)
+{
+	sdp_list_t *p;
+
+	SDPDBG("");
+
+	for (p = access_db; p != NULL; p = p->next) {
+		sdp_record_t *rec;
+		sdp_access_t *access = p->data;
+
+		if (bacmp(BDADDR_ANY, &access->device))
+			continue;
+
+		rec = sdp_record_find(access->handle);
+
+		if (rec == NULL)
+			continue;
+
+		SDPDBG("adding record with handle %x", access->handle);
+
+		adapter_service_insert(device, rec);
+	}
+}
diff --git a/src/sdpd.h b/src/sdpd.h
index f8e6ee7..0e3dddf 100644
--- a/src/sdpd.h
+++ b/src/sdpd.h
@@ -106,3 +106,5 @@ int remove_record_from_server(uint32_t handle);
 void create_ext_inquiry_response(const char *name,
 					int8_t tx_power, sdp_list_t *services,
 					uint8_t *data);
+
+void sdp_init_services_list(bdaddr_t *device);
-- 
1.6.0.4


^ permalink raw reply related

* Re: [PATCH] Populate adapter services list
From: Johan Hedberg @ 2010-11-30 11:50 UTC (permalink / raw)
  To: Daniel Örstadius; +Cc: linux-bluetooth
In-Reply-To: <AANLkTimwgPtxRVKuDHT0DZa2MhqOqFFDKiEzAJ3opv_W@mail.gmail.com>

Hi Daniel,

On Tue, Nov 30, 2010, Daniel Örstadius wrote:
> In case service records have been added to bluetoothd before a new
> adapter is registered, the records which are shared by all adapters
> (indicated by having the address set to BDADDR_ANY) need to be added
> to the services list of the new adapter. This patch adds a function
> for this on adapter initialization.
> 
> The issue could be reproduced by running bluetoothd and obexd on a
> PC and briefly removing the BT dongle. The service records from
> obexd would not be present in the adapter's local list (which is
> used to set the class of device).
> ---
>  src/adapter.c       |    1 +
>  src/sdpd-database.c |   24 ++++++++++++++++++++++++
>  src/sdpd.h          |    2 ++
>  3 files changed, 27 insertions(+), 0 deletions(-)

Thanks. Pushed upstream after a few minor cosmetic changes.

Johan

^ permalink raw reply

* [PATCH 1/3] Fix interface name of modem states on maemo6 telephony driver
From: Luiz Augusto von Dentz @ 2010-11-30 12:26 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

---
 audio/telephony-maemo6.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c
index 2e01fb1..0240957 100644
--- a/audio/telephony-maemo6.c
+++ b/audio/telephony-maemo6.c
@@ -1963,7 +1963,7 @@ int telephony_init(void)
 	add_watch(NULL, NULL, CSD_CSNET_REGISTRATION, NULL);
 	add_watch(NULL, NULL, CSD_CSNET_OPERATOR, NULL);
 	add_watch(NULL, NULL, CSD_CSNET_SIGNAL, NULL);
-	add_watch(NULL, NULL, CSD_CSNET_SIGNAL, "modem_state_changed_ind");
+	add_watch(NULL, NULL, SSC_DBUS_IFACE, "modem_state_changed_ind");
 
 	if (send_method_call(SSC_DBUS_NAME, SSC_DBUS_PATH, SSC_DBUS_IFACE,
 					"get_modem_state", modem_state_reply,
-- 
1.7.1


^ permalink raw reply related

* [PATCH 2/3] Use specific members in D-Bus match rules on telephony maemo6 driver
From: Luiz Augusto von Dentz @ 2010-11-30 12:26 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1291119975-9460-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

This reduces the amount of unnecessary wake-ups without breaking anything
---
 audio/telephony-maemo6.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c
index 0240957..7853bae 100644
--- a/audio/telephony-maemo6.c
+++ b/audio/telephony-maemo6.c
@@ -1960,9 +1960,9 @@ int telephony_init(void)
 	add_watch(NULL, NULL, CSD_CALL_INTERFACE, NULL);
 	add_watch(NULL, NULL, CSD_CALL_INSTANCE, NULL);
 	add_watch(NULL, NULL, CSD_CALL_CONFERENCE, NULL);
-	add_watch(NULL, NULL, CSD_CSNET_REGISTRATION, NULL);
-	add_watch(NULL, NULL, CSD_CSNET_OPERATOR, NULL);
-	add_watch(NULL, NULL, CSD_CSNET_SIGNAL, NULL);
+	add_watch(NULL, NULL, CSD_CSNET_REGISTRATION, "RegistrationChanged");
+	add_watch(NULL, NULL, CSD_CSNET_OPERATOR, "OperatorNameChanged");
+	add_watch(NULL, NULL, CSD_CSNET_SIGNAL, "SignalBarsChanged");
 	add_watch(NULL, NULL, SSC_DBUS_IFACE, "modem_state_changed_ind");
 
 	if (send_method_call(SSC_DBUS_NAME, SSC_DBUS_PATH, SSC_DBUS_IFACE,
-- 
1.7.1


^ permalink raw reply related

* [PATCH 3/3] Fix not canceling pending calls on maemo6 telephony driver exit
From: Luiz Augusto von Dentz @ 2010-11-30 12:26 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1291119975-9460-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

This happens when the driver exit is called quickly after init due to
adapter power changes.
---
 audio/telephony-maemo6.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c
index 7853bae..bfd3ba1 100644
--- a/audio/telephony-maemo6.c
+++ b/audio/telephony-maemo6.c
@@ -150,6 +150,7 @@ static DBusConnection *connection = NULL;
 
 static GSList *calls = NULL;
 static GSList *watches = NULL;
+static GSList *pending = NULL;
 
 /* Reference count for determining the call indicator status */
 static GSList *active_calls = NULL;
@@ -592,7 +593,7 @@ static int send_method_call(const char *dest, const char *path,
 	}
 
 	dbus_pending_call_set_notify(call, cb, user_data, NULL);
-	dbus_pending_call_unref(call);
+	pending = g_slist_prepend(pending, call);
 	dbus_message_unref(msg);
 
 	return 0;
@@ -1312,6 +1313,12 @@ static gboolean iter_get_basic_args(DBusMessageIter *iter,
 	return type == DBUS_TYPE_INVALID ? TRUE : FALSE;
 }
 
+static void remove_pending(DBusPendingCall *call)
+{
+	pending = g_slist_remove(pending, call);
+	dbus_pending_call_unref(call);
+}
+
 static void hal_battery_level_reply(DBusPendingCall *call, void *user_data)
 {
 	DBusError err;
@@ -1360,8 +1367,10 @@ static void hal_battery_level_reply(DBusPendingCall *call, void *user_data)
 
 		telephony_update_indicator(maemo_indicators, "battchg", new);
 	}
+
 done:
 	dbus_message_unref(reply);
+	remove_pending(call);
 }
 
 static void hal_get_integer(const char *path, const char *key, void *user_data)
@@ -1556,6 +1565,7 @@ static void get_property_reply(DBusPendingCall *call, void *user_data)
 done:
 	g_free(prop);
 	dbus_message_unref(reply);
+	remove_pending(call);
 }
 
 static int get_property(const char *iface, const char *prop)
@@ -1615,6 +1625,7 @@ static void call_info_reply(DBusPendingCall *call, void *user_data)
 
 done:
 	dbus_message_unref(reply);
+	remove_pending(call);
 }
 
 
@@ -1665,6 +1676,7 @@ static void phonebook_read_reply(DBusPendingCall *call, void *user_data)
 
 done:
 	dbus_message_unref(reply);
+	remove_pending(call);
 }
 
 static void csd_init(void)
@@ -1843,6 +1855,7 @@ static void modem_state_reply(DBusPendingCall *call, void *user_data)
 		handle_modem_state(reply);
 
 	dbus_message_unref(reply);
+	remove_pending(call);
 }
 
 static gboolean signal_filter(DBusConnection *conn, DBusMessage *msg,
@@ -1940,6 +1953,7 @@ static void hal_find_device_reply(DBusPendingCall *call, void *user_data)
 
 done:
 	dbus_message_unref(reply);
+	remove_pending(call);
 }
 
 int telephony_init(void)
@@ -2016,6 +2030,11 @@ void telephony_exit(void)
 	g_slist_free(calls);
 	calls = NULL;
 
+	g_slist_foreach(pending, (GFunc) dbus_pending_call_cancel, NULL);
+	g_slist_foreach(pending, (GFunc) remove_pending, NULL);
+	g_slist_free(pending);
+	pending = NULL;
+
 	g_slist_foreach(watches, (GFunc) remove_watch, NULL);
 	g_slist_free(watches);
 	watches = NULL;
-- 
1.7.1


^ permalink raw reply related

* Re: [PATCH 1/3] Fix interface name of modem states on maemo6 telephony driver
From: Johan Hedberg @ 2010-11-30 12:31 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1291119975-9460-1-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

On Tue, Nov 30, 2010, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
> 
> ---
>  audio/telephony-maemo6.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

The first two patches have been pushed upstream. Thanks.

Johan

^ permalink raw reply


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