linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Frédéric Danis" <frederic.danis@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v9 3/5] dbusoob: Set device name in device object
Date: Fri, 26 Oct 2012 12:08:15 +0200	[thread overview]
Message-ID: <1351246097-22285-3-git-send-email-frederic.danis@linux.intel.com> (raw)
In-Reply-To: <1351246097-22285-1-git-send-email-frederic.danis@linux.intel.com>

---
 plugins/dbusoob.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/plugins/dbusoob.c b/plugins/dbusoob.c
index 5c5b6ef..82cd304 100644
--- a/plugins/dbusoob.c
+++ b/plugins/dbusoob.c
@@ -191,9 +191,11 @@ static gboolean parse_data(DBusMessageIter *data, struct oob_data *remote_data)
 	return TRUE;
 }
 
-static gboolean store_data(struct btd_adapter *adapter, struct oob_data *data)
+static gboolean store_data(struct btd_adapter *adapter, const char *address,
+				struct oob_data *data)
 {
 	bdaddr_t bdaddr;
+	struct btd_device *device;
 
 	str2ba(data->addr, &bdaddr);
 
@@ -203,13 +205,14 @@ static gboolean store_data(struct btd_adapter *adapter, struct oob_data *data)
 			return FALSE;
 	}
 
+	device = adapter_get_device(adapter, address);
+
 	if (data->class)
 		write_remote_class(adapter_get_address(adapter), &bdaddr,
 								data->class);
 
 	if (data->name)
-		write_device_name(adapter_get_address(adapter), &bdaddr, 0,
-								data->name);
+		device_set_name(device, data->name);
 
 	return TRUE;
 }
@@ -245,7 +248,7 @@ static DBusMessage *add_remote_data(DBusConnection *conn, DBusMessage *msg,
 	if (!parse_data(&data, &remote_data))
 		return btd_error_invalid_args(msg);
 
-	if (!store_data(adapter, &remote_data))
+	if (!store_data(adapter, remote_data.addr, &remote_data))
 		return btd_error_failed(msg, "Request failed");
 
 	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
-- 
1.7.9.5


  parent reply	other threads:[~2012-10-26 10:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-26 10:08 [PATCH v9 1/5] doc: Update settings-storage.txt Frédéric Danis
2012-10-26 10:08 ` [PATCH v9 2/5] device: Retrieve name from storage Frédéric Danis
2012-10-26 10:08 ` Frédéric Danis [this message]
2012-10-26 10:08 ` [PATCH v9 4/5] input: Retrieve device name from device object Frédéric Danis
2012-10-26 10:08 ` [PATCH v9 5/5] hcitool: Retrieve names from cache directory Frédéric Danis

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=1351246097-22285-3-git-send-email-frederic.danis@linux.intel.com \
    --to=frederic.danis@linux.intel.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).