From: "Frédéric Danis" <frederic.danis@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 4/5] adapter: Convert storage did file
Date: Wed, 21 Nov 2012 14:49:50 +0100 [thread overview]
Message-ID: <1353505791-21134-4-git-send-email-frederic.danis@linux.intel.com> (raw)
In-Reply-To: <1353505791-21134-1-git-send-email-frederic.danis@linux.intel.com>
---
src/adapter.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/src/adapter.c b/src/adapter.c
index 3dafacb..0d1dfea 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2548,6 +2548,45 @@ static void convert_blocked_entry(GKeyFile *key_file, void *value)
g_key_file_set_boolean(key_file, "General", "Blocked", TRUE);
}
+static void convert_did_entry(GKeyFile *key_file, void *value)
+{
+ char *vendor_str, *product_str, *version_str;
+ uint16_t val;
+
+ vendor_str = strchr(value, ' ');
+ if (!vendor_str)
+ return;
+
+ *(vendor_str++) = 0;
+
+ if (g_str_equal(value, "FFFF"))
+ return;
+
+ product_str = strchr(vendor_str, ' ');
+ if (!product_str)
+ return;
+
+ *(product_str++) = 0;
+
+ version_str = strchr(product_str, ' ');
+ if (!version_str)
+ return;
+
+ *(version_str++) = 0;
+
+ val = (uint16_t) strtol(value, NULL, 16);
+ g_key_file_set_integer(key_file, "DeviceID", "Source", val);
+
+ val = (uint16_t) strtol(vendor_str, NULL, 16);
+ g_key_file_set_integer(key_file, "DeviceID", "Vendor", val);
+
+ val = (uint16_t) strtol(product_str, NULL, 16);
+ g_key_file_set_integer(key_file, "DeviceID", "Product", val);
+
+ val = (uint16_t) strtol(version_str, NULL, 16);
+ g_key_file_set_integer(key_file, "DeviceID", "Version", val);
+}
+
static void convert_entry(char *key, char *value, void *user_data)
{
struct device_converter *converter = user_data;
@@ -2633,6 +2672,9 @@ static void convert_device_storage(struct btd_adapter *adapter)
/* Convert blocked */
convert_file("blocked", address, convert_blocked_entry);
+
+ /* Convert device ids */
+ convert_file("did", address, convert_did_entry);
}
static void convert_config(struct btd_adapter *adapter, const char *filename,
--
1.7.9.5
next prev parent reply other threads:[~2012-11-21 13:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-21 13:49 [PATCH 1/5] doc: Update settings-storage.txt Frédéric Danis
2012-11-21 13:49 ` [PATCH 2/5] adapter: Convert storage device blocked Frédéric Danis
2012-11-21 13:49 ` [PATCH 3/5] device: Retrieve device blocked from storage Frédéric Danis
2012-11-21 13:49 ` Frédéric Danis [this message]
2012-11-21 13:49 ` [PATCH 5/5] device: Retrieve device pnp ids " Frédéric Danis
2012-11-21 18:46 ` [PATCH 1/5] doc: Update settings-storage.txt 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=1353505791-21134-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.