linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH obexd 4/6 v2] Remove obex_get_id
Date: Sun, 27 Nov 2011 23:12:09 +0200	[thread overview]
Message-ID: <1322428331-28204-4-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1322428331-28204-1-git-send-email-luiz.dentz@gmail.com>

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

Plugins that need the peer address/name should use obex_getpeername which
uses the transport driver to resolve it.
---
 plugins/syncevolution.c |    8 +++++++-
 src/obex.c              |   17 -----------------
 src/obex.h              |    1 -
 3 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/plugins/syncevolution.c b/plugins/syncevolution.c
index e3b06f4..b0cd626 100644
--- a/plugins/syncevolution.c
+++ b/plugins/syncevolution.c
@@ -218,6 +218,7 @@ static void *synce_connect(struct obex_session *os, int *err)
 {
 	DBusConnection *conn;
 	struct synce_context *context;
+	char *address;
 
 	manager_register_session(os);
 
@@ -228,9 +229,14 @@ static void *synce_connect(struct obex_session *os, int *err)
 	context = g_new0(struct synce_context, 1);
 	context->dbus_conn = conn;
 	context->lasterr = -EAGAIN;
-	context->id = obex_get_id(os);
 	context->os = os;
 
+	if (obex_getpeername(os, &address) == 0) {
+		context->id = g_strdup_printf("%s+%d", address,
+							SYNCEVOLUTION_CHANNEL);
+		g_free(address);
+	}
+
 	if (err)
 		*err = 0;
 
diff --git a/src/obex.c b/src/obex.c
index 7f31c5d..a88306d 100644
--- a/src/obex.c
+++ b/src/obex.c
@@ -1524,23 +1524,6 @@ uint8_t obex_get_action_id(struct obex_session *os)
 	return os->action_id;
 }
 
-/* TODO: find a way to do this for tty or fix syncevolution */
-char *obex_get_id(struct obex_session *os)
-{
-	GError *gerr = NULL;
-	char address[18];
-	uint8_t channel;
-
-	bt_io_get(os->io, BT_IO_RFCOMM, &gerr,
-			BT_IO_OPT_DEST, address,
-			BT_IO_OPT_CHANNEL, &channel,
-			BT_IO_OPT_INVALID);
-	if (gerr)
-		return NULL;
-
-	return g_strdup_printf("%s+%d", address, channel);
-}
-
 ssize_t obex_get_apparam(struct obex_session *os, const uint8_t **buffer)
 {
 	*buffer = os->apparam;
diff --git a/src/obex.h b/src/obex.h
index 3ec49a9..7f07fd2 100644
--- a/src/obex.h
+++ b/src/obex.h
@@ -46,7 +46,6 @@ int obex_copy(struct obex_session *os, const char *source,
 int obex_move(struct obex_session *os, const char *source,
 						const char *destination);
 uint8_t obex_get_action_id(struct obex_session *os);
-char *obex_get_id(struct obex_session *os);
 ssize_t obex_get_apparam(struct obex_session *os, const uint8_t **buffer);
 ssize_t obex_get_non_header_data(struct obex_session *os,
 							const uint8_t **data);
-- 
1.7.7.3


  parent reply	other threads:[~2011-11-27 21:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-27 21:12 [PATCH obexd 1/6 v2] bluetooth: make use of secure flag for authorization Luiz Augusto von Dentz
2011-11-27 21:12 ` [PATCH obexd 2/6 v2] bluetooth: add .getpeername support Luiz Augusto von Dentz
2011-11-27 21:12 ` [PATCH obexd 3/6 v2] Fix calling getpeername directly on manager.c Luiz Augusto von Dentz
2011-11-27 21:12 ` Luiz Augusto von Dentz [this message]
2011-11-27 21:12 ` [PATCH obexd 5/6 v2] Port core daemon to gobex Luiz Augusto von Dentz
2011-11-29  9:00   ` Johan Hedberg
2011-11-27 21:12 ` [PATCH obexd 6/6 v2] Remove dependency on OpenOBEX Luiz Augusto von Dentz

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=1322428331-28204-4-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).