Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] build: Remove left over of gstreamer removal
From: Luiz Augusto von Dentz @ 2012-12-10 12:02 UTC (permalink / raw)
  To: linux-bluetooth

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

---
 profiles/audio/rtp.h | 76 ----------------------------------------------------
 1 file changed, 76 deletions(-)
 delete mode 100644 profiles/audio/rtp.h

diff --git a/profiles/audio/rtp.h b/profiles/audio/rtp.h
deleted file mode 100644
index 45fddcf..0000000
--- a/profiles/audio/rtp.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2004-2010  Marcel Holtmann <marcel@holtmann.org>
- *
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2.1 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-
-struct rtp_header {
-	unsigned cc:4;
-	unsigned x:1;
-	unsigned p:1;
-	unsigned v:2;
-
-	unsigned pt:7;
-	unsigned m:1;
-
-	uint16_t sequence_number;
-	uint32_t timestamp;
-	uint32_t ssrc;
-	uint32_t csrc[0];
-} __attribute__ ((packed));
-
-struct rtp_payload {
-	unsigned frame_count:4;
-	unsigned rfa0:1;
-	unsigned is_last_fragment:1;
-	unsigned is_first_fragment:1;
-	unsigned is_fragmented:1;
-} __attribute__ ((packed));
-
-#elif __BYTE_ORDER == __BIG_ENDIAN
-
-struct rtp_header {
-	unsigned v:2;
-	unsigned p:1;
-	unsigned x:1;
-	unsigned cc:4;
-
-	unsigned m:1;
-	unsigned pt:7;
-
-	uint16_t sequence_number;
-	uint32_t timestamp;
-	uint32_t ssrc;
-	uint32_t csrc[0];
-} __attribute__ ((packed));
-
-struct rtp_payload {
-	unsigned is_fragmented:1;
-	unsigned is_first_fragment:1;
-	unsigned is_last_fragment:1;
-	unsigned rfa0:1;
-	unsigned frame_count:4;
-} __attribute__ ((packed));
-
-#else
-#error "Unknown byte order"
-#endif
-- 
1.7.11.7


^ permalink raw reply related

* Re: BLE issue: Start_LE_Encryption fails
From: Ajay @ 2012-12-09  1:59 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <CAJdJm_Miiidw08Tk2-6mtoDFQ0uhyez=H+NKRK-2UYjyTQ9d1A@mail.gmail.com>

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

On Thursday 06 December 2012 04:20 PM, Anderson Lizardo wrote:
> Hi Ajay,
>
> On Tue, Dec 4, 2012 at 2:49 PM, Ajay <ajay.kv@globaledgesoft.com> wrote:
>> SLAVE side
>>
>> root@test:/home#  hcitool -i hci0 cmd 0x08 0x0008 03 02 01 06 \
>>
>>                          $(perl -e 'print "00 " x 28')
>> root@test:/home# hciconfig hci0  leadv
>>
>>
>> Hcidump shows ..
>>
>> < HCI Command: LE Set Advertising Data (0x08|0x0008) plen 32
>>> HCI Event: Command Complete (0x0e) plen 4
>>      LE Set Advertising Data (0x08|0x0008) ncmd 1
>>      status 0x00
>> < HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1
>>> HCI Event: Command Complete (0x0e) plen 4
>>      LE Set Advertise Enable (0x08|0x000a) ncmd 1
>>      status 0x00
>>
>>> HCI Event: LE Meta Event (0x3e) plen 19
>>      LE Connection Complete
>>        status 0x00 handle 64, role slave
>>        bdaddr 00:02:72:D6:AB:AD (Public)
>>> ACL data: handle 64 flags 0x02 dlen 11
>>      ATT: Read By Group req (0x10)
>>        start 0x0001, end 0xffff
>>        type-uuid 0x2800
>
> Your slave device is not answering to the Read By Group request,
> therefore the master side is disconnecting due to timeout.
>
> I suggest you first try using gatttool on the master side to connect
> to the slave, and run "primary" to see if it is processing GATT
> requests.
>
> The bluez log from the slave side should help (I assume you are
> running BlueZ on the slave side).
>
> Regards,
>


Hi,
     I tried  "gatttool  -i hci0 -b <remote bdaddr> --primary " on 
master side  ,which creates   LE link and very next moment disconnects . 
How can i change the security level  of the link to medium?. still 
struggling to pair the device  (atleast "smp just works") ) . Is my 
kernel supportive (3.2.5)

	  few lines of code from the kernel (/net/bluetooth/smp.c)
	

int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level)
{
         struct hci_conn *hcon = conn->hcon;
         struct smp_chan *smp = conn->smp_chan;

         BT_DBG("conn %p hcon %p level 0x%2.2x", conn, hcon, sec_level);

         if (!lmp_host_le_capable(hcon->hdev))
                 return 1;

         if (sec_level == BT_SECURITY_LOW)
                 return 1;

         if (hcon->sec_level >= sec_level)
                 return 1;

         if (hcon->link_mode & HCI_LM_MASTER)
                 if (smp_ltk_encrypt(conn))
                         goto done;

         if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->pend))
                 return 0;

         smp = smp_chan_create(conn);

         if (hcon->link_mode & HCI_LM_MASTER) {
                 struct smp_cmd_pairing cp;

                 build_pairing_cmd(conn, &cp, NULL, SMP_AUTH_NONE);
                 smp->preq[0] = SMP_CMD_PAIRING_REQ;
                 memcpy(&smp->preq[1], &cp, sizeof(cp));

                 smp_send_cmd(conn, SMP_CMD_PAIRING_REQ, sizeof(cp), &cp);


	Every time on LE create connection  process 	i	,smp_conn_security() 
getting called from hci layer .
   But  if(host_le_capable(hcon->hdev))
                 return 1;
condition returns without even checking the security level . so kindly 
show me the right way..	

   	

-- 
Thanks & Regards

  AJAY KV
  GlobalEdge software Ltd
  8892753703

[-- Attachment #2: ajay_kv.vcf --]
[-- Type: text/x-vcard, Size: 74 bytes --]

begin:vcard
fn:AJAY KV
n:;AJAY
tel;cell:8892753703
version:2.1
end:vcard


^ permalink raw reply

* Re: [PATCH] gitignore: Add test/bluezutils.pyc
From: Johan Hedberg @ 2012-12-08 11:45 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1354873361-13940-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Fri, Dec 07, 2012, Szymon Janc wrote:
> Python generates compiled module file when py module is used.
> ---
>  .gitignore |    1 +
>  1 file changed, 1 insertion(+)

Applied. Thanks.

Johan

^ permalink raw reply

* [PATCH ] Bluetooth: Remove unnecessary include l2cap.h.
From: Rami Rosen @ 2012-12-08  5:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: marcel, gustavo, johan.hedberg, Rami Rosen

This patch removes unnecessary include of <net/bluetooth/l2cap.h>
in bluetooth/bnep/core.c.

Signed-off-by: Rami Rosen <ramirose@gmail.com>
---
 net/bluetooth/bnep/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index a5b6397..e430b1a 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -33,7 +33,6 @@
 
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci_core.h>
-#include <net/bluetooth/l2cap.h>
 
 #include "bnep.h"
 
-- 
1.7.11.7

^ permalink raw reply related

* [RFC BlueZ v1] media-api: Add org.bluez.MediaLibrary1
From: Luiz Augusto von Dentz @ 2012-12-07 14:47 UTC (permalink / raw)
  To: linux-bluetooth

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

This interface adds support for browsing and searching in the player's
storage using AVRCP 1.4/1.5.

Some remarks about the design:

  - Exposing UIDCounter and UIDs was considered, but the spec seems to have
    missed to define the player's id persistency. There are also the fact that
    UIDCounter alone does not guarantee persistency across sessions and do not
    provide what exact items have changed, so in the end exposing these
    details will bring almost no value.
  - Indexing or caching the whole media library is not recommended, Bluetooth
    is too slow for that and even vendors such as Apple do not recommend doing
    it, so the only items keep in cache are the current listed ones.
  - Addressed vs Browsed player is done implicitly when accessed, this was done
    to simplify the API and avoid confusions between applications and players.
---
v1: Rename to MediaLibrary and add versioning, also rename Properties filter
to attributes and don't use camel case for values.

 doc/media-api.txt | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 173 insertions(+)

diff --git a/doc/media-api.txt b/doc/media-api.txt
index 1865df9..0926e43 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -219,6 +219,179 @@ Properties	string Equalizer [readwrite]
 			possible to signal its end by setting position to the
 			maximum uint32 value.
 
+		string Name [readonly]
+
+			Player name
+
+		boolean Browsable [readonly]
+
+			If present indicates the player can be browsed using
+			MediaLibrary interface.
+
+			Possible values:
+
+				True: Supported and active
+				False: Supported but inactive
+
+			Note: If supported but inactive clients can enable it
+			by using MediaLibrary interface but it might interfere
+			in the playback of other players.
+
+
+		boolean Searchable [readonly]
+
+			If present indicates the player can be searched using
+			MediaLibrary interface.
+
+			Possible values:
+
+				True: Supported and active
+				False: Supported but inactive
+
+			Note: If supported but inactive clients can enable it
+			by using MediaLibrary interface but it might interfere
+			in the playback of other players.
+
+		array{string} Buttons [readonly]
+
+			If available indicates the buttons supported by the
+			player.
+
+			Possible values:
+
+				"Play", "Pause", "Stop", "Next", "Previous",
+				"FastForward" and "Rewind"
+
+			Default value: All
+
+MediaLibrary1 hierarchy
+=======================
+
+Service		unique name (Target role)
+		org.bluez (Controller role)
+Interface	org.bluez.MediaLibrary1
+Object path	freely definable (Target role)
+		[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX
+		(Controller role)
+
+Methods		array{objects, properties} Search(string value, dict filter)
+
+			Return a list of MediaItem found
+
+		array{objects, properties} ListItems(dict filter)
+
+			Return a list of MediaItem found
+
+		void ChangeFolder(string path)
+
+			Change current folder, support both relative or
+			absolute paths.
+
+Properties	uint32 NumberOfItems:
+
+			Number of items in the current folder
+
+		string Path:
+
+			Current path:
+
+			Possible values: "/root/folder" or "/NowPlaying"
+
+			Note: /NowPlaying might not be listed if player is
+			stopped
+
+Filters		uint32 Start:
+
+			Offset of the first item.
+
+			Default value: 0
+
+		uint32 End:
+
+			Offset of the last item.
+
+			Default value: NumbeOfItems
+
+		array{string} Attributes
+
+			Item properties that should be included in the list.
+
+			Possible Values:
+
+				"title", "artist", "album", "genre",
+				"number-of-tracks", "number", "duration"
+
+			Default Value: All
+
+MediaItem1 hierarchy
+====================
+
+Service		unique name (Target role)
+		org.bluez (Controller role)
+Interface	org.bluez.MediaItem1
+Object path	freely definable (Target role)
+		[variable
+		prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX/itemX
+		(Controller role)
+
+Methods		void Play()
+
+			Play item
+
+		void AddtoNowPlaying()
+
+			Add item to now playing list
+
+Properties	string Name [readonly]
+
+			Item displayable name
+
+		boolean Folder [readonly]
+
+			Indicates whether the item is a folder
+
+		string Type [readonly]
+
+			Item type
+
+			Possible values:
+
+				Folder: "Mixed", "Titles", "Albums", "Artists"
+				Other Items: "Video", "Audio"
+
+		boolean Playable [readonly]
+
+			Indicates if the item can be played
+
+		string Title:
+
+			Item title name
+
+		string Artist:
+
+			Item artist name
+
+		string Album:
+
+			Item album name
+
+		string Genre:
+
+			Item genre name
+
+		uint32 NumberOfTracks:
+
+			Item album number of tracks in total
+
+		uint32 Number:
+
+			Item album number
+
+		uint32 Duration:
+
+			Item duration in milliseconds
+
+
 MediaEndpoint1 hierarchy
 ========================
 
-- 
1.7.11.7


^ permalink raw reply related

* [RFC 5/5] Bluetooth: AMP: Use set_bit / test_bit for amp_mgr state
From: Andrei Emeltchenko @ 2012-12-07 12:59 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1354885148-4677-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Using bit operations solves problems with multiple requests
and clearing state.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/a2mp.h |    2 +-
 net/bluetooth/a2mp.c         |    6 +++---
 net/bluetooth/amp.c          |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/net/bluetooth/a2mp.h b/include/net/bluetooth/a2mp.h
index 8b39327..487b54c 100644
--- a/include/net/bluetooth/a2mp.h
+++ b/include/net/bluetooth/a2mp.h
@@ -34,7 +34,7 @@ struct amp_mgr {
 	struct kref		kref;
 	__u8			ident;
 	__u8			handle;
-	enum amp_mgr_state	state;
+	unsigned long		state;
 	unsigned long		flags;
 
 	struct list_head	amp_ctrls;
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index c960c20..50d2771 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -290,7 +290,7 @@ static int a2mp_getinfo_req(struct amp_mgr *mgr, struct sk_buff *skb,
 		goto done;
 	}
 
-	mgr->state = READ_LOC_AMP_INFO;
+	set_bit(READ_LOC_AMP_INFO, &mgr->state);
 	hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_INFO, 0, NULL);
 
 done:
@@ -506,7 +506,7 @@ send_rsp:
 		a2mp_send(mgr, A2MP_CREATEPHYSLINK_RSP, hdr->ident,
 			  sizeof(rsp), &rsp);
 	} else {
-		mgr->state = WRITE_REMOTE_AMP_ASSOC;
+		set_bit(WRITE_REMOTE_AMP_ASSOC, &mgr->state);
 		mgr->ident = hdr->ident;
 	}
 
@@ -848,7 +848,7 @@ struct amp_mgr *amp_mgr_lookup_by_state(u8 state)
 
 	mutex_lock(&amp_mgr_list_lock);
 	list_for_each_entry(mgr, &amp_mgr_list, list) {
-		if (mgr->state == state) {
+		if (test_and_clear_bit(state, &mgr->state)) {
 			amp_mgr_get(mgr);
 			mutex_unlock(&amp_mgr_list_lock);
 			return mgr;
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index f55d3f2..1bbb59d 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -236,7 +236,7 @@ void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr)
 
 	cp.max_len = cpu_to_le16(hdev->amp_assoc_size);
 
-	mgr->state = READ_LOC_AMP_ASSOC;
+	set_bit(READ_LOC_AMP_ASSOC, &mgr->state);
 	hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp);
 }
 
@@ -250,7 +250,7 @@ void amp_read_loc_assoc_final_data(struct hci_dev *hdev,
 	cp.len_so_far = cpu_to_le16(0);
 	cp.max_len = cpu_to_le16(hdev->amp_assoc_size);
 
-	mgr->state = READ_LOC_AMP_ASSOC_FINAL;
+	set_bit(READ_LOC_AMP_ASSOC_FINAL, &mgr->state);
 
 	/* Read Local AMP Assoc final link information data */
 	hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp);
-- 
1.7.10.4


^ permalink raw reply related

* [RFC 4/5] Bluetooth: AMP: Remove dead code
From: Andrei Emeltchenko @ 2012-12-07 12:59 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1354885148-4677-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Remove code which cannot execute. l2cap_conn_add for AMP_LINK
might only be invoked when receiving data in l2cap_recv_acldata.
But this case is checked in the first statement there.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/l2cap_core.c |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index d4a44dc..4976d12 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1527,17 +1527,12 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status)
 	BT_DBG("hcon %p conn %p hchan %p", hcon, conn, hchan);
 
 	switch (hcon->type) {
-	case AMP_LINK:
-		conn->mtu = hcon->hdev->block_mtu;
-		break;
-
 	case LE_LINK:
 		if (hcon->hdev->le_mtu) {
 			conn->mtu = hcon->hdev->le_mtu;
 			break;
 		}
 		/* fall through */
-
 	default:
 		conn->mtu = hcon->hdev->acl_mtu;
 		break;
-- 
1.7.10.4


^ permalink raw reply related

* [RFC 3/5] Bluetooth: AMP: Clean up logical link create / accept
From: Andrei Emeltchenko @ 2012-12-07 12:59 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1354885148-4677-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Use chan->hs_hcon instead of lookup by dst address.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/amp.c |   17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 88720e8..f55d3f2 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -407,26 +407,20 @@ void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon)
 
 void amp_create_logical_link(struct l2cap_chan *chan)
 {
+	struct hci_conn *hs_hcon = chan->hs_hcon;
 	struct hci_cp_create_accept_logical_link cp;
-	struct hci_conn *hcon;
 	struct hci_dev *hdev;
 
-	BT_DBG("chan %p", chan);
+	BT_DBG("chan %p hs_hcon %p dst %pMR", chan, hs_hcon, chan->conn->dst);
 
-	if (!chan->hs_hcon)
+	if (!hs_hcon)
 		return;
 
 	hdev = hci_dev_hold(chan->hs_hcon->hdev);
 	if (!hdev)
 		return;
 
-	BT_DBG("chan %p dst %pMR", chan, chan->conn->dst);
-
-	hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, chan->conn->dst);
-	if (!hcon)
-		goto done;
-
-	cp.phy_handle = hcon->handle;
+	cp.phy_handle = hs_hcon->handle;
 
 	cp.tx_flow_spec.id = chan->local_id;
 	cp.tx_flow_spec.stype = chan->local_stype;
@@ -442,14 +436,13 @@ void amp_create_logical_link(struct l2cap_chan *chan)
 	cp.rx_flow_spec.acc_lat = cpu_to_le32(chan->remote_acc_lat);
 	cp.rx_flow_spec.flush_to = cpu_to_le32(chan->remote_flush_to);
 
-	if (hcon->out)
+	if (hs_hcon->out)
 		hci_send_cmd(hdev, HCI_OP_CREATE_LOGICAL_LINK, sizeof(cp),
 			     &cp);
 	else
 		hci_send_cmd(hdev, HCI_OP_ACCEPT_LOGICAL_LINK, sizeof(cp),
 			     &cp);
 
-done:
 	hci_dev_put(hdev);
 }
 
-- 
1.7.10.4


^ permalink raw reply related

* [RFC 2/5] Bluetooth: AMP: Send A2MP Create Phylink Rsp after Assoc write
From: Andrei Emeltchenko @ 2012-12-07 12:59 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1354885148-4677-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Postpone sending A2MP Create Phylink Response till we got successful
HCI Command Complete after HCI Write Remote AMP Assoc.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/a2mp.h |    2 ++
 net/bluetooth/a2mp.c         |   38 ++++++++++++++++++++++++++++++++++++--
 net/bluetooth/amp.c          |    6 +++++-
 3 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/include/net/bluetooth/a2mp.h b/include/net/bluetooth/a2mp.h
index 42f2176..8b39327 100644
--- a/include/net/bluetooth/a2mp.h
+++ b/include/net/bluetooth/a2mp.h
@@ -23,6 +23,7 @@ enum amp_mgr_state {
 	READ_LOC_AMP_INFO,
 	READ_LOC_AMP_ASSOC,
 	READ_LOC_AMP_ASSOC_FINAL,
+	WRITE_REMOTE_AMP_ASSOC,
 };
 
 struct amp_mgr {
@@ -144,5 +145,6 @@ void a2mp_discover_amp(struct l2cap_chan *chan);
 void a2mp_send_getinfo_rsp(struct hci_dev *hdev);
 void a2mp_send_getampassoc_rsp(struct hci_dev *hdev, u8 status);
 void a2mp_send_create_phy_link_req(struct hci_dev *hdev, u8 status);
+void a2mp_send_create_phy_link_rsp(struct hci_dev *hdev, u8 status);
 
 #endif /* __A2MP_H */
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 2f67d5e..c960c20 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -499,8 +499,16 @@ send_rsp:
 	if (hdev)
 		hci_dev_put(hdev);
 
-	a2mp_send(mgr, A2MP_CREATEPHYSLINK_RSP, hdr->ident, sizeof(rsp),
-		  &rsp);
+	/* Reply error now and succes after HCI Write Remote AMP Assoc
+	   command complete with success status
+	 */
+	if (rsp.status != A2MP_STATUS_SUCCESS) {
+		a2mp_send(mgr, A2MP_CREATEPHYSLINK_RSP, hdr->ident,
+			  sizeof(rsp), &rsp);
+	} else {
+		mgr->state = WRITE_REMOTE_AMP_ASSOC;
+		mgr->ident = hdr->ident;
+	}
 
 	skb_pull(skb, le16_to_cpu(hdr->len));
 	return 0;
@@ -949,6 +957,32 @@ clean:
 	kfree(req);
 }
 
+void a2mp_send_create_phy_link_rsp(struct hci_dev *hdev, u8 status)
+{
+	struct amp_mgr *mgr;
+	struct a2mp_physlink_rsp rsp;
+	struct hci_conn *hs_hcon;
+
+	mgr = amp_mgr_lookup_by_state(WRITE_REMOTE_AMP_ASSOC);
+	if (!mgr)
+		return;
+
+	hs_hcon = hci_conn_hash_lookup_state(hdev, AMP_LINK, BT_CONNECT);
+	if (!hs_hcon) {
+		rsp.status = A2MP_STATUS_UNABLE_START_LINK_CREATION;
+	} else {
+		rsp.remote_id = hs_hcon->remote_id;
+		rsp.status = A2MP_STATUS_SUCCESS;
+	}
+
+	BT_DBG("%s mgr %p hs_hcon %p status %u", hdev->name, mgr, hs_hcon,
+	       status);
+
+	rsp.local_id = hdev->id;
+	a2mp_send(mgr, A2MP_CREATEPHYSLINK_RSP, mgr->ident, sizeof(rsp), &rsp);
+	amp_mgr_put(mgr);
+}
+
 void a2mp_discover_amp(struct l2cap_chan *chan)
 {
 	struct l2cap_conn *conn = chan->conn;
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 1b0d92c..88720e8 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -317,7 +317,11 @@ void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle)
 	if (!hcon)
 		return;
 
-	amp_write_rem_assoc_frag(hdev, hcon);
+	/* Send A2MP create phylink rsp whan all fragments are
+	   written
+	 */
+	if (amp_write_rem_assoc_frag(hdev, hcon))
+		a2mp_send_create_phy_link_rsp(hdev, 0);
 }
 
 void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle)
-- 
1.7.10.4


^ permalink raw reply related

* [RFC 1/5] Bluetooth: Fix using locked state_change for A2MP chan
From: Andrei Emeltchenko @ 2012-12-07 12:59 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

A2MP channel do not have sk associated so use unlocked version
of state_change. chan is already locked.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/l2cap_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 2c78208..d4a44dc 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1196,7 +1196,7 @@ static void l2cap_send_disconn_req(struct l2cap_chan *chan, int err)
 	}
 
 	if (chan->chan_type == L2CAP_CHAN_CONN_FIX_A2MP) {
-		l2cap_state_change(chan, BT_DISCONN);
+		__l2cap_state_change(chan, BT_DISCONN);
 		return;
 	}
 
-- 
1.7.10.4


^ permalink raw reply related

* Re: [PATCH] Fixes kernel oops when turning bluetooth mouse on
From: Jiri Kosina @ 2012-12-07 10:21 UTC (permalink / raw)
  To: Gustavo Padovan
  Cc: Lamarque V. Souza, linux-input, linux-kernel, linux-bluetooth
In-Reply-To: <20121206202448.GA11409@joana>

On Thu, 6 Dec 2012, Gustavo Padovan wrote:

> > > diff -Nrup a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> > > --- a/drivers/hid/hid-core.c	2012-12-05 01:43:45.000000000 -0200
> > > +++ b/drivers/hid/hid-core.c	2012-12-05 01:26:57.000000000 -0200
> > > @@ -2150,8 +2150,13 @@ static const struct hid_device_id hid_mo
> > >  	{ }
> > >  };
> > >  
> > > -static bool hid_ignore(struct hid_device *hdev)
> > > +bool hid_ignore(struct hid_device *hdev)
> > >  {
> > > +	if (hdev->quirks & HID_QUIRK_NO_IGNORE)
> > > +		return false;
> > > +	if (hdev->quirks & HID_QUIRK_IGNORE)
> > > +		return true;
> > > +
> > >  	switch (hdev->vendor) {
> > >  	case USB_VENDOR_ID_CODEMERCS:
> > >  		/* ignore all Code Mercenaries IOWarrior devices */
> > > @@ -2197,6 +2202,7 @@ static bool hid_ignore(struct hid_device
> > >  
> > >  	return !!hid_match_id(hdev, hid_ignore_list);
> > >  }
> > > +EXPORT_SYMBOL_GPL(hid_ignore);
> > >  
> > >  int hid_add_device(struct hid_device *hdev)
> > >  {
> > > @@ -2208,8 +2214,7 @@ int hid_add_device(struct hid_device *hd
> > >  
> > >  	/* we need to kill them here, otherwise they will stay allocated to
> > >  	 * wait for coming driver */
> > > -	if (!(hdev->quirks & HID_QUIRK_NO_IGNORE)
> > > -            && (hid_ignore(hdev) || (hdev->quirks & HID_QUIRK_IGNORE)))
> > > +	if (hid_ignore(hdev))
> > >  		return -ENODEV;
> > >  
> > >  	/*
> > > diff -Nrup a/include/linux/hid.h b/include/linux/hid.h
> > > --- a/include/linux/hid.h	2012-12-05 01:44:14.000000000 -0200
> > > +++ b/include/linux/hid.h	2012-12-05 01:26:57.000000000 -0200
> > > @@ -684,6 +684,7 @@ struct hid_ll_driver {
> > >  
> > >  extern int hid_debug;
> > >  
> > > +extern bool hid_ignore(struct hid_device *);
> > >  extern int hid_add_device(struct hid_device *);
> > >  extern void hid_destroy_device(struct hid_device *);
> > >  
> > > diff -Nrup a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
> > > --- a/net/bluetooth/hidp/core.c	2012-12-05 01:43:15.000000000 -0200
> > > +++ b/net/bluetooth/hidp/core.c	2012-12-05 02:29:49.000000000 -0200
> > > @@ -941,6 +941,13 @@ static int hidp_setup_hid(struct hidp_se
> > >  	hid->hid_get_raw_report = hidp_get_raw_report;
> > >  	hid->hid_output_raw_report = hidp_output_raw_report;
> > >  
> > > +	/* True if device is blacklisted in drivers/hid/hid-core.c */
> > > +	if (hid_ignore(hid)) {
> > > +		hid_destroy_device(session->hid);
> > > +		session->hid = NULL;
> > > +		return -ENODEV;
> > > +	}
> > > +
> > >  	return 0;
> > >  
> > >  fault:
> > > @@ -1013,7 +1020,7 @@ int hidp_add_connection(struct hidp_conn
> > >  
> > >  	if (req->rd_size > 0) {
> > >  		err = hidp_setup_hid(session, req);
> > > -		if (err)
> > > +		if (err && err != -ENODEV)
> > >  			goto purge;
> > >  	}
> 
> Acked-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Queuing in hid.git, thanks.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply

* [PATCH] gitignore: Add test/bluezutils.pyc
From: Szymon Janc @ 2012-12-07  9:42 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

Python generates compiled module file when py module is used.
---
 .gitignore |    1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index a30d4a4..976c171 100644
--- a/.gitignore
+++ b/.gitignore
@@ -71,6 +71,7 @@ test/test-textfile
 test/uuidtest
 test/mpris-player
 test/sap_client.pyc
+test/bluezutils.pyc
 unit/test-eir
 tools/btattach
 tools/btmgmt
-- 
1.7.9.5


^ permalink raw reply related

* [RFC BlueZ] media-api: Add org.bluez.MediaStorage
From: Luiz Augusto von Dentz @ 2012-12-07  9:33 UTC (permalink / raw)
  To: linux-bluetooth

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

This interface adds support for browsing and searching in the player's
storage using AVRCP 1.4/1.5.

Some remarks about the design:

  - Exposing UIDCounter and UIDs was considered, but the spec seems to have
    missed to define the player's id persistency. There are also the fact that
    UIDCounter alone does not guarantee persistency across sessions and do not
    provide what exact items have changed, so in the end exposing these
    details will bring almost no value.
  - Indexing or caching the whole media library is not recommended, Bluetooth
    is too slow for that and even vendors such as Apple do not recommend doing
    it, so the only items keep in cache are the current listed ones.
  - Addressed vs Browsed player is done implicitly when accessed, this was done
    to simplify the API and avoid confusions between applications and players.
---
 doc/media-api.txt | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 173 insertions(+)

diff --git a/doc/media-api.txt b/doc/media-api.txt
index cf69efa..92f7d84 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -219,6 +219,179 @@ Properties	string Equalizer [readwrite]
 			possible to signal its end by setting position to the
 			maximum uint32 value.
 
+		string Name [readonly]
+
+			Player name
+
+		boolean Browsable [readonly]
+
+			If present indicates the player can be browsed using
+			MediaStorage interface.
+
+			Possible values:
+
+				True: Supported and active
+				False: Supported but inactive
+
+			Note: If supported but inactive clients can enable it
+			by using MediaStorage interface but it might interfere
+			in the playback of other players.
+
+
+		boolean Searchable [readonly]
+
+			If present indicates the player can be searched using
+			MediaStorage interface.
+
+			Possible values:
+
+				True: Supported and active
+				False: Supported but inactive
+
+			Note: If supported but inactive clients can enable it
+			by using MediaStorage interface but it might interfere
+			in the playback of other players.
+
+		array{string} Buttons [readonly]
+
+			If available indicates the buttons supported by the
+			player.
+
+			Possible values:
+
+				"Play", "Pause", "Stop", "Next", "Previous",
+				"FastForward" and "Rewind"
+
+			Default value: All
+
+MediaStorage hierarchy
+=======================
+
+Service		unique name (Target role)
+		org.bluez (Controller role)
+Interface	org.bluez.MediaStorage
+Object path	freely definable (Target role)
+		[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX
+		(Controller role)
+
+Methods		array{objects, properties} Search(string value, dict filter)
+
+			Return a list of MediaItem found
+
+		array{objects, properties} ListItems(dict filter)
+
+			Return a list of MediaItem found
+
+		void ChangeFolder(string path)
+
+			Change current folder, support both relative or
+			absolute paths.
+
+Properties	uint32 NumberOfItems:
+
+			Number of items in the current folder
+
+		string Path:
+
+			Current path:
+
+			Possible values: "/root/folder" or "/NowPlaying"
+
+			Note: /NowPlaying might not be listed if player is
+			stopped
+
+Filters		uint32 Start:
+
+			Offset of the first item.
+
+			Default value: 0
+
+		uint32 End:
+
+			Offset of the last item.
+
+			Default value: NumbeOfItems
+
+		array{string} Properties
+
+			Item properties that should be included in the list.
+
+			Possible Values:
+
+				"Title", "Artist", "Album", "Genre",
+				"NumberOfTracks", "Number", "Duration".
+
+			Default Value: All
+
+MediaItem hierarchy
+===================
+
+Service		unique name (Target role)
+		org.bluez (Controller role)
+Interface	org.bluez.MediaItem
+Object path	freely definable (Target role)
+		[variable
+		prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX/itemX
+		(Controller role)
+
+Methods		void Play()
+
+			Play item
+
+		void AddtoNowPlaying()
+
+			Add item to now playing list
+
+Properties	string Name [readonly]
+
+			Item displayable name
+
+		boolean Folder [readonly]
+
+			Indicates whether the item is a folder
+
+		string Type [readonly]
+
+			Item type
+
+			Possible values:
+
+				Folder: "Mixed", "Titles", "Albums", "Artists"
+				Other Items: "Video", "Audio"
+
+		boolean Playable [readonly]
+
+			Indicates if the item can be played
+
+		string Title:
+
+			Item title name
+
+		string Artist:
+
+			Item artist name
+
+		string Album:
+
+			Item album name
+
+		string Genre:
+
+			Item genre name
+
+		uint32 NumberOfTracks:
+
+			Item album number of tracks in total
+
+		uint32 Number:
+
+			Item album number
+
+		uint32 Duration:
+
+			Item duration in milliseconds
+
+
 MediaEndpoint hierarchy
 =======================
 
-- 
1.7.11.7


^ permalink raw reply related

* Re: [PATCH BlueZ 1/3] adapter: Fix unplugging adapter bug
From: Johan Hedberg @ 2012-12-07  9:22 UTC (permalink / raw)
  To: Andre Guedes; +Cc: linux-bluetooth
In-Reply-To: <1354837273-31712-1-git-send-email-andre.guedes@openbossa.org>

Hi Andre,

On Thu, Dec 06, 2012, Andre Guedes wrote:
> If we unplug an adapter in powered on state, once it is plugged
> again, it doesn't go to powered on state as expected. This bug
> happens because Powered info is stored when the adapter is
> unplugged from the system.
> 
> This patch fixes this bug by only storing adapter info if mode
> changing was requested by user application via D-Bus interface.
> This patch basically reverts the changes in commit
> 985d8ac397a7c332c1badcb95430a167ec93e9e7 where the bug was
> introduced.
> ---
>  src/adapter.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

All three patches have been applied (with a couple of coding style
improvements which don't change the logic). Thanks.

Johan

^ permalink raw reply

* Re: [PATCH BlueZ] build: Fix 'make distcheck'
From: Johan Hedberg @ 2012-12-07  7:56 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <1354839845-28686-1-git-send-email-vinicius.gomes@openbossa.org>

Hi Vinicius,

On Thu, Dec 06, 2012, Vinicius Costa Gomes wrote:
> The test script of the cycling speed profile should be
> 'test-cyclingspeed' instead of 'test-cycling'.
> ---
>  Makefile.tools | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied. Thanks.

Johan

^ permalink raw reply

* [PATCH BlueZ] build: Fix 'make distcheck'
From: Vinicius Costa Gomes @ 2012-12-07  0:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Vinicius Costa Gomes, johan.hedberg

The test script of the cycling speed profile should be
'test-cyclingspeed' instead of 'test-cycling'.
---
 Makefile.tools | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.tools b/Makefile.tools
index 90b35d5..a6ce5b2 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -221,4 +221,4 @@ EXTRA_DIST += test/sap_client.py test/hsplay test/hsmicro test/bluezutils.py \
 		test/service-did.xml test/service-spp.xml test/service-opp.xml \
 		test/service-ftp.xml test/simple-player test/test-nap \
 		test/test-heartrate test/test-alert test/test-hfp \
-		test/test-cycling
+		test/test-cyclingspeed
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 3/3] adapter: Discoverable storage
From: Andre Guedes @ 2012-12-06 23:41 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1354837273-31712-1-git-send-email-andre.guedes@openbossa.org>

This patch changes store_adapter_info helper so it stores Discoverable
value according to discov_timeout. If discov_timeout is greater than
zero, we store "false" for Discoverable. This change covers the case
when DiscoverableTimeout value is set when Discoverable is true.
---
 src/adapter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index 35a4715..fb6c570 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -231,7 +231,8 @@ static void store_adapter_info(struct btd_adapter *adapter)
 					adapter->pairable_timeout);
 
 	g_key_file_set_boolean(key_file, "General", "Discoverable",
-				adapter->discoverable);
+				adapter->discov_timeout ?
+				FALSE : adapter->discoverable);
 
 	if (adapter->discov_timeout != main_opts.discovto)
 		g_key_file_set_integer(key_file, "General",
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 2/3] adapter: Don't store Discoverable value if DiscoverableTimeout is set
From: Andre Guedes @ 2012-12-06 23:41 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1354837273-31712-1-git-send-email-andre.guedes@openbossa.org>

If adapter was set to Discoverable and DiscoverableTimeout is greater
than zero we should not store the Discoverable adapter info as long as
it is a non-persistent state. This way, we don't need to worry about
updating the Discoverable stored value once the timeout expires.
---
 src/adapter.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index 25501c4..35a4715 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2269,8 +2269,12 @@ static void set_mode_complete(struct btd_adapter *adapter)
 	if (err != 0)
 		error("unable to set mode: %s", mode2str(pending->mode));
 
+	if (adapter->mode == MODE_DISCOVERABLE && adapter->discov_timeout > 0)
+		goto done;
+
 	store_adapter_info(adapter);
 
+done:
 	session_unref(pending);
 }
 
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 1/3] adapter: Fix unplugging adapter bug
From: Andre Guedes @ 2012-12-06 23:41 UTC (permalink / raw)
  To: linux-bluetooth

If we unplug an adapter in powered on state, once it is plugged
again, it doesn't go to powered on state as expected. This bug
happens because Powered info is stored when the adapter is
unplugged from the system.

This patch fixes this bug by only storing adapter info if mode
changing was requested by user application via D-Bus interface.
This patch basically reverts the changes in commit
985d8ac397a7c332c1badcb95430a167ec93e9e7 where the bug was
introduced.
---
 src/adapter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 0a0e6f0..25501c4 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2230,8 +2230,6 @@ static void set_mode_complete(struct btd_adapter *adapter)
 	struct session_req *pending;
 	int err;
 
-	store_adapter_info(adapter);
-
 	DBG("%s", mode2str(adapter->mode));
 
 	if (adapter->mode == MODE_OFF) {
@@ -2271,6 +2269,8 @@ static void set_mode_complete(struct btd_adapter *adapter)
 	if (err != 0)
 		error("unable to set mode: %s", mode2str(pending->mode));
 
+	store_adapter_info(adapter);
+
 	session_unref(pending);
 }
 
-- 
1.8.0.1


^ permalink raw reply related

* hidp bug concerning ctrl_sk sock
From: Karl Relton @ 2012-12-06 21:23 UTC (permalink / raw)
  To: linux-bluetooth

With reference to bug https://bugzilla.kernel.org/show_bug.cgi?id=50541
it seems to me that the hidp driver has a problem in the hidp_session()
function.

The sock structure pointed to by ctrl_sk is being freed from under the
functions feet (as far as I can see), causing this function to crash.
Shouldn't a lock_sock or sock_hold be necessary to keep the sock
structure around until hidp_session has finished with it?




^ permalink raw reply

* hidp bug concerning ctrl_sk sock
From: Karl Relton @ 2012-12-06 21:04 UTC (permalink / raw)
  To: linux-bluetooth

With reference to bug https://bugzilla.kernel.org/show_bug.cgi?id=50541
it seems to me that the hidp driver has a problem in the hidp_session()
function.

The sock structure pointed to by ctrl_sk is being freed from under the
functions feet (as far as I can see), causing this function to crash.
Shouldn't a lock_sock or sock_hold be necessary to keep the sock
structure around until hidp_session has finished with it?



^ permalink raw reply

* Re: [PATCH BlueZ] test: Fix syntax in bluezutils.py
From: Johan Hedberg @ 2012-12-06 20:26 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: linux-bluetooth, Frédéric Danis
In-Reply-To: <1354824780-21903-1-git-send-email-vinicius.gomes@openbossa.org>

Hi,

On Thu, Dec 06, 2012, Vinicius Costa Gomes wrote:
> Traceback (most recent call last):
>   File "./simple-agent", line 12, in <module>
>     import bluezutils
>   File "/home/fdanis/src/bluez/test/bluezutils.py", line 22
>     if not pattern or pattern == adapter["Address"] or
>                                                      ^
> SyntaxError: invalid syntax
> ---
>  test/bluezutils.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH] Fixes kernel oops when turning bluetooth mouse on
From: Gustavo Padovan @ 2012-12-06 20:24 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Lamarque V. Souza, linux-input, linux-kernel, linux-bluetooth
In-Reply-To: <alpine.LNX.2.00.1212061548430.28002@pobox.suse.cz>

Hi Jiri,

* Jiri Kosina <jkosina@suse.cz> [2012-12-06 15:50:48 +0100]:

> On Thu, 6 Dec 2012, Lamarque V. Souza wrote:
> 
> > This patch against kernel 3.7.0-rc8 fixes a kernel oops when turning on the 
> > bluetooth mouse with id 0458:0058 [1].
> > 
> > The mouse in question supports both input and hid sessions, however it is 
> > blacklisted in drivers/hid/hid-core.c so the input session is one that should 
> > be used. Long ago (around kernel 3.0.0) some changes in the bluetooth 
> > subsystem made the kernel do not fallback to input session when hid session is 
> > not supported or blacklisted. This patch restore that behaviour by making the 
> > kernel try the input session if hid_add_device returns ENODEV.
> > 
> > OBS: The patch exports hid_ignore() from hid-core.c so that it can be used in 
> > the bluetooth subsystem.
> > 
> > [1] https://bugzilla.kernel.org/show_bug.cgi?id=39882
> > 
> > Signed-off-by: Lamarque V. Souza <lamarque@gmail.com>
> 
> I am fine with the hid core change. Adding Gustavo and linux-bluetooth@ 
> for the net/bluetooth/hidp/ change ... Gustavo, could you please give me 
> Ack on the Bluetooth part so that I could merge it?
> 
> Thanks.
> 
> > ---
> > 
> > diff -Nrup a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> > --- a/drivers/hid/hid-core.c	2012-12-05 01:43:45.000000000 -0200
> > +++ b/drivers/hid/hid-core.c	2012-12-05 01:26:57.000000000 -0200
> > @@ -2150,8 +2150,13 @@ static const struct hid_device_id hid_mo
> >  	{ }
> >  };
> >  
> > -static bool hid_ignore(struct hid_device *hdev)
> > +bool hid_ignore(struct hid_device *hdev)
> >  {
> > +	if (hdev->quirks & HID_QUIRK_NO_IGNORE)
> > +		return false;
> > +	if (hdev->quirks & HID_QUIRK_IGNORE)
> > +		return true;
> > +
> >  	switch (hdev->vendor) {
> >  	case USB_VENDOR_ID_CODEMERCS:
> >  		/* ignore all Code Mercenaries IOWarrior devices */
> > @@ -2197,6 +2202,7 @@ static bool hid_ignore(struct hid_device
> >  
> >  	return !!hid_match_id(hdev, hid_ignore_list);
> >  }
> > +EXPORT_SYMBOL_GPL(hid_ignore);
> >  
> >  int hid_add_device(struct hid_device *hdev)
> >  {
> > @@ -2208,8 +2214,7 @@ int hid_add_device(struct hid_device *hd
> >  
> >  	/* we need to kill them here, otherwise they will stay allocated to
> >  	 * wait for coming driver */
> > -	if (!(hdev->quirks & HID_QUIRK_NO_IGNORE)
> > -            && (hid_ignore(hdev) || (hdev->quirks & HID_QUIRK_IGNORE)))
> > +	if (hid_ignore(hdev))
> >  		return -ENODEV;
> >  
> >  	/*
> > diff -Nrup a/include/linux/hid.h b/include/linux/hid.h
> > --- a/include/linux/hid.h	2012-12-05 01:44:14.000000000 -0200
> > +++ b/include/linux/hid.h	2012-12-05 01:26:57.000000000 -0200
> > @@ -684,6 +684,7 @@ struct hid_ll_driver {
> >  
> >  extern int hid_debug;
> >  
> > +extern bool hid_ignore(struct hid_device *);
> >  extern int hid_add_device(struct hid_device *);
> >  extern void hid_destroy_device(struct hid_device *);
> >  
> > diff -Nrup a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
> > --- a/net/bluetooth/hidp/core.c	2012-12-05 01:43:15.000000000 -0200
> > +++ b/net/bluetooth/hidp/core.c	2012-12-05 02:29:49.000000000 -0200
> > @@ -941,6 +941,13 @@ static int hidp_setup_hid(struct hidp_se
> >  	hid->hid_get_raw_report = hidp_get_raw_report;
> >  	hid->hid_output_raw_report = hidp_output_raw_report;
> >  
> > +	/* True if device is blacklisted in drivers/hid/hid-core.c */
> > +	if (hid_ignore(hid)) {
> > +		hid_destroy_device(session->hid);
> > +		session->hid = NULL;
> > +		return -ENODEV;
> > +	}
> > +
> >  	return 0;
> >  
> >  fault:
> > @@ -1013,7 +1020,7 @@ int hidp_add_connection(struct hidp_conn
> >  
> >  	if (req->rd_size > 0) {
> >  		err = hidp_setup_hid(session, req);
> > -		if (err)
> > +		if (err && err != -ENODEV)
> >  			goto purge;
> >  	}

Acked-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

	Gustavo

^ permalink raw reply

* [PATCH BlueZ] test: Fix syntax in bluezutils.py
From: Vinicius Costa Gomes @ 2012-12-06 20:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Frédéric Danis, johan.hedberg

From: Frédéric Danis <frederic.danis@linux.intel.com>

Traceback (most recent call last):
  File "./simple-agent", line 12, in <module>
    import bluezutils
  File "/home/fdanis/src/bluez/test/bluezutils.py", line 22
    if not pattern or pattern == adapter["Address"] or
                                                     ^
SyntaxError: invalid syntax
---
 test/bluezutils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/bluezutils.py b/test/bluezutils.py
index d0c4773..de08cbd 100644
--- a/test/bluezutils.py
+++ b/test/bluezutils.py
@@ -19,8 +19,8 @@ def find_adapter_in_objects(objects, pattern=None):
 		adapter = ifaces.get(ADAPTER_INTERFACE)
 		if adapter is None:
 			continue
-		if not pattern or pattern == adapter["Address"] or
-							path.endswith(pattern)):
+		if not pattern or pattern == adapter["Address"] or \
+							path.endswith(pattern):
 			obj = bus.get_object(SERVICE_NAME, path)
 			return dbus.Interface(obj, ADAPTER_INTERFACE)
 	raise Exception("Bluetooth adapter not found")
-- 
1.8.0.1


^ permalink raw reply related

* CC2540 LE thermometer sample code
From: Elvis Pfutzenreuter @ 2012-12-06 18:17 UTC (permalink / raw)
  To: linux-bluetooth

I hammered the thermometer sample code that comes with CC2540 SDK until
it worked marginally with BlueZ.

FWIW, in case someone wants to use it for testing:

http://oss.signove.com/index.php/CC2540Thermometer

^ 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