--- src/adapter.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index f9382fd..5bad0f9 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -2644,6 +2644,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; @@ -2744,6 +2772,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 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html