Linux bluetooth development
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Subject: [PATCH BlueZ 5/8] Fix not using the "bonded" property for new bondings
Date: Fri, 19 Aug 2011 21:09:26 -0300	[thread overview]
Message-ID: <1313798969-8772-6-git-send-email-vinicius.gomes@openbossa.org> (raw)
In-Reply-To: <1313798969-8772-1-git-send-email-vinicius.gomes@openbossa.org>

When checking if a device was already bonded, we should
use the paired property instead of reading the link key
from storage. This method will work for LE links, also.
---
 src/device.c |   16 +---------------
 1 files changed, 1 insertions(+), 15 deletions(-)

diff --git a/src/device.c b/src/device.c
index b0adac0..04469d7 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2125,29 +2125,15 @@ DBusMessage *device_create_bonding(struct btd_device *device,
 					const char *agent_path,
 					uint8_t capability)
 {
-	char filename[PATH_MAX + 1];
-	char *str, srcaddr[18], dstaddr[18];
 	struct btd_adapter *adapter = device->adapter;
 	struct bonding_req *bonding;
-	bdaddr_t src;
 	int err;
 
-	adapter_get_address(adapter, &src);
-	ba2str(&src, srcaddr);
-	ba2str(&device->bdaddr, dstaddr);
-
 	if (device->bonding)
 		return btd_error_in_progress(msg);
 
-	/* check if a link key already exists */
-	create_name(filename, PATH_MAX, STORAGEDIR, srcaddr,
-			"linkkeys");
-
-	str = textfile_caseget(filename, dstaddr);
-	if (str) {
-		free(str);
+	if (device_is_bonded(device))
 		return btd_error_already_exists(msg);
-	}
 
 	err = adapter_create_bonding(adapter, &device->bdaddr, capability);
 	if (err < 0)
-- 
1.7.6


  parent reply	other threads:[~2011-08-20  0:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-20  0:09 [PATCH BlueZ 0/8] Proper support for pairing LE devices Vinicius Costa Gomes
2011-08-20  0:09 ` [PATCH BlueZ 1/8] Add link_type information to the mgmt "Device Connected" event Vinicius Costa Gomes
2011-08-31  7:51   ` Johan Hedberg
2011-08-31 11:25     ` Luiz Augusto von Dentz
2011-08-31 12:27       ` Johan Hedberg
2011-08-20  0:09 ` [PATCH BlueZ 2/8] Fix doing SDP service discovery for LE devices Vinicius Costa Gomes
2011-08-20  0:09 ` [PATCH BlueZ 3/8] Set the Paired property of a device when restoring from storage Vinicius Costa Gomes
2011-08-20  0:09 ` [PATCH BlueZ 4/8] Fix not using the same way for pairing LE devices Vinicius Costa Gomes
2011-08-20  0:09 ` Vinicius Costa Gomes [this message]
2011-08-20  0:09 ` [PATCH BlueZ 6/8] Fix connecting to the local adapter when receiving new keys Vinicius Costa Gomes
2011-08-20  0:09 ` [PATCH BlueZ 7/8] Remove the default security level from btio Vinicius Costa Gomes
2011-08-20  0:09 ` [PATCH BlueZ 8/8] Fix btio users to not expect a default security level Vinicius Costa Gomes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1313798969-8772-6-git-send-email-vinicius.gomes@openbossa.org \
    --to=vinicius.gomes@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox