Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] build: Check for UDEV before setting rulesdir/rules_DATA
From: Anderson Lizardo @ 2012-12-19 12:56 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

Without this check, UDEV_DIR will be empty and an empty "/rules.d"
directory is created on DESTDIR.
---
 Makefile.am |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index a482b54..c10c1fa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -174,6 +174,7 @@ test_scripts =
 include Makefile.tools
 include Makefile.obexd
 
+if UDEV
 rulesdir = @UDEV_DIR@/rules.d
 
 udev_files =
@@ -187,6 +188,7 @@ EXTRA_DIST += tools/hid2hci.rules
 rules_DATA = $(foreach file,$(udev_files), tools/97-$(notdir $(file)))
 
 CLEANFILES += $(rules_DATA)
+endif
 
 if TEST
 testdir = $(pkglibdir)/test
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH] monitor: Fix crash in btmon
From: Frédéric Danis @ 2012-12-19 13:20 UTC (permalink / raw)
  To: linux-bluetooth

When retrieving SDP records from keyboard btmon crashes (see below).

The tid_list in sdp.c is filled up by SDP Service search request,
as Service Search responses are treated as invalid and do not free
tid_list entries.

This is due to passing last fragment instead of complete frame to
l2cap_frame().



< ACL Data TX: Handle 11 flags 0x00 dlen 26                                                                                                                                                       [hci0] 24.082133
      Channel: 511 len 22 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Request (0x06) tid 14 len 17
        Search pattern: [len 5]
          Sequence (6) with 3 bytes [8 extra bits] len 5
            UUID (3) with 2 bytes [0 extra bits] len 3
              L2CAP (0x0100)
        Max record count: 65535
        Attribute list: [len 7]
          Sequence (6) with 5 bytes [8 extra bits] len 7
            Unsigned Integer (1) with 4 bytes [0 extra bits] len 5
              0x0000ffff
        Continuation state: 2
        00 1d                                            ..
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                            [hci0] 24.085458
        Num handles: 1
        Handle: 11
        Count: 2
> ACL Data RX: Handle 11 flags 0x02 dlen 27                                                                                                                                                       [hci0] 24.102205
> ACL Data RX: Handle 11 flags 0x01 dlen 14                                                                                                                                                       [hci0] 24.103339
      Channel: 64 len 37 [PSM 1 mode 0] {chan 0}
        invalid frame size
        23 03 09 02 04 28 01 09 02 05 09 00 02 00 09 04  #....(..........
        6d 09 02 02 09 b3 01 09 02 03 09 64 00 00 00 00  m..........d....
        00 00 00 00 00                                   .....
< ACL Data TX: Handle 11 flags 0x00 dlen 24                                                                                                                                                       [hci0] 24.170595
      Channel: 511 len 20 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Request (0x06) tid 15 len 15
        Search pattern: [len 5]
          Sequence (6) with 3 bytes [8 extra bits] len 5
            UUID (3) with 2 bytes [0 extra bits] len 3
              PnP Information (0x1200)
        Max record count: 65535
        Attribute list: [len 7]
          Sequence (6) with 5 bytes [8 extra bits] len 7
            Unsigned Integer (1) with 4 bytes [0 extra bits] len 5
              0x0000ffff
        Continuation state: 0
> ACL Data RX: Handle 11 flags 0x02 dlen 27                                                                                                                                                       [hci0] 24.192217
> ACL Data RX: Handle 11 flags 0x01 dlen 25                                                                                                                                                       [hci0] 24.193327
      Channel: 64 len 48 [PSM 1 mode 0] {chan 0}
        invalid frame size
        01 35 03 19 12 00 09 00 04 35 0d 35 06 19 01 00  .5.......5.5....
        09 00 01 35 03 19 02 00 32 09 00 64 00 00 00 00  ...5....2..d....
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
< ACL Data TX: Handle 11 flags 0x00 dlen 26                                                                                                                                                       [hci0] 24.205765
      Channel: 511 len 22 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Request (0x06) tid 16 len 17
        Search pattern: [len 5]
          Sequence (6) with 3 bytes [8 extra bits] len 5
            UUID (3) with 2 bytes [0 extra bits] len 3
              PnP Information (0x1200)
        Max record count: 65535
        Attribute list: [len 7]
          Sequence (6) with 5 bytes [8 extra bits] len 7
            Unsigned Integer (1) with 4 bytes [0 extra bits] len 5
              0x0000ffff

Program received signal SIGSEGV, Segmentation fault.
__memcpy_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2184
2184	../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: No such file or directory.
(gdb) bt
#0  __memcpy_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2184
#1  0x0000000000418607 in search_attr_req (frame=0x7fffffffdff0, tid=0x0) at /usr/include/x86_64-linux-gnu/bits/string3.h:52
#2  0x0000000000418ebb in sdp_packet (frame=0x7fffffffe0e0, channel=0) at monitor/sdp.c:743
#3  0x000000000041547e in l2cap_frame (index=<optimised out>, in=<optimised out>, handle=<optimised out>, cid=<optimised out>, data=0x6370d0, size=22) at monitor/l2cap.c:2161
#4  0x000000000040f8c4 in packet_hci_acldata (tv=0x7fffffffe330, index=0, in=false, data=0x6370cc, size=26) at monitor/packet.c:4812
#5  0x000000000040fd35 in packet_monitor (tv=0x7fffffffe330, index=0, opcode=<optimised out>, data=0x6370c8, size=<optimised out>) at monitor/packet.c:1839
#6  0x0000000000403da2 in data_callback (user_data=0x6370c0, fd=<optimised out>, events=<optimised out>) at monitor/control.c:599
#7  data_callback (fd=<optimised out>, events=<optimised out>, user_data=0x6370c0) at monitor/control.c:541
#8  0x00000000004021c4 in mainloop_run () at monitor/mainloop.c:142
#9  0x0000000000401c7c in main (argc=1, argv=0x7fffffffe5f8) at monitor/main.c:154
---
 monitor/l2cap.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/monitor/l2cap.c b/monitor/l2cap.c
index e982bdd..dc4d8ea 100644
--- a/monitor/l2cap.c
+++ b/monitor/l2cap.c
@@ -2250,7 +2250,8 @@ void l2cap_packet(uint16_t index, bool in, uint16_t handle, uint8_t flags,
 			/* complete frame */
 			l2cap_frame(index, in, handle,
 					index_list[index].frag_cid,
-					data, index_list[index].frag_pos);
+					index_list[index].frag_buf,
+					index_list[index].frag_pos);
 			clear_fragment_buffer(index);
 			return;
 		}
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH BlueZ 8/8] hog: Rename hog_device_unregister
From: Andre Guedes @ 2012-12-19 13:38 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <CAJdJm_Ouhbv+jf920=aNjd2RsUt5PLjnUEbWqW5FapYa+Lu-hg@mail.gmail.com>

Hi Lizardo,

On Tue, Dec 18, 2012 at 5:13 PM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> Hi Guedes,
>
> On Tue, Dec 18, 2012 at 2:49 PM, Andre Guedes
> <andre.guedes@openbossa.org> wrote:
>> This patch renames hog_device_unregister function to hog_device_
>> unregister.
>
> Minor typo:   "hog_device_ unregister" -> "hog_unregister_device".

Thanks.

Johan, I'm fixing the typo and I'm going to send a new patch right away.

Regards,

Andre

^ permalink raw reply

* [PATCH BlueZ 8/8] hog: Rename hog_device_unregister
From: Andre Guedes @ 2012-12-19 13:42 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1355856590-19222-8-git-send-email-andre.guedes@openbossa.org>

This patch renames hog_device_unregister function to hog_unregister_
device.
---
 profiles/input/hog.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index fa8069c..b6ac61d 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -753,7 +753,7 @@ static struct hog_device *hog_register_device(struct btd_device *device,
 	return hogdev;
 }
 
-static int hog_device_unregister(struct hog_device *hogdev)
+static int hog_unregister_device(struct hog_device *hogdev)
 {
 	struct uhid_event ev;
 
@@ -860,7 +860,7 @@ static void remove_device(gpointer a, gpointer b)
 		return;
 
 	devices = g_slist_remove(devices, hogdev);
-	hog_device_unregister(hogdev);
+	hog_unregister_device(hogdev);
 }
 
 static void hog_remove(struct btd_profile *p, struct btd_device *device)
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH] a2dp: Fix server unregister
From: Szymon Janc @ 2012-12-19 13:51 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

When removing sink or source unregister its sep and sdp record. When
both sink and source are unregistered also unregister a2dp server.
---
 profiles/audio/a2dp.c    | 48 +++++++++++++++++++++++++++++++++++++++---------
 profiles/audio/a2dp.h    |  3 ++-
 profiles/audio/manager.c | 14 ++++++++++++++
 3 files changed, 55 insertions(+), 10 deletions(-)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 145b1aa..3ec8b43 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1224,7 +1224,20 @@ static void a2dp_unregister_sep(struct a2dp_sep *sep)
 	g_free(sep);
 }
 
-void a2dp_unregister(struct btd_adapter *adapter)
+static void a2dp_unregister(struct a2dp_server *server)
+{
+	if (server->sink_enabled || server->source_enabled)
+		return;
+
+	avdtp_exit(server->adapter);
+
+	servers = g_slist_remove(servers, server);
+
+	btd_adapter_unref(server->adapter);
+	g_free(server);
+}
+
+void a2dp_source_unregister(struct btd_adapter *adapter)
 {
 	struct a2dp_server *server;
 
@@ -1232,22 +1245,39 @@ void a2dp_unregister(struct btd_adapter *adapter)
 	if (!server)
 		return;
 
-	g_slist_free_full(server->sinks, (GDestroyNotify) a2dp_unregister_sep);
+	server->source_enabled = FALSE;
+
 	g_slist_free_full(server->sources,
 					(GDestroyNotify) a2dp_unregister_sep);
+	server->sources = NULL;
 
-	avdtp_exit(adapter);
+	if (server->source_record_id > 0) {
+		remove_record_from_server(server->source_record_id);
+		server->source_record_id = 0;
+	}
 
-	servers = g_slist_remove(servers, server);
+	a2dp_unregister(server);
+}
 
-	if (server->source_record_id)
-		remove_record_from_server(server->source_record_id);
+void a2dp_sink_unregister(struct btd_adapter *adapter)
+{
+	struct a2dp_server *server;
+
+	server = find_server(servers, adapter);
+	if (!server)
+		return;
+
+	server->sink_enabled = FALSE;
+
+	g_slist_free_full(server->sinks, (GDestroyNotify) a2dp_unregister_sep);
+	server->sinks = NULL;
 
-	if (server->sink_record_id)
+	if (server->sink_record_id > 0) {
 		remove_record_from_server(server->sink_record_id);
+		server->sink_record_id = 0;
+	}
 
-	btd_adapter_unref(server->adapter);
-	g_free(server);
+	a2dp_unregister(server);
 }
 
 struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
diff --git a/profiles/audio/a2dp.h b/profiles/audio/a2dp.h
index 54c3bf3..af5c27d 100644
--- a/profiles/audio/a2dp.h
+++ b/profiles/audio/a2dp.h
@@ -66,7 +66,8 @@ typedef void (*a2dp_stream_cb_t) (struct avdtp *session,
 
 int a2dp_source_register(struct btd_adapter *adapter, GKeyFile *config);
 int a2dp_sink_register(struct btd_adapter *adapter, GKeyFile *config);
-void a2dp_unregister(struct btd_adapter *adapter);
+void a2dp_source_unregister(struct btd_adapter *adapter);
+void a2dp_sink_unregister(struct btd_adapter *adapter);
 
 struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
 				uint8_t codec, gboolean delay_reporting,
diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
index b6b2385..5e30fa8 100644
--- a/profiles/audio/manager.c
+++ b/profiles/audio/manager.c
@@ -348,6 +348,12 @@ static int a2dp_source_server_probe(struct btd_profile *p,
 	return a2dp_source_register(adapter, config);
 }
 
+static void a2dp_source_server_remove(struct btd_profile *p,
+						struct btd_adapter *adapter)
+{
+	a2dp_source_unregister(adapter);
+}
+
 static int a2dp_sink_server_probe(struct btd_profile *p,
 						struct btd_adapter *adapter)
 {
@@ -365,6 +371,12 @@ static int a2dp_sink_server_probe(struct btd_profile *p,
 	return a2dp_sink_register(adapter, config);
 }
 
+static void a2dp_sink_server_remove(struct btd_profile *p,
+						struct btd_adapter *adapter)
+{
+	a2dp_sink_unregister(adapter);
+}
+
 static int avrcp_server_probe(struct btd_profile *p,
 						struct btd_adapter *adapter)
 {
@@ -446,6 +458,7 @@ static struct btd_profile a2dp_source_profile = {
 	.disconnect	= a2dp_source_disconnect,
 
 	.adapter_probe	= a2dp_source_server_probe,
+	.adapter_remove = a2dp_source_server_remove,
 };
 
 static struct btd_profile a2dp_sink_profile = {
@@ -461,6 +474,7 @@ static struct btd_profile a2dp_sink_profile = {
 	.disconnect	= a2dp_sink_disconnect,
 
 	.adapter_probe	= a2dp_sink_server_probe,
+	.adapter_remove = a2dp_sink_server_remove,
 };
 
 static struct btd_profile avrcp_profile = {
-- 
1.8.0


^ permalink raw reply related

* Re: [PATCH BlueZ] monitor: Add support for parsing Flow Control Lag flags
From: Marcel Holtmann @ 2012-12-19 13:53 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <1355860127-7011-1-git-send-email-vinicius.gomes@openbossa.org>

Hi Vinicious,

>  monitor/packet.c | 3 +++
>  1 file changed, 3 insertions(+)

sorry, I was faster with this one ;)

Regards

Marcel



^ permalink raw reply

* Re: hci_emu and hci_vhci
From: Marcel Holtmann @ 2012-12-19 13:57 UTC (permalink / raw)
  To: Kevin Wilson; +Cc: linux-bluetooth
In-Reply-To: <CAGXs5wVmFirtMq6ZeUna7q0hfxpedMOcPEEVuD2r09Whet1Z=A@mail.gmail.com>

Hi Kevin,

> What can we test with hci_emu and hci_vhci ?
> 
> When I tried:
> modprobe hci_vhci
> and then
> ./hciemu -n 10
> 
> I see with hciconfig that a virtual device was created (it shows Bus: VIRTUAL)
> When I have no other BT physical device, which tests can I do with the virtual
> 	hci device ?
> 	
> When I try :
> hciconfig scan
> or
> hciconfig inq
> I get this answer in both cases:
> Inquiry failed: Invalid request code
> 
> Also when I set both PSCAN/ISCAN bit in it, I cannot see it when scanning
> from other machine with physical BT devices.

of course not. This one is virtual and does not magically transmit radio
waves ;)

> So I assume testing with pan --connect, etc also won't work.

If you start two entities of hciemu which each its own port number, then
you can connect between them. Of course if they are running on the same
host, then the network interfaces will not see any traffic. Local
traffic goes over the loopback interface.

> Are there any tests which we can do with a virtual
> hci device ?

Plenty of them, but you need a full piconet emulation for anything
further.

Regards

Marcel



^ permalink raw reply

* Re: [PATCH BlueZ] build: Check for UDEV before setting rulesdir/rules_DATA
From: Marcel Holtmann @ 2012-12-19 14:06 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1355921804-12533-1-git-send-email-anderson.lizardo@openbossa.org>

Hi Anderson,

> Without this check, UDEV_DIR will be empty and an empty "/rules.d"
> directory is created on DESTDIR.
> ---
>  Makefile.am |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Makefile.am b/Makefile.am
> index a482b54..c10c1fa 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -174,6 +174,7 @@ test_scripts =
>  include Makefile.tools
>  include Makefile.obexd
>  
> +if UDEV
>  rulesdir = @UDEV_DIR@/rules.d
>  
>  udev_files =
> @@ -187,6 +188,7 @@ EXTRA_DIST += tools/hid2hci.rules
>  rules_DATA = $(foreach file,$(udev_files), tools/97-$(notdir $(file)))
>  
>  CLEANFILES += $(rules_DATA)
> +endif

great catch, but I fixed this differently by hiding this behind the
HID2HCI condition.

On a side note, you fix has the issue that EXTRA_DIST is now skipped and
that means it would have broken make distcheck by not including the
actual rule file.

Regards

Marcel



^ permalink raw reply

* Re: [PATCH] monitor: Fix crash in btmon
From: Marcel Holtmann @ 2012-12-19 14:07 UTC (permalink / raw)
  To: Frédéric Danis; +Cc: linux-bluetooth
In-Reply-To: <1355923202-16648-1-git-send-email-frederic.danis@linux.intel.com>

Hi Fred,

> When retrieving SDP records from keyboard btmon crashes (see below).
> 
> The tid_list in sdp.c is filled up by SDP Service search request,
> as Service Search responses are treated as invalid and do not free
> tid_list entries.
> 
> This is due to passing last fragment instead of complete frame to
> l2cap_frame().

please send me the binary log file privately. I like to have a look at
this in detail. What device have you tested this against?

Regards

Marcel



^ permalink raw reply

* Re: [PATCH] a2dp: Fix server unregister
From: Luiz Augusto von Dentz @ 2012-12-19 14:12 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1355925094-22695-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Wed, Dec 19, 2012 at 3:51 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
> When removing sink or source unregister its sep and sdp record. When
> both sink and source are unregistered also unregister a2dp server.
> ---
>  profiles/audio/a2dp.c    | 48 +++++++++++++++++++++++++++++++++++++++---------
>  profiles/audio/a2dp.h    |  3 ++-
>  profiles/audio/manager.c | 14 ++++++++++++++
>  3 files changed, 55 insertions(+), 10 deletions(-)
>
> diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
> index 145b1aa..3ec8b43 100644
> --- a/profiles/audio/a2dp.c
> +++ b/profiles/audio/a2dp.c
> @@ -1224,7 +1224,20 @@ static void a2dp_unregister_sep(struct a2dp_sep *sep)
>         g_free(sep);
>  }
>
> -void a2dp_unregister(struct btd_adapter *adapter)
> +static void a2dp_unregister(struct a2dp_server *server)
> +{
> +       if (server->sink_enabled || server->source_enabled)
> +               return;
> +
> +       avdtp_exit(server->adapter);
> +
> +       servers = g_slist_remove(servers, server);
> +
> +       btd_adapter_unref(server->adapter);
> +       g_free(server);
> +}
> +
> +void a2dp_source_unregister(struct btd_adapter *adapter)
>  {
>         struct a2dp_server *server;
>
> @@ -1232,22 +1245,39 @@ void a2dp_unregister(struct btd_adapter *adapter)
>         if (!server)
>                 return;
>
> -       g_slist_free_full(server->sinks, (GDestroyNotify) a2dp_unregister_sep);
> +       server->source_enabled = FALSE;
> +
>         g_slist_free_full(server->sources,
>                                         (GDestroyNotify) a2dp_unregister_sep);
> +       server->sources = NULL;
>
> -       avdtp_exit(adapter);
> +       if (server->source_record_id > 0) {
> +               remove_record_from_server(server->source_record_id);
> +               server->source_record_id = 0;
> +       }
>
> -       servers = g_slist_remove(servers, server);
> +       a2dp_unregister(server);
> +}
>
> -       if (server->source_record_id)
> -               remove_record_from_server(server->source_record_id);
> +void a2dp_sink_unregister(struct btd_adapter *adapter)
> +{
> +       struct a2dp_server *server;
> +
> +       server = find_server(servers, adapter);
> +       if (!server)
> +               return;
> +
> +       server->sink_enabled = FALSE;
> +
> +       g_slist_free_full(server->sinks, (GDestroyNotify) a2dp_unregister_sep);
> +       server->sinks = NULL;
>
> -       if (server->sink_record_id)
> +       if (server->sink_record_id > 0) {
>                 remove_record_from_server(server->sink_record_id);
> +               server->sink_record_id = 0;
> +       }
>
> -       btd_adapter_unref(server->adapter);
> -       g_free(server);
> +       a2dp_unregister(server);
>  }
>
>  struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
> diff --git a/profiles/audio/a2dp.h b/profiles/audio/a2dp.h
> index 54c3bf3..af5c27d 100644
> --- a/profiles/audio/a2dp.h
> +++ b/profiles/audio/a2dp.h
> @@ -66,7 +66,8 @@ typedef void (*a2dp_stream_cb_t) (struct avdtp *session,
>
>  int a2dp_source_register(struct btd_adapter *adapter, GKeyFile *config);
>  int a2dp_sink_register(struct btd_adapter *adapter, GKeyFile *config);
> -void a2dp_unregister(struct btd_adapter *adapter);
> +void a2dp_source_unregister(struct btd_adapter *adapter);
> +void a2dp_sink_unregister(struct btd_adapter *adapter);
>
>  struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
>                                 uint8_t codec, gboolean delay_reporting,
> diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
> index b6b2385..5e30fa8 100644
> --- a/profiles/audio/manager.c
> +++ b/profiles/audio/manager.c
> @@ -348,6 +348,12 @@ static int a2dp_source_server_probe(struct btd_profile *p,
>         return a2dp_source_register(adapter, config);
>  }
>
> +static void a2dp_source_server_remove(struct btd_profile *p,
> +                                               struct btd_adapter *adapter)
> +{
> +       a2dp_source_unregister(adapter);
> +}
> +
>  static int a2dp_sink_server_probe(struct btd_profile *p,
>                                                 struct btd_adapter *adapter)
>  {
> @@ -365,6 +371,12 @@ static int a2dp_sink_server_probe(struct btd_profile *p,
>         return a2dp_sink_register(adapter, config);
>  }
>
> +static void a2dp_sink_server_remove(struct btd_profile *p,
> +                                               struct btd_adapter *adapter)
> +{
> +       a2dp_sink_unregister(adapter);
> +}
> +
>  static int avrcp_server_probe(struct btd_profile *p,
>                                                 struct btd_adapter *adapter)
>  {
> @@ -446,6 +458,7 @@ static struct btd_profile a2dp_source_profile = {
>         .disconnect     = a2dp_source_disconnect,
>
>         .adapter_probe  = a2dp_source_server_probe,
> +       .adapter_remove = a2dp_source_server_remove,
>  };
>
>  static struct btd_profile a2dp_sink_profile = {
> @@ -461,6 +474,7 @@ static struct btd_profile a2dp_sink_profile = {
>         .disconnect     = a2dp_sink_disconnect,
>
>         .adapter_probe  = a2dp_sink_server_probe,
> +       .adapter_remove = a2dp_sink_server_remove,
>  };
>
>  static struct btd_profile avrcp_profile = {
> --
> 1.8.0

I have a very similar fix to push, I end up doing it because the whole
btd_adapter reference got broken so I would like to push it if you
don't mind.


--
Luiz Augusto von Dentz

^ permalink raw reply

* [PATCH BlueZ 1/2] audio: Fix not releasing all references to btd_adapter
From: Luiz Augusto von Dentz @ 2012-12-19 14:29 UTC (permalink / raw)
  To: linux-bluetooth

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

A2DP server now take a reference to btd_adapter which needs to be
released properly once the adapter is unplugged.
---
 profiles/audio/a2dp.c    | 44 +++++++++++++++++++++++++++++++++++---------
 profiles/audio/a2dp.h    |  3 ++-
 profiles/audio/manager.c | 48 ++++++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 81 insertions(+), 14 deletions(-)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 145b1aa..46f41a6 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1224,7 +1224,16 @@ static void a2dp_unregister_sep(struct a2dp_sep *sep)
 	g_free(sep);
 }
 
-void a2dp_unregister(struct btd_adapter *adapter)
+static void a2dp_server_unregister(struct a2dp_server *server)
+{
+	avdtp_exit(server->adapter);
+
+	servers = g_slist_remove(servers, server);
+	btd_adapter_unref(server->adapter);
+	g_free(server);
+}
+
+void a2dp_sink_unregister(struct btd_adapter *adapter)
 {
 	struct a2dp_server *server;
 
@@ -1233,21 +1242,38 @@ void a2dp_unregister(struct btd_adapter *adapter)
 		return;
 
 	g_slist_free_full(server->sinks, (GDestroyNotify) a2dp_unregister_sep);
-	g_slist_free_full(server->sources,
-					(GDestroyNotify) a2dp_unregister_sep);
-
-	avdtp_exit(adapter);
 
-	servers = g_slist_remove(servers, server);
+	if (server->sink_record_id) {
+		remove_record_from_server(server->sink_record_id);
+		server->sink_record_id = 0;
+	}
 
 	if (server->source_record_id)
+		return;
+
+	a2dp_server_unregister(server);
+}
+
+void a2dp_source_unregister(struct btd_adapter *adapter)
+{
+	struct a2dp_server *server;
+
+	server = find_server(servers, adapter);
+	if (!server)
+		return;
+
+	g_slist_free_full(server->sources,
+					(GDestroyNotify) a2dp_unregister_sep);
+
+	if (server->source_record_id) {
 		remove_record_from_server(server->source_record_id);
+		server->source_record_id = 0;
+	}
 
 	if (server->sink_record_id)
-		remove_record_from_server(server->sink_record_id);
+		return;
 
-	btd_adapter_unref(server->adapter);
-	g_free(server);
+	a2dp_server_unregister(server);
 }
 
 struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
diff --git a/profiles/audio/a2dp.h b/profiles/audio/a2dp.h
index 54c3bf3..4819f7b 100644
--- a/profiles/audio/a2dp.h
+++ b/profiles/audio/a2dp.h
@@ -65,8 +65,9 @@ typedef void (*a2dp_stream_cb_t) (struct avdtp *session,
 					void *user_data);
 
 int a2dp_source_register(struct btd_adapter *adapter, GKeyFile *config);
+void a2dp_source_unregister(struct btd_adapter *adapter);
 int a2dp_sink_register(struct btd_adapter *adapter, GKeyFile *config);
-void a2dp_unregister(struct btd_adapter *adapter);
+void a2dp_sink_unregister(struct btd_adapter *adapter);
 
 struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
 				uint8_t codec, gboolean delay_reporting,
diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
index b6b2385..bb5688f 100644
--- a/profiles/audio/manager.c
+++ b/profiles/audio/manager.c
@@ -336,6 +336,7 @@ static int a2dp_source_server_probe(struct btd_profile *p,
 {
 	struct audio_adapter *adp;
 	const gchar *path = adapter_get_path(adapter);
+	int err;
 
 	DBG("path %s", path);
 
@@ -343,9 +344,27 @@ static int a2dp_source_server_probe(struct btd_profile *p,
 	if (!adp)
 		return -EINVAL;
 
-	audio_adapter_unref(adp); /* Referenced by a2dp server */
+	err = a2dp_source_register(adapter, config);
+	if (err < 0)
+		audio_adapter_unref(adp);
+
+	return err;
+}
+
+static void a2dp_source_server_remove(struct btd_profile *p,
+						struct btd_adapter *adapter)
+{
+	struct audio_adapter *adp;
+	const gchar *path = adapter_get_path(adapter);
+
+	DBG("path %s", path);
 
-	return a2dp_source_register(adapter, config);
+	adp = find_adapter(adapters, adapter);
+	if (!adp)
+		return;
+
+	a2dp_source_unregister(adapter);
+	audio_adapter_unref(adp);
 }
 
 static int a2dp_sink_server_probe(struct btd_profile *p,
@@ -353,6 +372,7 @@ static int a2dp_sink_server_probe(struct btd_profile *p,
 {
 	struct audio_adapter *adp;
 	const gchar *path = adapter_get_path(adapter);
+	int err;
 
 	DBG("path %s", path);
 
@@ -360,9 +380,27 @@ static int a2dp_sink_server_probe(struct btd_profile *p,
 	if (!adp)
 		return -EINVAL;
 
-	audio_adapter_unref(adp); /* Referenced by a2dp server */
+	err = a2dp_sink_register(adapter, config);
+	if (err < 0)
+		audio_adapter_unref(adp);
+
+	return err;
+}
+
+static void a2dp_sink_server_remove(struct btd_profile *p,
+						struct btd_adapter *adapter)
+{
+	struct audio_adapter *adp;
+	const gchar *path = adapter_get_path(adapter);
+
+	DBG("path %s", path);
 
-	return a2dp_sink_register(adapter, config);
+	adp = find_adapter(adapters, adapter);
+	if (!adp)
+		return;
+
+	a2dp_sink_unregister(adapter);
+	audio_adapter_unref(adp);
 }
 
 static int avrcp_server_probe(struct btd_profile *p,
@@ -446,6 +484,7 @@ static struct btd_profile a2dp_source_profile = {
 	.disconnect	= a2dp_source_disconnect,
 
 	.adapter_probe	= a2dp_source_server_probe,
+	.adapter_remove	= a2dp_source_server_remove,
 };
 
 static struct btd_profile a2dp_sink_profile = {
@@ -461,6 +500,7 @@ static struct btd_profile a2dp_sink_profile = {
 	.disconnect	= a2dp_sink_disconnect,
 
 	.adapter_probe	= a2dp_sink_server_probe,
+	.adapter_remove	= a2dp_sink_server_remove,
 };
 
 static struct btd_profile avrcp_profile = {
-- 
1.7.11.7


^ permalink raw reply related

* [PATCH BlueZ 2/2] audio: Remove adapter list
From: Luiz Augusto von Dentz @ 2012-12-19 14:29 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1355927348-19430-1-git-send-email-luiz.dentz@gmail.com>

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

btd_adapter is directly referenced by the drivers so there is no point
on keeping a list just for the audio adapters.
---
 profiles/audio/manager.c | 180 ++++++-----------------------------------------
 1 file changed, 21 insertions(+), 159 deletions(-)

diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
index bb5688f..9ad3bf6 100644
--- a/profiles/audio/manager.c
+++ b/profiles/audio/manager.c
@@ -75,7 +75,6 @@ struct audio_adapter {
 };
 
 static GKeyFile *config = NULL;
-static GSList *adapters = NULL;
 static GSList *devices = NULL;
 
 static struct enabled_interfaces enabled = {
@@ -84,19 +83,6 @@ static struct enabled_interfaces enabled = {
 	.control	= TRUE,
 };
 
-static struct audio_adapter *find_adapter(GSList *list,
-					struct btd_adapter *btd_adapter)
-{
-	for (; list; list = list->next) {
-		struct audio_adapter *adapter = list->data;
-
-		if (adapter->btd_adapter == btd_adapter)
-			return adapter;
-	}
-
-	return NULL;
-}
-
 static struct audio_device *get_audio_dev(struct btd_device *device)
 {
 	return manager_get_audio_device(device, TRUE);
@@ -284,191 +270,66 @@ static int avrcp_control_disconnect(struct btd_device *dev,
 	return control_disconnect(audio_dev);
 }
 
-static struct audio_adapter *audio_adapter_ref(struct audio_adapter *adp)
-{
-	adp->ref++;
-
-	DBG("%p: ref=%d", adp, adp->ref);
-
-	return adp;
-}
-
-static void audio_adapter_unref(struct audio_adapter *adp)
-{
-	adp->ref--;
-
-	DBG("%p: ref=%d", adp, adp->ref);
-
-	if (adp->ref > 0)
-		return;
-
-	adapters = g_slist_remove(adapters, adp);
-	btd_adapter_unref(adp->btd_adapter);
-	g_free(adp);
-}
-
-static struct audio_adapter *audio_adapter_create(struct btd_adapter *adapter)
-{
-	struct audio_adapter *adp;
-
-	adp = g_new0(struct audio_adapter, 1);
-	adp->btd_adapter = btd_adapter_ref(adapter);
-
-	return audio_adapter_ref(adp);
-}
-
-static struct audio_adapter *audio_adapter_get(struct btd_adapter *adapter)
-{
-	struct audio_adapter *adp;
-
-	adp = find_adapter(adapters, adapter);
-	if (!adp) {
-		adp = audio_adapter_create(adapter);
-		adapters = g_slist_append(adapters, adp);
-	} else
-		audio_adapter_ref(adp);
-
-	return adp;
-}
-
 static int a2dp_source_server_probe(struct btd_profile *p,
 						struct btd_adapter *adapter)
 {
-	struct audio_adapter *adp;
-	const gchar *path = adapter_get_path(adapter);
-	int err;
-
-	DBG("path %s", path);
-
-	adp = audio_adapter_get(adapter);
-	if (!adp)
-		return -EINVAL;
-
-	err = a2dp_source_register(adapter, config);
-	if (err < 0)
-		audio_adapter_unref(adp);
+	DBG("path %s", adapter_get_path(adapter));
 
-	return err;
+	return a2dp_source_register(adapter, config);
 }
 
 static void a2dp_source_server_remove(struct btd_profile *p,
 						struct btd_adapter *adapter)
 {
-	struct audio_adapter *adp;
-	const gchar *path = adapter_get_path(adapter);
-
-	DBG("path %s", path);
-
-	adp = find_adapter(adapters, adapter);
-	if (!adp)
-		return;
+	DBG("path %s", adapter_get_path(adapter));
 
 	a2dp_source_unregister(adapter);
-	audio_adapter_unref(adp);
 }
 
 static int a2dp_sink_server_probe(struct btd_profile *p,
 						struct btd_adapter *adapter)
 {
-	struct audio_adapter *adp;
-	const gchar *path = adapter_get_path(adapter);
-	int err;
-
-	DBG("path %s", path);
-
-	adp = audio_adapter_get(adapter);
-	if (!adp)
-		return -EINVAL;
-
-	err = a2dp_sink_register(adapter, config);
-	if (err < 0)
-		audio_adapter_unref(adp);
+	DBG("path %s", adapter_get_path(adapter));
 
-	return err;
+	return a2dp_sink_register(adapter, config);
 }
 
 static void a2dp_sink_server_remove(struct btd_profile *p,
 						struct btd_adapter *adapter)
 {
-	struct audio_adapter *adp;
-	const gchar *path = adapter_get_path(adapter);
-
-	DBG("path %s", path);
-
-	adp = find_adapter(adapters, adapter);
-	if (!adp)
-		return;
+	DBG("path %s", adapter_get_path(adapter));
 
 	a2dp_sink_unregister(adapter);
-	audio_adapter_unref(adp);
 }
 
 static int avrcp_server_probe(struct btd_profile *p,
 						struct btd_adapter *adapter)
 {
-	struct audio_adapter *adp;
-	const gchar *path = adapter_get_path(adapter);
-	int err;
-
-	DBG("path %s", path);
-
-	adp = audio_adapter_get(adapter);
-	if (!adp)
-		return -EINVAL;
-
-	err = avrcp_register(adapter, config);
-	if (err < 0)
-		audio_adapter_unref(adp);
+	DBG("path %s", adapter_get_path(adapter));
 
-	return err;
+	return avrcp_register(adapter, config);
 }
 
 static void avrcp_server_remove(struct btd_profile *p,
 						struct btd_adapter *adapter)
 {
-	struct audio_adapter *adp;
-	const gchar *path = adapter_get_path(adapter);
-
-	DBG("path %s", path);
-
-	adp = find_adapter(adapters, adapter);
-	if (!adp)
-		return;
+	DBG("path %s", adapter_get_path(adapter));
 
-	avrcp_unregister(adapter);
-	audio_adapter_unref(adp);
+	return avrcp_unregister(adapter);
 }
 
 static int media_server_probe(struct btd_adapter *adapter)
 {
-	struct audio_adapter *adp;
-	int err;
-
 	DBG("path %s", adapter_get_path(adapter));
 
-	adp = audio_adapter_get(adapter);
-	if (!adp)
-		return -EINVAL;
-
-	err = media_register(adapter);
-	if (err < 0)
-		audio_adapter_unref(adp);
-
-	return err;
+	return media_register(adapter);
 }
 
 static void media_server_remove(struct btd_adapter *adapter)
 {
-	struct audio_adapter *adp;
-
 	DBG("path %s", adapter_get_path(adapter));
 
-	adp = find_adapter(adapters, adapter);
-	if (!adp)
-		return;
-
 	media_unregister(adapter);
-	audio_adapter_unref(adp);
 }
 
 static struct btd_profile a2dp_source_profile = {
@@ -643,16 +504,17 @@ struct audio_device *manager_get_audio_device(struct btd_device *device,
 	return dev;
 }
 
-void manager_set_fast_connectable(gboolean enable)
+static void set_fast_connectable(struct btd_adapter *adapter, gpointer user_data)
 {
-	GSList *l;
+	gboolean enable = GPOINTER_TO_UINT(user_data);
 
-	for (l = adapters; l != NULL; l = l->next) {
-		struct audio_adapter *adapter = l->data;
+	if (btd_adapter_set_fast_connectable(adapter, enable))
+		error("Changing fast connectable for hci%d failed",
+						adapter_get_dev_id(adapter));
+}
 
-		if (btd_adapter_set_fast_connectable(adapter->btd_adapter,
-								enable))
-			error("Changing fast connectable for hci%d failed",
-				adapter_get_dev_id(adapter->btd_adapter));
-	}
+void manager_set_fast_connectable(gboolean enable)
+{
+	manager_foreach_adapter(set_fast_connectable,
+						GUINT_TO_POINTER(enable));
 }
-- 
1.7.11.7


^ permalink raw reply related

* Re: [PATCH] a2dp: Fix server unregister
From: Szymon Janc @ 2012-12-19 14:30 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <CABBYNZ+e7Wh4c2Cnexqi8KF01oFNruzFQBcLop=aaGROA3E8DQ@mail.gmail.com>

On Wednesday 19 of December 2012 16:12:39 Luiz Augusto von Dentz wrote:
> Hi Szymon,

Hi Luiz,

> 
> On Wed, Dec 19, 2012 at 3:51 PM, Szymon Janc <szymon.janc@tieto.com> wrote:
> > When removing sink or source unregister its sep and sdp record. When
> > both sink and source are unregistered also unregister a2dp server.
> > ---
> >  profiles/audio/a2dp.c    | 48 +++++++++++++++++++++++++++++++++++++++---------
> >  profiles/audio/a2dp.h    |  3 ++-
> >  profiles/audio/manager.c | 14 ++++++++++++++
> >  3 files changed, 55 insertions(+), 10 deletions(-)
> >
> > diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
> > index 145b1aa..3ec8b43 100644
> > --- a/profiles/audio/a2dp.c
> > +++ b/profiles/audio/a2dp.c
> > @@ -1224,7 +1224,20 @@ static void a2dp_unregister_sep(struct a2dp_sep *sep)
> >         g_free(sep);
> >  }
> >
> > -void a2dp_unregister(struct btd_adapter *adapter)
> > +static void a2dp_unregister(struct a2dp_server *server)
> > +{
> > +       if (server->sink_enabled || server->source_enabled)
> > +               return;
> > +
> > +       avdtp_exit(server->adapter);
> > +
> > +       servers = g_slist_remove(servers, server);
> > +
> > +       btd_adapter_unref(server->adapter);
> > +       g_free(server);
> > +}
> > +
> > +void a2dp_source_unregister(struct btd_adapter *adapter)
> >  {
> >         struct a2dp_server *server;
> >
> > @@ -1232,22 +1245,39 @@ void a2dp_unregister(struct btd_adapter *adapter)
> >         if (!server)
> >                 return;
> >
> > -       g_slist_free_full(server->sinks, (GDestroyNotify) a2dp_unregister_sep);
> > +       server->source_enabled = FALSE;
> > +
> >         g_slist_free_full(server->sources,
> >                                         (GDestroyNotify) a2dp_unregister_sep);
> > +       server->sources = NULL;
> >
> > -       avdtp_exit(adapter);
> > +       if (server->source_record_id > 0) {
> > +               remove_record_from_server(server->source_record_id);
> > +               server->source_record_id = 0;
> > +       }
> >
> > -       servers = g_slist_remove(servers, server);
> > +       a2dp_unregister(server);
> > +}
> >
> > -       if (server->source_record_id)
> > -               remove_record_from_server(server->source_record_id);
> > +void a2dp_sink_unregister(struct btd_adapter *adapter)
> > +{
> > +       struct a2dp_server *server;
> > +
> > +       server = find_server(servers, adapter);
> > +       if (!server)
> > +               return;
> > +
> > +       server->sink_enabled = FALSE;
> > +
> > +       g_slist_free_full(server->sinks, (GDestroyNotify) a2dp_unregister_sep);
> > +       server->sinks = NULL;
> >
> > -       if (server->sink_record_id)
> > +       if (server->sink_record_id > 0) {
> >                 remove_record_from_server(server->sink_record_id);
> > +               server->sink_record_id = 0;
> > +       }
> >
> > -       btd_adapter_unref(server->adapter);
> > -       g_free(server);
> > +       a2dp_unregister(server);
> >  }
> >
> >  struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
> > diff --git a/profiles/audio/a2dp.h b/profiles/audio/a2dp.h
> > index 54c3bf3..af5c27d 100644
> > --- a/profiles/audio/a2dp.h
> > +++ b/profiles/audio/a2dp.h
> > @@ -66,7 +66,8 @@ typedef void (*a2dp_stream_cb_t) (struct avdtp *session,
> >
> >  int a2dp_source_register(struct btd_adapter *adapter, GKeyFile *config);
> >  int a2dp_sink_register(struct btd_adapter *adapter, GKeyFile *config);
> > -void a2dp_unregister(struct btd_adapter *adapter);
> > +void a2dp_source_unregister(struct btd_adapter *adapter);
> > +void a2dp_sink_unregister(struct btd_adapter *adapter);
> >
> >  struct a2dp_sep *a2dp_add_sep(struct btd_adapter *adapter, uint8_t type,
> >                                 uint8_t codec, gboolean delay_reporting,
> > diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
> > index b6b2385..5e30fa8 100644
> > --- a/profiles/audio/manager.c
> > +++ b/profiles/audio/manager.c
> > @@ -348,6 +348,12 @@ static int a2dp_source_server_probe(struct btd_profile *p,
> >         return a2dp_source_register(adapter, config);
> >  }
> >
> > +static void a2dp_source_server_remove(struct btd_profile *p,
> > +                                               struct btd_adapter *adapter)
> > +{
> > +       a2dp_source_unregister(adapter);
> > +}
> > +
> >  static int a2dp_sink_server_probe(struct btd_profile *p,
> >                                                 struct btd_adapter *adapter)
> >  {
> > @@ -365,6 +371,12 @@ static int a2dp_sink_server_probe(struct btd_profile *p,
> >         return a2dp_sink_register(adapter, config);
> >  }
> >
> > +static void a2dp_sink_server_remove(struct btd_profile *p,
> > +                                               struct btd_adapter *adapter)
> > +{
> > +       a2dp_sink_unregister(adapter);
> > +}
> > +
> >  static int avrcp_server_probe(struct btd_profile *p,
> >                                                 struct btd_adapter *adapter)
> >  {
> > @@ -446,6 +458,7 @@ static struct btd_profile a2dp_source_profile = {
> >         .disconnect     = a2dp_source_disconnect,
> >
> >         .adapter_probe  = a2dp_source_server_probe,
> > +       .adapter_remove = a2dp_source_server_remove,
> >  };
> >
> >  static struct btd_profile a2dp_sink_profile = {
> > @@ -461,6 +474,7 @@ static struct btd_profile a2dp_sink_profile = {
> >         .disconnect     = a2dp_sink_disconnect,
> >
> >         .adapter_probe  = a2dp_sink_server_probe,
> > +       .adapter_remove = a2dp_sink_server_remove,
> >  };
> >
> >  static struct btd_profile avrcp_profile = {
> > --
> > 1.8.0
> 
> I have a very similar fix to push, I end up doing it because the whole
> btd_adapter reference got broken so I would like to push it if you
> don't mind.

I don't :-)

-- 
BR
Szymon Janc

^ permalink raw reply

* Re: [PATCH BlueZ 1/2] audio: Fix not releasing all references to btd_adapter
From: Johan Hedberg @ 2012-12-19 14:41 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1355927348-19430-1-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

On Wed, Dec 19, 2012, Luiz Augusto von Dentz wrote:
> A2DP server now take a reference to btd_adapter which needs to be
> released properly once the adapter is unplugged.
> ---
>  profiles/audio/a2dp.c    | 44 +++++++++++++++++++++++++++++++++++---------
>  profiles/audio/a2dp.h    |  3 ++-
>  profiles/audio/manager.c | 48 ++++++++++++++++++++++++++++++++++++++++++++----
>  3 files changed, 81 insertions(+), 14 deletions(-)

Both patches have been applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH BlueZ] build: Check for UDEV before setting rulesdir/rules_DATA
From: Anderson Lizardo @ 2012-12-19 15:05 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1355925987.1827.5.camel@aeonflux>

Hi Marcel,

On Wed, Dec 19, 2012 at 10:06 AM, Marcel Holtmann <marcel@holtmann.org> wrote:
> On a side note, you fix has the issue that EXTRA_DIST is now skipped and
> that means it would have broken make distcheck by not including the
> actual rule file.

Sorry about that. I actually seen this error (it causes a "cp
tools/hid2hci.rules tools/hid2hci.rules"). But I thought it was due to
another patch that I was going to send, that removed but forgot to
retest.

I'll pay more attention next time ;)

Thanks,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply

* Re: [PATCH v5 11/16] sbc: Add SBC_MSBC flag to enable 15 block encoding
From: Marcel Holtmann @ 2012-12-19 17:41 UTC (permalink / raw)
  To: Frédéric Dalleau; +Cc: linux-bluetooth
In-Reply-To: <1355497417-10357-12-git-send-email-frederic.dalleau@linux.intel.com>

Hi Fred,

> The sbc API provides a flag parameter which is currently unused. This patch
> defines the SBC_MSBC flag. The meaning of this flag is to encode 15 blocks.
> ---
>  sbc/sbc.c |   35 +++++++++++++++++++++++++++--------
>  sbc/sbc.h |    3 +++
>  2 files changed, 30 insertions(+), 8 deletions(-)

I rather have it done with

	sbc_init_msbc(sbc_t *sbc, unsigned long flags);

Regards

Marcel



^ permalink raw reply

* Re: [PATCH] gdbus: Fix double free when calling g_dbus_remove_all_watches
From: Lucas De Marchi @ 2012-12-19 17:50 UTC (permalink / raw)
  To: Tomasz Bursztyka; +Cc: linux-bluetooth
In-Reply-To: <1355918497-21944-1-git-send-email-tomasz.bursztyka@linux.intel.com>

On Wed, Dec 19, 2012 at 10:01 AM, Tomasz Bursztyka
<tomasz.bursztyka@linux.intel.com> wrote:
> Valgrind output:
> ==21779== Invalid free() / delete / delete[] / realloc()
> ==21779==    at 0x4A080BC: free (vg_replace_malloc.c:427)
> ==21779==    by 0x406700: filter_data_free (watch.c:285)
> ==21779==    by 0x406D92: g_dbus_remove_all_watches (watch.c:315)
> ==21779==    by 0x408787: connman_interface_finalize (interface.c:99)
> ==21779==    by 0x40EA14: main (main.c:113)
> ==21779==  Address 0x6893810 is 0 bytes inside a block of size 56 free'd
> ==21779==    at 0x4A080BC: free (vg_replace_malloc.c:427)
> ==21779==    by 0x406D81: g_dbus_remove_all_watches (watch.c:309)
> ==21779==    by 0x408787: connman_interface_finalize (interface.c:99)
> ==21779==    by 0x40EA14: main (main.c:113)
> ---
> Hi Johan,
>
> I finally put the valgrind output, since backtrace is actually useless:
>
> *** glibc detected *** ./project: double free or corruption (fasttop): 0x000000000075b5a0 ***
> ======= Backtrace: =========
> /lib64/libc.so.6(+0x7adf5)[0x7f6701e5adf5]
> ./project[0x4066b1]
> ./project[0x406d43]
> ./project[0x408738]
> ./project[0x40e9a5]
> /lib64/libc.so.6(__libc_start_main+0xfd)[0x7f6701e024bd]
> ./project[0x4053f9]
>
> Anyway, this bug was never found before for a good reason: no projects (but mine) uses g_dbus_remove_all_watches()
>
>  gdbus/watch.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/gdbus/watch.c b/gdbus/watch.c
> index 9e4f994..9451d5d 100644
> --- a/gdbus/watch.c
> +++ b/gdbus/watch.c
> @@ -309,6 +309,9 @@ static void filter_data_call_and_free(struct filter_data *data)
>                 g_free(cb);
>         }
>
> +       g_slist_free(data->callbacks);
> +       data->callbacks = NULL;
> +


why not just removing the g_free(cb)  above?


Lucas De Marchi

^ permalink raw reply

* Re: [PATCH BlueZ 8/8] hog: Rename hog_device_unregister
From: Johan Hedberg @ 2012-12-19 22:01 UTC (permalink / raw)
  To: Andre Guedes; +Cc: linux-bluetooth
In-Reply-To: <1355924526-961-1-git-send-email-andre.guedes@openbossa.org>

Hi Andre,

On Wed, Dec 19, 2012, Andre Guedes wrote:
> This patch renames hog_device_unregister function to hog_unregister_
> device.
> ---
>  profiles/input/hog.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

All patches in this set have been applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH] monitor: Fix crash in btmon
From: Marcel Holtmann @ 2012-12-20  1:31 UTC (permalink / raw)
  To: Frédéric Danis; +Cc: linux-bluetooth
In-Reply-To: <1355923202-16648-1-git-send-email-frederic.danis@linux.intel.com>

Hi Fred,

> When retrieving SDP records from keyboard btmon crashes (see below).
> 
> The tid_list in sdp.c is filled up by SDP Service search request,
> as Service Search responses are treated as invalid and do not free
> tid_list entries.
> 
> This is due to passing last fragment instead of complete frame to
> l2cap_frame().

patch has been applied.

Regards

Marcel



^ permalink raw reply

* Question for setting IO capability parameter for RegisterAgent
From: Xian Pan @ 2012-12-20  2:18 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

I confuse the relationship between the 4 pairing mode in SSP with the IO capability parameter for the agent. From the agent-api.txt file, the capability parameter can have 5 values: DisplayOnly, DisplayYesNo, KeyboardOnly, NoInputNoOutput and KeyboardDisplay. I think there are only 4 pairing mode in SSP: just works, numeric comparison, out of band, and passkey entry. How the 5 IO capabilities can map to those 4 pairing modes?

Thanks a lot.

BEST
Xian

^ permalink raw reply

* Authentication Rejected when pairing stereo headset
From: Andrey Voropaev @ 2012-12-20  7:41 UTC (permalink / raw)
  To: linux-bluetooth

Hi! I'm trying to pair my bluetooth headset BTH220. In PC I have USB dongle

# hciconfig -a
hci0:   Type: BR/EDR  Bus: USB
   BD Address: 00:02:5B:00:1C:7B  ACL MTU: 310:10  SCO MTU: 64:8
   UP RUNNING PSCAN
   RX bytes:12771 acl:0 sco:0 events:221 errors:0
   TX bytes:1431 acl:0 sco:0 commands:96 errors:0
   Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x59 0x83
   Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
   Link policy: RSWITCH HOLD SNIFF PARK
   Link mode: SLAVE ACCEPT
   Name: 'vandal-0'
   Class: 0x420100
   Service Classes: Networking, Telephony
   Device Class: Computer, Uncategorized
   HCI Version: 2.1 (0x4)  Revision: 0x149c
   LMP Version: 2.1 (0x4)  Subversion: 0x149c
   Manufacturer: Cambridge Silicon Radio (10)


But when I try 'simple-agent hci0 XX:XX:XX' I always get error

Creating device failed: org.bluez.Error.AuthenticationRejected:
Authentication Rejected


I'm doing everything as root, so what could be the reason for
"Authentication Rejected"? Incompatible hardware? Wrong configuration?

In which direction should I be searching?

Thank you
Andrei Voropaev

^ permalink raw reply

* Re: [PATCH] gdbus: Fix double free when calling g_dbus_remove_all_watches
From: Tomasz Bursztyka @ 2012-12-20  7:46 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: linux-bluetooth
In-Reply-To: <CAMOw1v40+w62ToR4SKnNLnKfLzBSz_MKK1fXwoW66z7cXbTw4A@mail.gmail.com>

Hi Lucas,

> @@ -309,6 +309,9 @@ static void filter_data_call_and_free(struct filter_data *data)
>                  g_free(cb);
>          }
>
> +       g_slist_free(data->callbacks);
> +       data->callbacks = NULL;
> +
>
> why not just removing the g_free(cb)  above?
>

I did so to avoid filter_data_free() to go through the list once again,
but indeed if the list is not going to be big, it's superfluous then.

Tomasz

^ permalink raw reply

* Re: Question for setting IO capability parameter for RegisterAgent
From: Johan Hedberg @ 2012-12-20  7:55 UTC (permalink / raw)
  To: Xian Pan; +Cc: linux-bluetooth
In-Reply-To: <679160B2-3B1E-4D5E-978E-E3358F6126E9@gmail.com>

Hi Xian,

On Wed, Dec 19, 2012, Xian Pan wrote:
> I confuse the relationship between the 4 pairing mode in SSP with the
> IO capability parameter for the agent. From the agent-api.txt file,
> the capability parameter can have 5 values: DisplayOnly, DisplayYesNo,
> KeyboardOnly, NoInputNoOutput and KeyboardDisplay. I think there are
> only 4 pairing mode in SSP: just works, numeric comparison, out of
> band, and passkey entry. How the 5 IO capabilities can map to those 4
> pairing modes?

Low Energy SMP based pairing introduces the additional KeyboardDisplay
IO capability. If you want to support LE it's recommended you provide
that as your agent capability and BlueZ will then automatically
downgrade it to DisplayYesNo for BR/EDR (SSP) pairing and use it as is
for LE SMP pairing.

Johan

^ permalink raw reply

* Re: Authentication Rejected when pairing stereo headset
From: Johan Hedberg @ 2012-12-20  8:04 UTC (permalink / raw)
  To: Andrey Voropaev; +Cc: linux-bluetooth
In-Reply-To: <CAFOXTdcaRvGHesU_J7rW93Yp_5d438+x5xryCzAhY9QQL_-Y4Q@mail.gmail.com>

Hi Andrey,

On Thu, Dec 20, 2012, Andrey Voropaev wrote:
> when I try 'simple-agent hci0 XX:XX:XX' I always get error
> 
> Creating device failed: org.bluez.Error.AuthenticationRejected:
> Authentication Rejected
> 
> I'm doing everything as root, so what could be the reason for
> "Authentication Rejected"? Incompatible hardware? Wrong configuration?
> 
> In which direction should I be searching?

The bluetoothd debug logs (run with -d switch) would be interesting as
well as the HCI level trace (for which you can use e.g. hcidump).

Johan

^ permalink raw reply

* Re: Authentication Rejected when pairing stereo headset
From: Andrey Voropaev @ 2012-12-20  9:02 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <20121220080447.GA561@x220>

I've copied the output from hcidump -w to http://vandal.sdf-eu.org/hcidump.file

So far, I'm not sure how to add -d switch to bluetoothd. It is started
via dbus and this monster is not familiar to me. Can you please tell
me, which file should I edit to add the switch?

Andrey

On Thu, Dec 20, 2012 at 9:04 AM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> Hi Andrey,
>
> On Thu, Dec 20, 2012, Andrey Voropaev wrote:
>> when I try 'simple-agent hci0 XX:XX:XX' I always get error
>>
>> Creating device failed: org.bluez.Error.AuthenticationRejected:
>> Authentication Rejected
>>
>> I'm doing everything as root, so what could be the reason for
>> "Authentication Rejected"? Incompatible hardware? Wrong configuration?
>>
>> In which direction should I be searching?
>
> The bluetoothd debug logs (run with -d switch) would be interesting as
> well as the HCI level trace (for which you can use e.g. hcidump).
>
> 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