From: "Frédéric Danis" <frederic.danis@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 4/7] adapter: Convert storage linkkeys file
Date: Tue, 27 Nov 2012 09:49:50 +0100 [thread overview]
Message-ID: <1354006193-7199-4-git-send-email-frederic.danis@linux.intel.com> (raw)
In-Reply-To: <1354006193-7199-1-git-send-email-frederic.danis@linux.intel.com>
---
src/adapter.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/src/adapter.c b/src/adapter.c
index 9d6554a..32d3930 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2618,6 +2618,34 @@ static void convert_did_entry(GKeyFile *key_file, void *value)
g_key_file_set_integer(key_file, "DeviceID", "Version", val);
}
+static void convert_linkkey_entry(GKeyFile *key_file, void *value)
+{
+ char *type_str, *length_str, *str;
+ gint val;
+
+ type_str = strchr(value, ' ');
+ if (!type_str)
+ return;
+
+ *(type_str++) = 0;
+
+ length_str = strchr(type_str, ' ');
+ if (!length_str)
+ return;
+
+ *(length_str++) = 0;
+
+ str = g_strconcat("0x", value, NULL);
+ g_key_file_set_string(key_file, "LinkKey", "Key", str);
+ g_free(str);
+
+ val = strtol(type_str, NULL, 16);
+ g_key_file_set_integer(key_file, "LinkKey", "Type", val);
+
+ val = strtol(length_str, NULL, 16);
+ g_key_file_set_integer(key_file, "LinkKey", "PINLength", val);
+}
+
static void convert_entry(char *key, char *value, void *user_data)
{
struct device_converter *converter = user_data;
@@ -2707,6 +2735,9 @@ static void convert_device_storage(struct btd_adapter *adapter)
/* Convert device ids */
convert_file("did", address, "info", convert_did_entry);
+
+ /* Convert linkkeys */
+ convert_file("linkkeys", address, "keys", convert_linkkey_entry);
}
static void convert_config(struct btd_adapter *adapter, const char *filename,
--
1.7.9.5
next prev parent reply other threads:[~2012-11-27 8:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-27 8:49 [PATCH 1/7] doc: Update settings-storage.txt Frédéric Danis
2012-11-27 8:49 ` [PATCH 2/7] adapter: Load devices from new storage architecture Frédéric Danis
2012-11-27 8:49 ` [PATCH 3/7] adapter: Add destination file to convert_file() Frédéric Danis
2012-11-27 8:49 ` Frédéric Danis [this message]
2012-11-27 8:49 ` [PATCH 5/7] device: Remove keys file in device_remove_stored() Frédéric Danis
2012-11-27 8:49 ` [PATCH 6/7] adapter: Upload link keys from new storage Frédéric Danis
2012-11-27 8:49 ` [PATCH 7/7] event: Store link key infos in new keys file Frédéric Danis
2012-11-27 11:03 ` Johan Hedberg
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=1354006193-7199-4-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).