* [PATCH] Bluetooth: btmrvl: remove pointless conditional before kfree_skb()
From: Wei Yongjun @ 2012-08-28 13:12 UTC (permalink / raw)
To: marcel, gustavo, johan.hedberg; +Cc: yongjun_wei, linux-bluetooth
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Remove pointless conditional before kfree_skb().
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/bluetooth/btmrvl_sdio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index 6a9e971..48ae86f 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -600,8 +600,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
exit:
if (ret) {
hdev->stat.err_rx++;
- if (skb)
- kfree_skb(skb);
+ kfree_skb(skb);
}
return ret;
^ permalink raw reply related
* [PATCH 2/2] mgmt: Add wrapper for Set LE
From: Andrzej Kaczmarek @ 2012-08-28 12:38 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
In-Reply-To: <1346157514-22119-1-git-send-email-andrzej.kaczmarek@tieto.com>
Wrap mgmt_set_mode for Set LE into separate function to be consistent
with other calls and have debug printout.
---
src/mgmt.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/mgmt.c b/src/mgmt.c
index 6dc87e1..19e2972 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -251,6 +251,12 @@ static int mgmt_set_ssp(int index, gboolean ssp)
return mgmt_set_mode(index, MGMT_OP_SET_SSP, ssp);
}
+static int mgmt_set_low_energy(int index, gboolean le)
+{
+ DBG("index %d le %d", index, le);
+ return mgmt_set_mode(index, MGMT_OP_SET_LE, le);
+}
+
static inline int mgmt_powered(uint32_t settings)
{
return (settings & MGMT_SETTING_POWERED) != 0;
@@ -343,7 +349,7 @@ static void update_settings(struct btd_adapter *adapter, uint32_t settings)
if (mgmt_low_energy(info->supported_settings) &&
!mgmt_low_energy(settings))
- mgmt_set_mode(index, MGMT_OP_SET_LE, 1);
+ mgmt_set_low_energy(index, TRUE);
}
static int mgmt_update_powered(struct btd_adapter *adapter,
--
1.7.11.3
^ permalink raw reply related
* [PATCH 1/2] mgmt: Add wrapper for Set SSP
From: Andrzej Kaczmarek @ 2012-08-28 12:38 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
Wrap mgmt_set_mode for Set SSP into separate function to be consistent
with other calls and have debug printout.
---
src/mgmt.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/mgmt.c b/src/mgmt.c
index 58aab2d..6dc87e1 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -245,6 +245,12 @@ int mgmt_set_pairable(int index, gboolean pairable)
return mgmt_set_mode(index, MGMT_OP_SET_PAIRABLE, pairable);
}
+static int mgmt_set_ssp(int index, gboolean ssp)
+{
+ DBG("index %d ssp %d", index, ssp);
+ return mgmt_set_mode(index, MGMT_OP_SET_SSP, ssp);
+}
+
static inline int mgmt_powered(uint32_t settings)
{
return (settings & MGMT_SETTING_POWERED) != 0;
@@ -333,7 +339,7 @@ static void update_settings(struct btd_adapter *adapter, uint32_t settings)
mgmt_set_pairable(index, pairable);
if (mgmt_ssp(info->supported_settings) && !mgmt_ssp(settings))
- mgmt_set_mode(index, MGMT_OP_SET_SSP, 1);
+ mgmt_set_ssp(index, TRUE);
if (mgmt_low_energy(info->supported_settings) &&
!mgmt_low_energy(settings))
--
1.7.11.3
^ permalink raw reply related
* [PATCH obexd 7/7 v2] client-doc: Update documentation of PhonebookAccess interface
From: Luiz Augusto von Dentz @ 2012-08-28 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1346157115-23933-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
doc/client-api.txt | 62 +++++++++++++++++++++++++++++++-----------------------
1 file changed, 36 insertions(+), 26 deletions(-)
diff --git a/doc/client-api.txt b/doc/client-api.txt
index 7ca65cc..f447789 100644
--- a/doc/client-api.txt
+++ b/doc/client-api.txt
@@ -206,7 +206,7 @@ Methods void Select(string location, string phonebook)
"mch": missing call history
"cch": combination of ich och mch
- object, dict PullAll(string targetfile)
+ object, dict PullAll(string targetfile, dict filters)
Return the entire phonebook object from the PSE server
in plain string with vcard format, and store it in
@@ -222,14 +222,21 @@ Methods void Select(string location, string phonebook)
The properties of this transfer are also returned along
with the object path, to avoid a call to GetProperties.
- array{string vcard, string name} List()
+ Possible filters: Format, Order, Offset, MaxCount and
+ Fields
+
+ array{string vcard, string name} List(dict filters)
Return an array of vcard-listing data where every entry
consists of a pair of strings containing the vcard
handle and the contact name. For example:
"1.vcf" : "John"
- object, dict Pull(string vcard, string targetfile)
+ Possible filters: Order, Offset and MaxCount
+
+
+ object, dict
+ Pull(string vcard, string targetfile, dict filters)
Given a vcard handle, retrieve the vcard in the current
phonebook object and store it in a local file.
@@ -244,8 +251,11 @@ Methods void Select(string location, string phonebook)
The properties of this transfer are also returned along
with the object path, to avoid a call to GetProperties.
+ Possbile filters: Format and Fields
+
+
array{string vcard, string name}
- Search(string field, string value)
+ Search(string field, string value, dict filters)
Search for entries matching the given condition and
return an array of vcard-listing data where every entry
@@ -258,47 +268,47 @@ Methods void Select(string location, string phonebook)
{ "name" (default) | "number" | "sound" }
value : the string value to search for
+
+ Possible filters: Order, Offset and MaxCount
+
uint16 GetSize()
Return the number of entries in the selected phonebook
object that are actually used (i.e. indexes that
correspond to non-NULL entries).
- void SetFormat(string format)
+ array{string} ListFilterFields()
- Indicate the format of the vcard that should be return
- by related methods.
+ Return All Available fields that can be used in Fields
+ filter.
- format : { "vcard21" (default) | "vcard30" }
+Filter: string Format:
- void SetOrder(string order)
+ Items vcard format
- Indicate the sorting method of the vcard-listing data
- returned by List and Search methods.
+ Possible values: "vcard21" (default) or "vcard30"
- order : { "indexed" (default) | "alphanumeric" |
- "phonetic" }
+ string Order:
- void SetFilter(array{string})
+ Items order
- Indicate fields that should be contained in vcards
- return by related methods.
+ Possible values: "indexed" (default), "alphanumeric" or
+ "phonetic"
- Give an empty array will clear the filter and return
- all fields available in vcards. And this is the default
- behavior.
+ uint16 Offset:
- Possible filter fields : "VERSION", "FN", ..., "ALL",
- "bit[0-63]"
+ Offset of the first item, default is 0
- array{string} ListFilterFields()
+ uint16 MaxCount:
+
+ Maximum number of items, default is unlimited (65535)
+
+ array{string} Fields:
- Return All Available fields that can be used in
- SetFilter method.
+ Item vcard fields, default is all values.
- array{string} GetFilter()
+ Possible values can be query with ListFilterFields.
- Return the current filter setting
Synchronization hierarchy
=======================
--
1.7.11.4
^ permalink raw reply related
* [PATCH obexd 6/7 v2] client: Move common code to pull_phonebook
From: Luiz Augusto von Dentz @ 2012-08-28 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1346157115-23933-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
client/pbap.c | 79 +++++++++++++++++++++++------------------------------------
1 file changed, 30 insertions(+), 49 deletions(-)
diff --git a/client/pbap.c b/client/pbap.c
index e58efe5..f49aae9 100644
--- a/client/pbap.c
+++ b/client/pbap.c
@@ -523,22 +523,29 @@ static GObexApparam *parse_filters(GObexApparam *apparam,
return apparam;
}
-static struct obc_transfer *pull_phonebook(struct pbap_data *pbap,
+static DBusMessage *pull_phonebook(struct pbap_data *pbap,
DBusMessage *message,
- guint8 type, const char *name,
+ guint8 type,
const char *targetfile,
- GObexApparam *apparam,
- GError **err)
+ GObexApparam *apparam)
{
struct pending_request *request;
struct obc_transfer *transfer;
+ char *name;
guint8 buf[32];
gsize len;
session_callback_t func;
+ DBusMessage *reply;
+ GError *err = NULL;
+
+ name = g_strconcat(pbap->path, ".vcf", NULL);
+
+ len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
+ g_obex_apparam_free(apparam);
- transfer = obc_transfer_get("x-bt/phonebook", name, targetfile, err);
+ transfer = obc_transfer_get("x-bt/phonebook", name, targetfile, &err);
if (transfer == NULL)
- return NULL;
+ goto fail;
switch (type) {
case PULLPHONEBOOK:
@@ -554,19 +561,28 @@ static struct obc_transfer *pull_phonebook(struct pbap_data *pbap,
return NULL;
}
- len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
-
obc_transfer_set_params(transfer, buf, len);
- if (!obc_session_queue(pbap->session, transfer, func, request, err)) {
+ if (!obc_session_queue(pbap->session, transfer, func, request, &err)) {
if (request != NULL)
pending_request_free(request);
- return NULL;
+ goto fail;
}
+ g_free(name);
+
+ if (targetfile == NULL)
+ return NULL;
- return transfer;
+ return obc_transfer_create_dbus_reply(transfer, message);
+
+fail:
+ g_free(name);
+ reply = g_dbus_create_error(message, ERROR_INTERFACE ".Failed", "%s",
+ err->message);
+ g_error_free(err);
+ return reply;
}
static DBusMessage *pull_vcard_listing(struct pbap_data *pbap,
@@ -655,11 +671,8 @@ static DBusMessage *pbap_pull_all(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
struct pbap_data *pbap = user_data;
- struct obc_transfer *transfer;
const char *targetfile;
- char *name;
GObexApparam *apparam;
- GError *err = NULL;
DBusMessageIter args;
if (!pbap->path)
@@ -687,22 +700,8 @@ static DBusMessage *pbap_pull_all(DBusConnection *connection,
ERROR_INTERFACE ".InvalidArguments", NULL);
}
- name = g_strconcat(pbap->path, ".vcf", NULL);
-
- transfer = pull_phonebook(pbap, message, PULLPHONEBOOK, name,
- targetfile, apparam, &err);
- g_free(name);
- g_obex_apparam_free(apparam);
-
- if (transfer == NULL) {
- DBusMessage *reply = g_dbus_create_error(message,
- ERROR_INTERFACE ".Failed", "%s",
- err->message);
- g_error_free(err);
- return reply;
- }
-
- return obc_transfer_create_dbus_reply(transfer, message);
+ return pull_phonebook(pbap, message, PULLPHONEBOOK, targetfile,
+ apparam);
}
static DBusMessage *pull_vcard(struct pbap_data *pbap, DBusMessage *message,
@@ -878,11 +877,7 @@ static DBusMessage *pbap_get_size(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
struct pbap_data *pbap = user_data;
- DBusMessage *reply;
- struct obc_transfer *transfer;
- char *name;
GObexApparam *apparam;
- GError *err = NULL;
DBusMessageIter args;
if (!pbap->path)
@@ -892,25 +887,11 @@ static DBusMessage *pbap_get_size(DBusConnection *connection,
dbus_message_iter_init(message, &args);
- name = g_strconcat(pbap->path, ".vcf", NULL);
-
apparam = g_obex_apparam_set_uint16(NULL, MAXLISTCOUNT_TAG, 0);
apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
DEFAULT_OFFSET);
- transfer = pull_phonebook(pbap, message, GETPHONEBOOKSIZE, name, NULL,
- apparam, &err);
-
- g_free(name);
- g_obex_apparam_free(apparam);
-
- if (transfer != NULL)
- return NULL;
-
- reply = g_dbus_create_error(message, ERROR_INTERFACE ".Failed", "%s",
- err->message);
- g_error_free(err);
- return reply;
+ return pull_phonebook(pbap, message, GETPHONEBOOKSIZE, NULL, apparam);
}
static gchar **get_filter_strs(uint64_t filter, gint *size)
--
1.7.11.4
^ permalink raw reply related
* [PATCH obexd 5/7 v2] test: Update pbap-client to work with changes in PhonebookAcess
From: Luiz Augusto von Dentz @ 2012-08-28 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1346157115-23933-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
test/pbap-client | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/test/pbap-client b/test/pbap-client
index 498f8a3..7dd54ef 100755
--- a/test/pbap-client
+++ b/test/pbap-client
@@ -70,16 +70,16 @@ class PbapClient:
print "Transfer finished with error %s: %s" % (code, message)
mainloop.quit()
- def pull(self, vcard, func):
+ def pull(self, vcard, params, func):
req = Transfer(func)
- self.pbap.Pull(vcard, "",
+ self.pbap.Pull(vcard, "", params,
reply_handler=lambda r: self.register(r, req),
error_handler=self.error)
self.transfers += 1
- def pull_all(self, func):
+ def pull_all(self, params, func):
req = Transfer(func)
- self.pbap.PullAll("",
+ self.pbap.PullAll("", params,
reply_handler=lambda r: self.register(r, req),
error_handler=self.error)
self.transfers += 1
@@ -135,18 +135,15 @@ if __name__ == '__main__':
print "Size = %d\n" % (ret)
print "\n--- List vCard ---\n"
- ret = pbap_client.interface().List()
+ ret = pbap_client.interface().List(dbus.Dictionary())
+ params = dbus.Dictionary({ "Format" : "vcard30",
+ "Fields" : [ "VERSION", "FN", "TEL"] })
for item in ret:
print "%s : %s" % (item[0], item[1])
- pbap_client.interface().SetFormat("vcard30")
- pbap_client.interface().SetFilter(["VERSION", "FN",
- "TEL"]);
- pbap_client.pull(item[0],
+ pbap_client.pull(item[0], params,
lambda x: process_result(x, None))
- pbap_client.interface().SetFormat("vcard30")
- pbap_client.interface().SetFilter(["VERSION", "FN", "TEL"]);
- pbap_client.pull_all(lambda x: process_result(x,
+ pbap_client.pull_all(params, lambda x: process_result(x,
"\n--- PullAll ---\n"))
pbap_client.flush_transfers(lambda: test_paths(paths[1:]))
--
1.7.11.4
^ permalink raw reply related
* [PATCH obexd 4/7 v2] client: Remove deprecated methods from PhonebookAccess
From: Luiz Augusto von Dentz @ 2012-08-28 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1346157115-23933-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
SetFormat, SetOrder, SetFilter and GetFilter methods are no longer
necessary as other methods now take them as parameters to avoid round
trips.
---
client/pbap.c | 197 +++++-----------------------------------------------------
1 file changed, 14 insertions(+), 183 deletions(-)
diff --git a/client/pbap.c b/client/pbap.c
index 97c9ef5..e58efe5 100644
--- a/client/pbap.c
+++ b/client/pbap.c
@@ -116,9 +116,6 @@ static const char *filter_list[] = {
struct pbap_data {
struct obc_session *session;
char *path;
- guint8 format;
- guint8 order;
- uint64_t filter;
};
struct pending_request {
@@ -607,91 +604,6 @@ fail:
return reply;
}
-static int set_format(struct pbap_data *pbap, const char *formatstr)
-{
- if (!formatstr || g_str_equal(formatstr, "")) {
- pbap->format = FORMAT_VCARD21;
- return 0;
- }
-
- if (!g_ascii_strcasecmp(formatstr, "vcard21"))
- pbap->format = FORMAT_VCARD21;
- else if (!g_ascii_strcasecmp(formatstr, "vcard30"))
- pbap->format = FORMAT_VCARD30;
- else
- return -EINVAL;
-
- return 0;
-}
-
-static int set_order(struct pbap_data *pbap, const char *orderstr)
-{
- if (!orderstr || g_str_equal(orderstr, "")) {
- pbap->order = ORDER_INDEXED;
- return 0;
- }
-
- if (!g_ascii_strcasecmp(orderstr, "indexed"))
- pbap->order = ORDER_INDEXED;
- else if (!g_ascii_strcasecmp(orderstr, "alphanumeric"))
- pbap->order = ORDER_ALPHANUMERIC;
- else if (!g_ascii_strcasecmp(orderstr, "phonetic"))
- pbap->order = ORDER_PHONETIC;
- else
- return -EINVAL;
-
- return 0;
-}
-
-static int add_filter(struct pbap_data *pbap, const char *filterstr)
-{
- uint64_t mask;
-
- mask = get_filter_mask(filterstr);
-
- if (mask == 0)
- return -EINVAL;
-
- pbap->filter |= mask;
- return 0;
-}
-
-static int remove_filter(struct pbap_data *pbap, const char *filterstr)
-{
- uint64_t mask;
-
- mask = get_filter_mask(filterstr);
-
- if (mask == 0)
- return -EINVAL;
-
- pbap->filter &= ~mask;
- return 0;
-}
-
-static gchar **get_filter_strs(uint64_t filter, gint *size)
-{
- gchar **list, **item;
- gint i;
- gint filter_list_size = sizeof(filter_list) / sizeof(filter_list[0]) - 1;
-
- list = g_malloc0(sizeof(gchar **) * (FILTER_BIT_MAX + 2));
-
- item = list;
-
- for (i = 0; i < filter_list_size; i++)
- if (filter & (1ULL << i))
- *(item++) = g_strdup(filter_list[i]);
-
- for (i = filter_list_size; i <= FILTER_BIT_MAX; i++)
- if (filter & (1ULL << i))
- *(item++) = g_strdup_printf("%s%d", "BIT", i);
-
- *item = NULL;
- *size = item - list;
- return list;
-}
-
static DBusMessage *pbap_select(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
@@ -1001,95 +913,26 @@ static DBusMessage *pbap_get_size(DBusConnection *connection,
return reply;
}
-static DBusMessage *pbap_set_format(DBusConnection *connection,
- DBusMessage *message, void *user_data)
-{
- struct pbap_data *pbap = user_data;
- const char *format;
-
- if (dbus_message_get_args(message, NULL,
- DBUS_TYPE_STRING, &format,
- DBUS_TYPE_INVALID) == FALSE)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments", NULL);
-
- if (set_format(pbap, format) < 0)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments",
- "InvalidFormat");
-
- return dbus_message_new_method_return(message);
-}
-
-static DBusMessage *pbap_set_order(DBusConnection *connection,
- DBusMessage *message, void *user_data)
-{
- struct pbap_data *pbap = user_data;
- const char *order;
-
- if (dbus_message_get_args(message, NULL,
- DBUS_TYPE_STRING, &order,
- DBUS_TYPE_INVALID) == FALSE)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments", NULL);
-
- if (set_order(pbap, order) < 0)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments",
- "InvalidFilter");
-
- return dbus_message_new_method_return(message);
-}
-
-static DBusMessage *pbap_set_filter(DBusConnection *connection,
- DBusMessage *message, void *user_data)
+static gchar **get_filter_strs(uint64_t filter, gint *size)
{
- struct pbap_data *pbap = user_data;
- char **filters, **item;
- gint size;
- uint64_t oldfilter = pbap->filter;
-
- if (dbus_message_get_args(message, NULL, DBUS_TYPE_ARRAY,
- DBUS_TYPE_STRING, &filters, &size,
- DBUS_TYPE_INVALID) == FALSE)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments", NULL);
-
- remove_filter(pbap, "ALL");
- if (size == 0)
- goto done;
+ gchar **list, **item;
+ gint i;
- for (item = filters; *item; item++) {
- if (add_filter(pbap, *item) < 0) {
- pbap->filter = oldfilter;
- g_strfreev(filters);
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments",
- "InvalidFilters");
- }
- }
+ list = g_malloc0(sizeof(gchar **) * (FILTER_BIT_MAX + 2));
-done:
- g_strfreev(filters);
- return dbus_message_new_method_return(message);
-}
+ item = list;
-static DBusMessage *pbap_get_filter(DBusConnection *connection,
- DBusMessage *message, void *user_data)
-{
- struct pbap_data *pbap = user_data;
- gchar **filters = NULL;
- gint size;
- DBusMessage *reply;
+ for (i = 0; filter_list[i] != NULL; i++)
+ if (filter & (1ULL << i))
+ *(item++) = g_strdup(filter_list[i]);
- filters = get_filter_strs(pbap->filter, &size);
- reply = dbus_message_new_method_return(message);
- dbus_message_append_args(reply, DBUS_TYPE_ARRAY,
- DBUS_TYPE_STRING, &filters, size,
- DBUS_TYPE_INVALID);
+ for (; i <= FILTER_BIT_MAX; i++)
+ if (filter & (1ULL << i))
+ *(item++) = g_strdup_printf("%s%d", "BIT", i);
- g_strfreev(filters);
- return reply;
+ *item = NULL;
+ *size = item - list;
+ return list;
}
static DBusMessage *pbap_list_filter_fields(DBusConnection *connection,
@@ -1137,18 +980,6 @@ static const GDBusMethodTable pbap_methods[] = {
{ GDBUS_ASYNC_METHOD("GetSize",
NULL, GDBUS_ARGS({ "size", "q" }),
pbap_get_size) },
- { GDBUS_METHOD("SetFormat",
- GDBUS_ARGS({ "format", "s" }), NULL,
- pbap_set_format) },
- { GDBUS_METHOD("SetOrder",
- GDBUS_ARGS({ "order", "s" }), NULL,
- pbap_set_order) },
- { GDBUS_METHOD("SetFilter",
- GDBUS_ARGS({ "fields", "as" }), NULL,
- pbap_set_filter) },
- { GDBUS_METHOD("GetFilter",
- NULL, GDBUS_ARGS({ "fields", "as" }),
- pbap_get_filter) },
{ GDBUS_METHOD("ListFilterFields",
NULL, GDBUS_ARGS({ "fields", "as" }),
pbap_list_filter_fields) },
--
1.7.11.4
^ permalink raw reply related
* [PATCH obexd 3/7 v2] client: Add filters to PhonebookAccess.List and PhonebookAccess.Search
From: Luiz Augusto von Dentz @ 2012-08-28 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1346157115-23933-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This avoid D-Bus round trips and is more aligned with what has been
proposed for MessageAccess interface.
---
client/pbap.c | 115 ++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 76 insertions(+), 39 deletions(-)
diff --git a/client/pbap.c b/client/pbap.c
index 6eefda1..97c9ef5 100644
--- a/client/pbap.c
+++ b/client/pbap.c
@@ -574,35 +574,24 @@ static struct obc_transfer *pull_phonebook(struct pbap_data *pbap,
static DBusMessage *pull_vcard_listing(struct pbap_data *pbap,
DBusMessage *message, const char *name,
- guint8 order, char *searchval, guint8 attrib,
- guint16 count, guint16 offset)
+ GObexApparam *apparam)
{
struct pending_request *request;
struct obc_transfer *transfer;
guint8 buf[272];
gsize len;
GError *err = NULL;
- GObexApparam *apparam;
DBusMessage *reply;
+ len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
+ g_obex_apparam_free(apparam);
+
transfer = obc_transfer_get("x-bt/vcard-listing", name, NULL, &err);
if (transfer == NULL)
goto fail;
- apparam = g_obex_apparam_set_uint8(NULL, ORDER_TAG, order);
- apparam = g_obex_apparam_set_uint8(apparam, SEARCHATTRIB_TAG, attrib);
- apparam = g_obex_apparam_set_string(apparam, SEARCHVALUE_TAG,
- searchval);
- apparam = g_obex_apparam_set_uint16(apparam, MAXLISTCOUNT_TAG, count);
- apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
- offset);
-
- len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
-
obc_transfer_set_params(transfer, buf, len);
- g_obex_apparam_free(apparam);
-
request = pending_request_new(pbap, message);
if (obc_session_queue(pbap->session, transfer,
pull_vcard_listing_callback, request, &err))
@@ -882,34 +871,33 @@ static DBusMessage *pbap_list(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
struct pbap_data *pbap = user_data;
+ GObexApparam *apparam;
+ DBusMessageIter args;
if (!pbap->path)
return g_dbus_create_error(message,
ERROR_INTERFACE ".Forbidden",
"Call Select first of all");
- return pull_vcard_listing(pbap, message, "", pbap->order, "",
- ATTRIB_NAME, DEFAULT_COUNT, DEFAULT_OFFSET);
-}
+ dbus_message_iter_init(message, &args);
-static DBusMessage *pbap_search(DBusConnection *connection,
- DBusMessage *message, void *user_data)
-{
- struct pbap_data *pbap = user_data;
- char *field, *value;
- guint8 attrib;
+ apparam = g_obex_apparam_set_uint16(NULL, MAXLISTCOUNT_TAG,
+ DEFAULT_COUNT);
+ apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
+ DEFAULT_OFFSET);
- if (dbus_message_get_args(message, NULL,
- DBUS_TYPE_STRING, &field,
- DBUS_TYPE_STRING, &value,
- DBUS_TYPE_INVALID) == FALSE)
+ if (parse_filters(apparam, &args) == NULL) {
+ g_obex_apparam_free(apparam);
return g_dbus_create_error(message,
ERROR_INTERFACE ".InvalidArguments", NULL);
+ }
- if (!pbap->path)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".Forbidden",
- "Call Select first of all");
+ return pull_vcard_listing(pbap, message, "", apparam);
+}
+
+static GObexApparam *parse_attribute(GObexApparam *apparam, const char *field)
+{
+ guint8 attrib;
if (!field || g_str_equal(field, ""))
attrib = ATTRIB_NAME;
@@ -920,11 +908,58 @@ static DBusMessage *pbap_search(DBusConnection *connection,
else if (!g_ascii_strcasecmp(field, "sound"))
attrib = ATTRIB_SOUND;
else
+ return NULL;
+
+ return g_obex_apparam_set_uint8(apparam, SEARCHATTRIB_TAG, attrib);
+}
+
+static DBusMessage *pbap_search(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ struct pbap_data *pbap = user_data;
+ char *field, *value;
+ GObexApparam *apparam;
+ DBusMessageIter args;
+
+ if (!pbap->path)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".Forbidden",
+ "Call Select first of all");
+
+ dbus_message_iter_init(message, &args);
+
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+
+ dbus_message_iter_get_basic(&args, &field);
+ dbus_message_iter_next(&args);
+
+ apparam = parse_attribute(NULL, field);
+ if (apparam == NULL)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+
+ dbus_message_iter_get_basic(&args, &value);
+ dbus_message_iter_next(&args);
+
+ apparam = g_obex_apparam_set_uint16(apparam, MAXLISTCOUNT_TAG,
+ DEFAULT_COUNT);
+ apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
+ DEFAULT_OFFSET);
+ apparam = g_obex_apparam_set_string(apparam, SEARCHVALUE_TAG, value);
+
+ if (parse_filters(apparam, &args) == NULL) {
+ g_obex_apparam_free(apparam);
return g_dbus_create_error(message,
ERROR_INTERFACE ".InvalidArguments", NULL);
+ }
- return pull_vcard_listing(pbap, message, "", pbap->order, value,
- attrib, DEFAULT_COUNT, DEFAULT_OFFSET);
+ return pull_vcard_listing(pbap, message, "", apparam);
}
static DBusMessage *pbap_get_size(DBusConnection *connection,
@@ -1091,12 +1126,14 @@ static const GDBusMethodTable pbap_methods[] = {
{ "properties", "a{sv}" }),
pbap_pull_vcard) },
{ GDBUS_ASYNC_METHOD("List",
- NULL, GDBUS_ARGS({ "vcard_listing", "a(ss)" }),
- pbap_list) },
+ GDBUS_ARGS({ "filters", "a{sv}" }),
+ GDBUS_ARGS({ "vcard_listing", "a(ss)" }),
+ pbap_list) },
{ GDBUS_ASYNC_METHOD("Search",
- GDBUS_ARGS({ "field", "s" }, { "value", "s" }),
- GDBUS_ARGS({ "vcard_listing", "a(ss)" }),
- pbap_search) },
+ GDBUS_ARGS({ "field", "s" }, { "value", "s" },
+ { "filters", "a{sv}" }),
+ GDBUS_ARGS({ "vcard_listing", "a(ss)" }),
+ pbap_search) },
{ GDBUS_ASYNC_METHOD("GetSize",
NULL, GDBUS_ARGS({ "size", "q" }),
pbap_get_size) },
--
1.7.11.4
^ permalink raw reply related
* [PATCH obexd 2/7 v2] client: Add filters to PhonebookAccess.Pull
From: Luiz Augusto von Dentz @ 2012-08-28 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1346157115-23933-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This avoid D-Bus round trips and is more aligned with what has been
proposed for MessageAccess interface.
---
client/pbap.c | 79 +++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 53 insertions(+), 26 deletions(-)
diff --git a/client/pbap.c b/client/pbap.c
index f40f04b..6eefda1 100644
--- a/client/pbap.c
+++ b/client/pbap.c
@@ -611,6 +611,7 @@ static DBusMessage *pull_vcard_listing(struct pbap_data *pbap,
pending_request_free(request);
fail:
+ g_obex_apparam_free(apparam);
reply = g_dbus_create_error(message, ERROR_INTERFACE ".Failed", "%s",
err->message);
g_error_free(err);
@@ -803,43 +804,25 @@ static DBusMessage *pbap_pull_all(DBusConnection *connection,
return obc_transfer_create_dbus_reply(transfer, message);
}
-static DBusMessage *pbap_pull_vcard(DBusConnection *connection,
- DBusMessage *message, void *user_data)
+static DBusMessage *pull_vcard(struct pbap_data *pbap, DBusMessage *message,
+ const char *name, const char *targetfile,
+ GObexApparam *apparam)
{
- struct pbap_data *pbap = user_data;
struct obc_transfer *transfer;
- GObexApparam *apparam;
- guint8 buf[32];
- gsize len;
- const char *name, *targetfile;
DBusMessage *reply;
GError *err = NULL;
+ guint8 buf[32];
+ gsize len;
- if (!pbap->path)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".Forbidden",
- "Call Select first of all");
-
- if (dbus_message_get_args(message, NULL,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &targetfile,
- DBUS_TYPE_INVALID) == FALSE)
- return g_dbus_create_error(message,
- ERROR_INTERFACE ".InvalidArguments", NULL);
+ len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
+ g_obex_apparam_free(apparam);
transfer = obc_transfer_get("x-bt/vcard", name, targetfile, &err);
if (transfer == NULL)
goto fail;
- apparam = g_obex_apparam_set_uint64(NULL, FILTER_TAG, pbap->filter);
- apparam = g_obex_apparam_set_uint8(apparam, FORMAT_TAG, pbap->format);
-
- len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
-
obc_transfer_set_params(transfer, buf, len);
- g_obex_apparam_free(apparam);
-
if (!obc_session_queue(pbap->session, transfer, NULL, NULL, &err))
goto fail;
@@ -852,6 +835,49 @@ fail:
return reply;
}
+static DBusMessage *pbap_pull_vcard(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ struct pbap_data *pbap = user_data;
+ GObexApparam *apparam;
+ const char *name, *targetfile;
+ DBusMessageIter args;
+
+ if (!pbap->path)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".Forbidden",
+ "Call Select first of all");
+
+ dbus_message_iter_init(message, &args);
+
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+
+ dbus_message_iter_get_basic(&args, &name);
+ dbus_message_iter_next(&args);
+
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+
+ dbus_message_iter_get_basic(&args, &targetfile);
+ dbus_message_iter_next(&args);
+
+ apparam = g_obex_apparam_set_uint16(NULL, MAXLISTCOUNT_TAG,
+ DEFAULT_COUNT);
+ apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
+ DEFAULT_OFFSET);
+
+ if (parse_filters(apparam, &args) == NULL) {
+ g_obex_apparam_free(apparam);
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+ }
+
+ return pull_vcard(pbap, message, name, targetfile, apparam);
+}
+
static DBusMessage *pbap_list(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
@@ -1059,7 +1085,8 @@ static const GDBusMethodTable pbap_methods[] = {
{ "properties", "a{sv}" }),
pbap_pull_all) },
{ GDBUS_METHOD("Pull",
- GDBUS_ARGS({ "vcard", "s" }, { "targetfile", "s" }),
+ GDBUS_ARGS({ "vcard", "s" }, { "targetfile", "s" },
+ { "filters", "a{sv}" }),
GDBUS_ARGS({ "transfer", "o" },
{ "properties", "a{sv}" }),
pbap_pull_vcard) },
--
1.7.11.4
^ permalink raw reply related
* [PATCH obexd 1/7 v2] client: Add filters to Phonebook.PullAll
From: Luiz Augusto von Dentz @ 2012-08-28 12:31 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This avoid D-Bus round trips and is more aligned with what has been
proposed for MessageAccess interface.
---
client/pbap.c | 255 +++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 209 insertions(+), 46 deletions(-)
diff --git a/client/pbap.c b/client/pbap.c
index ebd6320..f40f04b 100644
--- a/client/pbap.c
+++ b/client/pbap.c
@@ -351,18 +351,190 @@ send:
pending_request_free(request);
}
+static GObexApparam *parse_format(GObexApparam *apparam, DBusMessageIter *iter)
+{
+ const char *string;
+ guint8 format;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return NULL;
+
+ dbus_message_iter_get_basic(iter, &string);
+
+ if (!string || g_str_equal(string, ""))
+ format = FORMAT_VCARD21;
+ else if (!g_ascii_strcasecmp(string, "vcard21"))
+ format = FORMAT_VCARD21;
+ else if (!g_ascii_strcasecmp(string, "vcard30"))
+ format = FORMAT_VCARD30;
+ else
+ return NULL;
+
+ return g_obex_apparam_set_uint8(apparam, FORMAT_TAG, format);
+}
+
+static GObexApparam *parse_order(GObexApparam *apparam, DBusMessageIter *iter)
+{
+ const char *string;
+ guint8 order;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return NULL;
+
+ dbus_message_iter_get_basic(iter, &string);
+
+ if (!string || g_str_equal(string, ""))
+ order = ORDER_INDEXED;
+ else if (!g_ascii_strcasecmp(string, "indexed"))
+ order = ORDER_INDEXED;
+ else if (!g_ascii_strcasecmp(string, "alphanumeric"))
+ order = ORDER_ALPHANUMERIC;
+ else if (!g_ascii_strcasecmp(string, "phonetic"))
+ order = ORDER_PHONETIC;
+ else
+ return NULL;
+
+ return g_obex_apparam_set_uint8(apparam, ORDER_TAG, order);
+}
+
+static GObexApparam *parse_offset(GObexApparam *apparam, DBusMessageIter *iter)
+{
+ guint16 num;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_UINT16)
+ return NULL;
+
+ dbus_message_iter_get_basic(iter, &num);
+
+ return g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG, num);
+}
+
+static GObexApparam *parse_max_count(GObexApparam *apparam,
+ DBusMessageIter *iter)
+{
+ guint16 num;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_UINT16)
+ return NULL;
+
+ dbus_message_iter_get_basic(iter, &num);
+
+ return g_obex_apparam_set_uint16(apparam, MAXLISTCOUNT_TAG, num);
+}
+
+static uint64_t get_filter_mask(const char *filterstr)
+{
+ int i, bit = -1;
+
+ if (!filterstr)
+ return 0;
+
+ if (!g_ascii_strcasecmp(filterstr, "ALL"))
+ return FILTER_ALL;
+
+ for (i = 0; filter_list[i] != NULL; i++)
+ if (!g_ascii_strcasecmp(filterstr, filter_list[i]))
+ return 1ULL << i;
+
+ if (strlen(filterstr) < 4 || strlen(filterstr) > 5
+ || g_ascii_strncasecmp(filterstr, "bit", 3) != 0)
+ return 0;
+
+ sscanf(&filterstr[3], "%d", &bit);
+ if (bit >= 0 && bit <= FILTER_BIT_MAX)
+ return 1ULL << bit;
+ else
+ return 0;
+}
+
+static int set_field(guint64 *filter, const char *filterstr)
+{
+ guint64 mask;
+
+ mask = get_filter_mask(filterstr);
+
+ if (mask == 0)
+ return -EINVAL;
+
+ *filter |= mask;
+ return 0;
+}
+
+static GObexApparam *parse_fields(GObexApparam *apparam, DBusMessageIter *iter)
+{
+ DBusMessageIter array;
+ guint64 filter = 0;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
+ return NULL;
+
+ dbus_message_iter_recurse(iter, &array);
+
+ while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_STRING) {
+ const char *string;
+
+ dbus_message_iter_get_basic(&array, &string);
+
+ if (set_field(&filter, string) < 0)
+ return NULL;
+
+ dbus_message_iter_next(&array);
+ }
+
+ return g_obex_apparam_set_uint64(apparam, FILTER_TAG, filter);
+}
+static GObexApparam *parse_filters(GObexApparam *apparam,
+ DBusMessageIter *iter)
+{
+ DBusMessageIter array;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
+ return NULL;
+
+ dbus_message_iter_recurse(iter, &array);
+
+ while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_DICT_ENTRY) {
+ const char *key;
+ DBusMessageIter value, entry;
+
+ dbus_message_iter_recurse(&array, &entry);
+ dbus_message_iter_get_basic(&entry, &key);
+
+ dbus_message_iter_next(&entry);
+ dbus_message_iter_recurse(&entry, &value);
+
+ if (strcasecmp(key, "Format") == 0) {
+ if (parse_format(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "Order") == 0) {
+ if (parse_order(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "Offset") == 0) {
+ if (parse_offset(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "MaxCount") == 0) {
+ if (parse_max_count(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "Fields") == 0) {
+ if (parse_fields(apparam, &value) == NULL)
+ return NULL;
+ }
+
+ dbus_message_iter_next(&array);
+ }
+
+ return apparam;
+}
+
static struct obc_transfer *pull_phonebook(struct pbap_data *pbap,
DBusMessage *message,
guint8 type, const char *name,
const char *targetfile,
- uint64_t filter, guint8 format,
- guint16 maxlistcount,
- guint16 liststartoffset,
+ GObexApparam *apparam,
GError **err)
{
struct pending_request *request;
struct obc_transfer *transfer;
- GObexApparam *apparam;
guint8 buf[32];
gsize len;
session_callback_t func;
@@ -371,13 +543,6 @@ static struct obc_transfer *pull_phonebook(struct pbap_data *pbap,
if (transfer == NULL)
return NULL;
- apparam = g_obex_apparam_set_uint64(NULL, FILTER_TAG, filter);
- apparam = g_obex_apparam_set_uint8(apparam, FORMAT_TAG, format);
- apparam = g_obex_apparam_set_uint16(apparam, MAXLISTCOUNT_TAG,
- maxlistcount);
- apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
- liststartoffset);
-
switch (type) {
case PULLPHONEBOOK:
func = NULL;
@@ -396,8 +561,6 @@ static struct obc_transfer *pull_phonebook(struct pbap_data *pbap,
obc_transfer_set_params(transfer, buf, len);
- g_obex_apparam_free(apparam);
-
if (!obc_session_queue(pbap->session, transfer, func, request, err)) {
if (request != NULL)
pending_request_free(request);
@@ -490,31 +653,6 @@ static int set_order(struct pbap_data *pbap, const char *orderstr)
return 0;
}
-static uint64_t get_filter_mask(const char *filterstr)
-{
- int i, bit = -1;
-
- if (!filterstr)
- return 0;
-
- if (!g_ascii_strcasecmp(filterstr, "ALL"))
- return FILTER_ALL;
-
- for (i = 0; filter_list[i] != NULL; i++)
- if (!g_ascii_strcasecmp(filterstr, filter_list[i]))
- return 1ULL << i;
-
- if (strlen(filterstr) < 4 || strlen(filterstr) > 5
- || g_ascii_strncasecmp(filterstr, "bit", 3) != 0)
- return 0;
-
- sscanf(&filterstr[3], "%d", &bit);
- if (bit >= 0 && bit <= FILTER_BIT_MAX)
- return 1ULL << bit;
- else
- return 0;
-}
-
static int add_filter(struct pbap_data *pbap, const char *filterstr)
{
uint64_t mask;
@@ -618,25 +756,41 @@ static DBusMessage *pbap_pull_all(DBusConnection *connection,
struct obc_transfer *transfer;
const char *targetfile;
char *name;
+ GObexApparam *apparam;
GError *err = NULL;
+ DBusMessageIter args;
if (!pbap->path)
return g_dbus_create_error(message,
ERROR_INTERFACE ".Forbidden",
"Call Select first of all");
- if (dbus_message_get_args(message, NULL,
- DBUS_TYPE_STRING, &targetfile,
- DBUS_TYPE_INVALID) == FALSE)
+ dbus_message_iter_init(message, &args);
+
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
return g_dbus_create_error(message,
ERROR_INTERFACE ".InvalidArguments", NULL);
+ dbus_message_iter_get_basic(&args, &targetfile);
+ dbus_message_iter_next(&args);
+
+ apparam = g_obex_apparam_set_uint16(NULL, MAXLISTCOUNT_TAG,
+ DEFAULT_COUNT);
+ apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
+ DEFAULT_OFFSET);
+
+ if (parse_filters(apparam, &args) == NULL) {
+ g_obex_apparam_free(apparam);
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+ }
+
name = g_strconcat(pbap->path, ".vcf", NULL);
transfer = pull_phonebook(pbap, message, PULLPHONEBOOK, name,
- targetfile, pbap->filter, pbap->format,
- DEFAULT_COUNT, DEFAULT_OFFSET, &err);
+ targetfile, apparam, &err);
g_free(name);
+ g_obex_apparam_free(apparam);
if (transfer == NULL) {
DBusMessage *reply = g_dbus_create_error(message,
@@ -754,20 +908,28 @@ static DBusMessage *pbap_get_size(DBusConnection *connection,
DBusMessage *reply;
struct obc_transfer *transfer;
char *name;
+ GObexApparam *apparam;
GError *err = NULL;
+ DBusMessageIter args;
if (!pbap->path)
return g_dbus_create_error(message,
ERROR_INTERFACE ".Forbidden",
"Call Select first of all");
+ dbus_message_iter_init(message, &args);
+
name = g_strconcat(pbap->path, ".vcf", NULL);
+ apparam = g_obex_apparam_set_uint16(NULL, MAXLISTCOUNT_TAG, 0);
+ apparam = g_obex_apparam_set_uint16(apparam, LISTSTARTOFFSET_TAG,
+ DEFAULT_OFFSET);
+
transfer = pull_phonebook(pbap, message, GETPHONEBOOKSIZE, name, NULL,
- pbap->filter, pbap->format, 0,
- DEFAULT_OFFSET, &err);
+ apparam, &err);
g_free(name);
+ g_obex_apparam_free(apparam);
if (transfer != NULL)
return NULL;
@@ -891,7 +1053,8 @@ static const GDBusMethodTable pbap_methods[] = {
GDBUS_ARGS({ "location", "s" }, { "phonebook", "s" }),
NULL, pbap_select) },
{ GDBUS_METHOD("PullAll",
- GDBUS_ARGS({ "targetfile", "s" }),
+ GDBUS_ARGS({ "targetfile", "s" },
+ { "filters", "a{sv}" }),
GDBUS_ARGS({ "transfer", "o" },
{ "properties", "a{sv}" }),
pbap_pull_all) },
--
1.7.11.4
^ permalink raw reply related
* Re: [PATCH obexd 7/7] client-doc: Update documentation of PhonebookAccess interface
From: Luiz Augusto von Dentz @ 2012-08-28 12:03 UTC (permalink / raw)
To: Patrick Ohly; +Cc: linux-bluetooth
In-Reply-To: <1346146381.9800.56.camel@pohly-mobl1.fritz.box>
Hi Patrick,
On Tue, Aug 28, 2012 at 12:33 PM, Patrick Ohly <patrick.ohly@intel.com> wrote:
> The user of a specific device would have to know that.
>
> SyncEvolution's "exclude fields" logic is based on the assumption that
> requesting everything, including the custom bits, will result in
> everything the device supports, just like not specifying any filter at
> all.
So there is a possibility that we detect what kind of extra bits the
remote stack implements based on vendor id/product id, but I would
like to avoid specific behavior per device. Besides it seems what we
want is all custom bits.
>> > Should the API spec really specify the full list? IMHO the documentation
>> > should make it clear that the list is not exhaustive - more fields might
>> > be added in future releases of the PBAP standard and obexd, without
>> > changing the obexd API.
>>
>> If we can discover what the bits mean then yes, but unfortunately this
>> is hardcoded in the PBAP spec (see page 30), so we are only defining
>> the one we know the meaning.
>
> It's okay to only document those, but it should still allow the use of
> the other things. Otherwise a user of the API would have to patch obexd
> to use the extensions.
>
>> > In SyncEvolution, I use ListFilterFields() to a) do sanity checks on
>> > user input and to b) build a list of all fields from which the user can
>> > exclude specific fields. Because the field list is not hard-coded, that
>> > will work for fields which are not defined yet.
>>
>> As you can see from the spec this is pretty static so adding a round
>> trip to discover the list sounds wrong to me,
>
> Hard-coding it in SyncEvolution seems equally wrong to me. If the list
> changes, then only obexd needs to be updated, not "obexd +
> SyncEvolution".
>
> It's only one round-trip per session. As a tradeoff between performance
> and being future-proof I think doing the call is worth it.
Fair enough so Im keeping ListFilterFields with original names to be
direct match to the vcard fields, I hope this is really useful for
someone.
--
Luiz Augusto von Dentz
^ permalink raw reply
* [PATCH v2 2/2] Bluetooth: mgmt: Fix enabling LE while powered off
From: Andrzej Kaczmarek @ 2012-08-28 11:52 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
In-Reply-To: <1346154743-18749-1-git-send-email-andrzej.kaczmarek@tieto.com>
Set LE called when hdev is up but still has HCI_AUTO_OFF flag set will
only change dev_flags and enable feature in host but won't enable feature
in controller. As a resulit it's not possible to e.g. start LE only or
interleaved discovery due to missing LE Supported flag in local features.
This patch ensures HCI Write LE Host Supported is sent when Set Powered is
called to clear HCI_AUTO_OFF flag.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
---
net/bluetooth/mgmt.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index ccc6716..57ce7cd 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2897,6 +2897,16 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
}
+ if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
+ struct hci_cp_write_le_host_supported cp;
+
+ cp.le = 1;
+ cp.simul = !!(hdev->features[6] & LMP_SIMUL_LE_BR);
+
+ hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED,
+ sizeof(cp), &cp);
+ }
+
update_class(hdev);
update_name(hdev, hdev->dev_name);
update_eir(hdev);
--
1.7.11.3
^ permalink raw reply related
* [PATCH v2 1/2] Bluetooth: mgmt: Fix enabling SSP while powered off
From: Andrzej Kaczmarek @ 2012-08-28 11:52 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
Set SSP called when hdev is up but still has HCI_AUTO_OFF flag set will
only change dev_flags and enable feature in host but won't enable feature
in controller. As a result some devices will reject IO Capa Request due to
missing SSP Host Support flag in extended features and thus won't allow
SSP or fallback to legacy pairing.
This patch ensures HCI Write Simple Pairing Mode is sent when Set Powered is
called to clear HCI_AUTO_OFF flag.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
---
net/bluetooth/mgmt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 05d4b83..ccc6716 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2891,6 +2891,12 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
if (scan)
hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
+ if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) {
+ u8 ssp = 1;
+
+ hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
+ }
+
update_class(hdev);
update_name(hdev, hdev->dev_name);
update_eir(hdev);
--
1.7.11.3
^ permalink raw reply related
* [Crash report & Patch obexd 1/1] map: gboolean holds int value which 0/1 crashes in DBusMessage
From: Venkateswaran, Srinivasa Ragavan @ 2012-08-28 11:37 UTC (permalink / raw)
To: linux-bluetooth
[-- Attachment #1: Type: text/plain, Size: 399 bytes --]
Hi,
I was testing MAP and I came across a crash (trace attached). I
figured out that the crash is because dbus expects gboolean to be 0/1
where as it holds the 'int' results from strcasecmp. I've attached the
patch that fixed the problem for me. This is my first message/patch to
this list, sorry if it isn't in the right/expected format, just
suggest me and I could put it right.
Thanks,
-Srini.
[-- Attachment #2: obex-crash.txt --]
[-- Type: text/plain, Size: 3052 bytes --]
Thread 1 (Thread 0x7ffff7fce700 (LWP 6124)):
#0 0x00007ffff7328d95 in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007ffff732a2ab in __GI_abort () at abort.c:93
#2 0x00007ffff78d0655 in _dbus_abort () at dbus-sysdeps.c:94
#3 0x00007ffff78c75f1 in _dbus_warn_check_failed (format=0x7ffff78d6920 "arguments to %s() were incorrect, assertion \"%s\" failed in file %s line %d.\nThis is normally a bug in some application using the D-Bus library.\n") at dbus-internals.c:289
#4 0x00007ffff78ba28b in dbus_message_iter_append_basic (iter=0x7fffffffd320, type=<optimized out>, value=0x7fffffffd43c) at dbus-message.c:2538
#5 0x00000000004201c3 in append_variant (iter=0x7fffffffd3b0, type=98, value=0x7fffffffd43c) at client/dbus.c:44
#6 0x000000000042024e in obex_dbus_dict_append (dict=0x7fffffffd480, key=0x4252bb "Read", type=98, value=0x7fffffffd43c) at client/dbus.c:65
#7 0x000000000041dcc9 in parse_read (msg=0x63c650, value=0x63be00 "yes", iter=0x7fffffffd480) at client/map.c:423
#8 0x000000000041dfa7 in msg_element (ctxt=0x63bc50, element=0x63bd70 "msg", names=0x7fffffffd5f0, values=0x7fffffffd560, user_data=0x6347b0, gerr=0x7fffffffd680) at client/map.c:518
#9 0x00007ffff7b323b9 in emit_start_element (context=0x63bc50, error=0x0) at gmarkup.c:986
#10 0x00007ffff7b33b44 in g_markup_parse_context_parse (context=0x63bc50, text=<optimized out>, text_len=<optimized out>, error=0x0) at gmarkup.c:1323
#11 0x000000000041e1ad in message_listing_cb (session=0x631450, transfer=0x633fd0, err=0x0, user_data=0x638b60) at client/map.c:586
#12 0x000000000041744c in session_terminate_transfer (session=0x631450, transfer=0x633fd0, gerr=0x0) at client/session.c:743
#13 0x00000000004174d7 in session_notify_complete (session=0x631450, transfer=0x633fd0) at client/session.c:758
#14 0x000000000041755a in transfer_complete (transfer=0x633fd0, err=0x0, user_data=0x631450) at client/session.c:778
#15 0x000000000041f57b in xfer_complete (obex=0x634660, err=0x0, user_data=0x633fd0) at client/transfer.c:521
#16 0x000000000040efdf in transfer_complete (transfer=0x63b260, err=0x0) at gobex/gobex-transfer.c:102
#17 0x000000000040f418 in transfer_response (obex=0x634660, err=0x0, rsp=0x633d00, user_data=0x63b260) at gobex/gobex-transfer.c:221
#18 0x000000000040b320 in handle_response (obex=0x634660, err=0x0, rsp=0x633d00) at gobex/gobex.c:948
#19 0x000000000040bbc1 in incoming_data (io=0x638da0, cond=G_IO_IN, user_data=0x634660) at gobex/gobex.c:1191
#20 0x00007ffff7b2f94a in g_main_dispatch (context=0x62f130) at gmain.c:2515
#21 g_main_context_dispatch (context=0x62f130) at gmain.c:3052
#22 0x00007ffff7b2fd10 in g_main_context_iterate (dispatch=1, block=<optimized out>, context=0x62f130, self=<optimized out>) at gmain.c:3123
#23 g_main_context_iterate (context=0x62f130, block=<optimized out>, dispatch=1, self=<optimized out>) at gmain.c:3060
#24 0x00007ffff7b3010a in g_main_loop_run (loop=0x62e1b0) at gmain.c:3317
#25 0x000000000041527d in main (argc=1, argv=0x7fffffffdca8) at client/main.c:175
(gdb)
[-- Attachment #3: 1849-Boolean-is-expected-to-be-1-0-where-as-strcasecmp-re.patch --]
[-- Type: application/octet-stream, Size: 1853 bytes --]
From 21f52e59bf567a321c07a94d46d1ee2a12330abf Mon Sep 17 00:00:00 2001
From: Srinivasa Ragavan <sragavan@gnome.org>
Date: Tue, 28 Aug 2012 16:44:05 +0530
Subject: [PATCH 1849/1849] Boolean is expected to be 1/0 where as strcasecmp
returns gint. Crashes in DBusMessage at
_dbus_return_val_if_fail (*bool_p == 0 || *bool_p == 1, FALSE);
---
client/map.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/client/map.c b/client/map.c
index e606cb2..4f07fcb 100644
--- a/client/map.c
+++ b/client/map.c
@@ -400,7 +400,7 @@ static void parse_size(struct map_msg *msg, const char *value,
static void parse_priority(struct map_msg *msg, const char *value,
DBusMessageIter *iter)
{
- gboolean flag = strcasecmp(value, "no");
+ gboolean flag = strcasecmp(value, "no") != 0;
if (flag)
msg->flags |= MAP_MSG_FLAG_PRIORITY;
@@ -413,7 +413,7 @@ static void parse_priority(struct map_msg *msg, const char *value,
static void parse_read(struct map_msg *msg, const char *value,
DBusMessageIter *iter)
{
- gboolean flag = strcasecmp(value, "no");
+ gboolean flag = strcasecmp(value, "no") != 0;
if (flag)
msg->flags |= MAP_MSG_FLAG_READ;
@@ -426,7 +426,7 @@ static void parse_read(struct map_msg *msg, const char *value,
static void parse_sent(struct map_msg *msg, const char *value,
DBusMessageIter *iter)
{
- gboolean flag = strcasecmp(value, "no");
+ gboolean flag = strcasecmp(value, "no") != 0;
if (flag)
msg->flags |= MAP_MSG_FLAG_SENT;
@@ -439,7 +439,7 @@ static void parse_sent(struct map_msg *msg, const char *value,
static void parse_protected(struct map_msg *msg, const char *value,
DBusMessageIter *iter)
{
- gboolean flag = strcasecmp(value, "no");
+ gboolean flag = strcasecmp(value, "no") != 0;
if (flag)
msg->flags |= MAP_MSG_FLAG_PROTECTED;
--
1.7.7
^ permalink raw reply related
* [PATCH v2 4/4] network: Fix bnep setup failure handle bug
From: chanyeol.park @ 2012-08-28 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1346149495-9363-1-git-send-email-chanyeol.park@samsung.com>
From: Chan-yeol Park <chanyeol.park@samsung.com>
This patch initializes rsp varialbe again for the remain failure
procedure.
---
profiles/network/server.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/profiles/network/server.c b/profiles/network/server.c
index a3274d9..bcb233e 100644
--- a/profiles/network/server.c
+++ b/profiles/network/server.c
@@ -343,7 +343,7 @@ static uint16_t bnep_setup_decode(struct bnep_setup_conn_req *req,
return BNEP_CONN_INVALID_SVC;
}
- return 0;
+ return BNEP_SUCCESS;
}
static void session_free(void *data)
@@ -425,6 +425,8 @@ static gboolean bnep_setup(GIOChannel *chan,
if (rsp)
goto reply;
+ rsp = BNEP_CONN_NOT_ALLOWED;
+
ns = find_server(na->servers, dst_role);
if (!ns) {
error("Server unavailable: (0x%x)", dst_role);
--
1.7.9.5
^ permalink raw reply related
* [PATCH v2 3/4] core: replace NULL by dbus invalid arguments
From: chanyeol.park @ 2012-08-28 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1346149495-9363-1-git-send-email-chanyeol.park@samsung.com>
From: Chan-yeol Park <chanyeol.park@samsung.com>
This patch replaces NULL with dbus invalid arguments return
if dbus method call gets invalid arguments from the peer.
This will avoid dbus peer coommander's infinite wait.
---
audio/media.c | 4 ++--
audio/transport.c | 4 ++--
plugins/service.c | 8 ++++----
profiles/network/connection.c | 2 +-
profiles/network/server.c | 4 ++--
src/adapter.c | 4 ++--
src/manager.c | 2 +-
7 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/audio/media.c b/audio/media.c
index ea6d582..b0ea4e9 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -926,7 +926,7 @@ static DBusMessage *unregister_endpoint(DBusConnection *conn, DBusMessage *msg,
if (!dbus_message_get_args(msg, NULL,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID))
- return NULL;
+ return btd_error_invalid_args(msg);
sender = dbus_message_get_sender(msg);
@@ -1808,7 +1808,7 @@ static DBusMessage *unregister_player(DBusConnection *conn, DBusMessage *msg,
if (!dbus_message_get_args(msg, NULL,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID))
- return NULL;
+ return btd_error_invalid_args(msg);
sender = dbus_message_get_sender(msg);
diff --git a/audio/transport.c b/audio/transport.c
index 832ad2a..d40c92d 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -667,7 +667,7 @@ static DBusMessage *acquire(DBusConnection *conn, DBusMessage *msg,
if (!dbus_message_get_args(msg, NULL,
DBUS_TYPE_STRING, &accesstype,
DBUS_TYPE_INVALID))
- return NULL;
+ return btd_error_invalid_args(msg);
sender = dbus_message_get_sender(msg);
@@ -704,7 +704,7 @@ static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
if (!dbus_message_get_args(msg, NULL,
DBUS_TYPE_STRING, &accesstype,
DBUS_TYPE_INVALID))
- return NULL;
+ return btd_error_invalid_args(msg);
sender = dbus_message_get_sender(msg);
diff --git a/plugins/service.c b/plugins/service.c
index 9f7bdb7..f16abe7 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -422,7 +422,7 @@ static DBusMessage *update_xml_record(DBusConnection *conn,
DBUS_TYPE_UINT32, &handle,
DBUS_TYPE_STRING, &record,
DBUS_TYPE_INVALID) == FALSE)
- return NULL;
+ return btd_error_invalid_args(msg);
len = (record ? strlen(record) : 0);
if (len == 0)
@@ -475,7 +475,7 @@ static DBusMessage *add_service_record(DBusConnection *conn,
if (dbus_message_get_args(msg, NULL,
DBUS_TYPE_STRING, &record, DBUS_TYPE_INVALID) == FALSE)
- return NULL;
+ return btd_error_invalid_args(msg);
sender = dbus_message_get_sender(msg);
err = add_xml_record(conn, sender, serv_adapter, record, &handle);
@@ -509,7 +509,7 @@ static DBusMessage *remove_service_record(DBusConnection *conn,
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_UINT32, &handle,
DBUS_TYPE_INVALID) == FALSE)
- return NULL;
+ return btd_error_invalid_args(msg);
sender = dbus_message_get_sender(msg);
@@ -582,7 +582,7 @@ static DBusMessage *request_authorization(DBusConnection *conn,
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &address,
DBUS_TYPE_UINT32, &handle,
DBUS_TYPE_INVALID) == FALSE)
- return NULL;
+ return btd_error_invalid_args(msg);
sender = dbus_message_get_sender(msg);
if (find_pending_by_sender(serv_adapter, sender))
diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index e8ac643..c1ae3fa 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
@@ -402,7 +402,7 @@ static DBusMessage *connection_connect(DBusConnection *conn,
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &svc,
DBUS_TYPE_INVALID) == FALSE)
- return NULL;
+ return btd_error_invalid_args(msg);
id = bnep_service_id(svc);
nc = find_connection(peer->connections, id);
diff --git a/profiles/network/server.c b/profiles/network/server.c
index cfad893..a3274d9 100644
--- a/profiles/network/server.c
+++ b/profiles/network/server.c
@@ -633,7 +633,7 @@ static DBusMessage *register_server(DBusConnection *conn,
if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &uuid,
DBUS_TYPE_STRING, &bridge, DBUS_TYPE_INVALID))
- return NULL;
+ return btd_error_invalid_args(msg);
if (g_strcmp0(uuid, "nap"))
return btd_error_failed(msg, "Invalid UUID");
@@ -668,7 +668,7 @@ static DBusMessage *unregister_server(DBusConnection *conn,
if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &uuid,
DBUS_TYPE_INVALID))
- return NULL;
+ return btd_error_invalid_args(msg);
if (g_strcmp0(uuid, "nap"))
return btd_error_failed(msg, "Invalid UUID");
diff --git a/src/adapter.c b/src/adapter.c
index 50779fd..4c70e2f 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1574,7 +1574,7 @@ static DBusMessage *register_agent(DBusConnection *conn, DBusMessage *msg,
if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_STRING, &capability, DBUS_TYPE_INVALID))
- return NULL;
+ return btd_error_invalid_args(msg);
if (adapter->agent)
return btd_error_already_exists(msg);
@@ -1604,7 +1604,7 @@ static DBusMessage *unregister_agent(DBusConnection *conn, DBusMessage *msg,
if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID))
- return NULL;
+ return btd_error_invalid_args(msg);
name = dbus_message_get_sender(msg);
diff --git a/src/manager.c b/src/manager.c
index 4a39461..738bf0b 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -96,7 +96,7 @@ static DBusMessage *find_adapter(DBusConnection *conn,
if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &pattern,
DBUS_TYPE_INVALID))
- return NULL;
+ return btd_error_invalid_args(msg);
/* hci_devid() would make sense to use here, except it is
* restricted to devices which are up */
--
1.7.9.5
^ permalink raw reply related
* [PATCH v2 2/4] audio: Remove unused enum values
From: chanyeol.park @ 2012-08-28 10:24 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1346149495-9363-1-git-send-email-chanyeol.park@samsung.com>
From: Chan-yeol Park <chanyeol.park@samsung.com>
---
audio/manager.c | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/audio/manager.c b/audio/manager.c
index 6411707..7634a68 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -69,23 +69,6 @@
#include "sdpd.h"
#include "telephony.h"
-typedef enum {
- HEADSET = 1 << 0,
- GATEWAY = 1 << 1,
- SINK = 1 << 2,
- SOURCE = 1 << 3,
- CONTROL = 1 << 4,
- TARGET = 1 << 5,
- INVALID = 1 << 6
-} audio_service_type;
-
-typedef enum {
- GENERIC_AUDIO = 0,
- ADVANCED_AUDIO,
- AV_REMOTE,
- GET_RECORDS
-} audio_sdp_state_t;
-
struct audio_adapter {
struct btd_adapter *btd_adapter;
gboolean powered;
--
1.7.9.5
^ permalink raw reply related
* [PATCH v2 1/4] audio: remove redundant Media API option
From: chanyeol.park @ 2012-08-28 10:24 UTC (permalink / raw)
To: linux-bluetooth
From: Chan-yeol Park <chanyeol.park@samsung.com>
BlueZ supports only Media API. So option handler's are useless.
---
audio/audio.conf | 2 +-
audio/manager.c | 12 ++----------
audio/manager.h | 2 --
3 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/audio/audio.conf b/audio/audio.conf
index 662647c..d1c57d3 100644
--- a/audio/audio.conf
+++ b/audio/audio.conf
@@ -8,7 +8,7 @@
#Master=true
# If we want to disable support for specific services
-# Defaults to supporting the services: HFP, Headset, Sink, Control and Media
+# Defaults to supporting the services: HFP, Headset, Sink, Control
#Disable=Gateway,Source
# SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
diff --git a/audio/manager.c b/audio/manager.c
index 999124d..6411707 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -112,7 +112,6 @@ static struct enabled_interfaces enabled = {
.sink = TRUE,
.source = FALSE,
.control = TRUE,
- .media = TRUE,
};
static struct audio_adapter *find_adapter(GSList *list,
@@ -1180,9 +1179,6 @@ int audio_manager_init(DBusConnection *conn, GKeyFile *conf,
enabled.source = TRUE;
else if (g_str_equal(list[i], "Control"))
enabled.control = TRUE;
- else if (g_str_equal(list[i], "Media"))
- enabled.media = TRUE;
-
}
g_strfreev(list);
@@ -1199,8 +1195,6 @@ int audio_manager_init(DBusConnection *conn, GKeyFile *conf,
enabled.source = FALSE;
else if (g_str_equal(list[i], "Control"))
enabled.control = FALSE;
- else if (g_str_equal(list[i], "Media"))
- enabled.media = FALSE;
}
g_strfreev(list);
@@ -1231,8 +1225,7 @@ proceed:
if (enabled.control)
btd_register_adapter_driver(&avrcp_server_driver);
- if (enabled.media)
- btd_register_adapter_driver(&media_server_driver);
+ btd_register_adapter_driver(&media_server_driver);
if (enabled.headset)
btd_register_adapter_driver(&headset_server_driver);
@@ -1264,8 +1257,7 @@ void audio_manager_exit(void)
config = NULL;
}
- if (enabled.media)
- btd_unregister_adapter_driver(&media_server_driver);
+ btd_unregister_adapter_driver(&media_server_driver);
if (enabled.headset)
btd_unregister_adapter_driver(&headset_server_driver);
diff --git a/audio/manager.h b/audio/manager.h
index f1d3021..3c8b1e0 100644
--- a/audio/manager.h
+++ b/audio/manager.h
@@ -29,8 +29,6 @@ struct enabled_interfaces {
gboolean sink;
gboolean source;
gboolean control;
- gboolean socket;
- gboolean media;
gboolean media_player;
};
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 2/2] Bluetooth: mgmt: Fix enabling LE while powered off
From: Andrzej Kaczmarek @ 2012-08-28 9:43 UTC (permalink / raw)
To: Andrei Emeltchenko, linux-bluetooth
In-Reply-To: <20120828074008.GA4602@aemeltch-MOBL1>
Hi Andrei,
On 08/28/2012 09:40 AM, Andrei Emeltchenko wrote:
> Hi Andrzej,
>
> On Mon, Aug 27, 2012 at 04:47:30PM +0200, Andrzej Kaczmarek wrote:
>> Set LE called when hdev is up but still has HCI_AUTO_OFF flag set will
>> only change dev_flags and enable feature in host but won't enable feature
>> in controller. As a resulit it's not possible to e.g. start LE only or
>> interleaved discovery due to missing LE Supported flag in local features.
>>
>> This patch ensures HCI Write LE Host Supported is sent when Set Powered is
>> called to clear HCI_AUTO_OFF flag.
>>
>> Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
>> ---
>> net/bluetooth/mgmt.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
>> index ccc6716..f73441f 100644
>> --- a/net/bluetooth/mgmt.c
>> +++ b/net/bluetooth/mgmt.c
>> @@ -2897,6 +2897,17 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
>> hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
>> }
>>
>> + if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
>> + struct hci_cp_write_le_host_supported cp;
>> +
>> + memset(&cp, 0, sizeof(cp));
>
> Why memset is needed here?
Not really needed, I forgot to remove it after copy&paste from other
code. I'll send v2 later with memset removed.
BR,
Andrzej
^ permalink raw reply
* Re: [PATCH obexd 7/7] client-doc: Update documentation of PhonebookAccess interface
From: Patrick Ohly @ 2012-08-28 9:33 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <CABBYNZKi47Nigic1w=bZonOMf8FM5A=bz+aQoBaM9PnGsALxkg@mail.gmail.com>
On Tue, 2012-08-28 at 10:52 +0300, Luiz Augusto von Dentz wrote:
> On Tue, Aug 28, 2012 at 9:56 AM, Patrick Ohly <patrick.ohly@intel.com> wrote:
> > What about selecting the bits which don't have a named property
> > associated with them? They are reported by ListFilterFields() and thus
> > seem to be supported.
>
> ListFilterFields is removed in this case,
I find it useful, please don't remove it.
> anyway setting bits is still
> supported but Im not so sure I would keep it since apparently there is
> no way to discover what they mean which could be different from stack
> to stack.
The user of a specific device would have to know that.
SyncEvolution's "exclude fields" logic is based on the assumption that
requesting everything, including the custom bits, will result in
everything the device supports, just like not specifying any filter at
all.
> > Should the API spec really specify the full list? IMHO the documentation
> > should make it clear that the list is not exhaustive - more fields might
> > be added in future releases of the PBAP standard and obexd, without
> > changing the obexd API.
>
> If we can discover what the bits mean then yes, but unfortunately this
> is hardcoded in the PBAP spec (see page 30), so we are only defining
> the one we know the meaning.
It's okay to only document those, but it should still allow the use of
the other things. Otherwise a user of the API would have to patch obexd
to use the extensions.
> > In SyncEvolution, I use ListFilterFields() to a) do sanity checks on
> > user input and to b) build a list of all fields from which the user can
> > exclude specific fields. Because the field list is not hard-coded, that
> > will work for fields which are not defined yet.
>
> As you can see from the spec this is pretty static so adding a round
> trip to discover the list sounds wrong to me,
Hard-coding it in SyncEvolution seems equally wrong to me. If the list
changes, then only obexd needs to be updated, not "obexd +
SyncEvolution".
It's only one round-trip per session. As a tradeoff between performance
and being future-proof I think doing the call is worth it.
--
Best Regards
Patrick Ohly
Senior Software Engineer
Intel GmbH
Open Source Technology Center
Pützstr. 5 Phone: +49-228-2493652
53129 Bonn
Germany
^ permalink raw reply
* Re: [PATCH obexd 7/7] client-doc: Update documentation of PhonebookAccess interface
From: Luiz Augusto von Dentz @ 2012-08-28 9:24 UTC (permalink / raw)
To: Luiz Augusto von Dentz, linux-bluetooth
In-Reply-To: <CABBYNZLLgdRGzrY7z_8Nz8OeXtmapvsoKiQHL6UHLzuyqy=8HQ@mail.gmail.com>
Hi Johan,
On Tue, Aug 28, 2012 at 10:00 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>>> + array{string} Fields:
>>> +
>>> + Item vcard fields, default is all
>>> + values.
>>> +
>>> + Possible values:
>>> +
>>> + "VERSION",
>>> + "FN",
>>> + "N",
>>> + "PHOTO",
>>> + "BDAY",
>>> + "ADR",
>>> + "LABEL",
>>> + "TEL",
>>> + "EMAIL",
>>> + "MAILER",
>>> + "TZ",
>>> + "GEO",
>>> + "TITLE",
>>> + "ROLE",
>>> + "LOGO",
>>> + "AGENT",
>>> + "ORG",
>>> + "NOTE",
>>> + "REV",
>>> + "SOUND",
>>> + "URL",
>>> + "UID",
>>> + "KEY",
>>> + "NICKNAME",
>>> + "CATEGORIES",
>>> + "PROID",
>>> + "CLASS",
>>> + "SORT-STRING",
>>> + "X-IRMC-CALL-DATETIME"
>>
>> Make these lower case (I know it's upper case in the spec. but let's
>> keep the consistency with the rest of the D-Bus API).
So what about the following:
Possible values:
"version",
"formatted-name",
"name",
"photo",
"birthday",
"address",
"label",
"telephone",
"email",
"mailer",
"time-zone",
"location",
"title",
"role",
"logo",
"agent",
"organization",
"note",
"revision",
"source",
"url",
"uid",
"key",
"nickname",
"categories",
"product",
"class",
"sort-string",
"timestamp"
--
Luiz Augusto von Dentz
^ permalink raw reply
* [RFCv2] Bluetooth: Fix deadlock when closing socket
From: Andrei Emeltchenko @ 2012-08-28 8:20 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1346079173-3284-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
If we have unacked frames when closing bluetooth socket we deadlock
since conn->chan_lock, chan->lock and socket lock are taken. Remove
__l2cap_wait_ack completely.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
include/net/bluetooth/l2cap.h | 1 -
net/bluetooth/l2cap_core.c | 32 --------------------------------
net/bluetooth/l2cap_sock.c | 3 ---
3 files changed, 36 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 430218b..3ec8679 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -755,7 +755,6 @@ int l2cap_init_sockets(void);
void l2cap_cleanup_sockets(void);
void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);
-int __l2cap_wait_ack(struct sock *sk);
int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm);
int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index bd13fb7..ea2082a 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1686,38 +1686,6 @@ done:
return err;
}
-int __l2cap_wait_ack(struct sock *sk)
-{
- struct l2cap_chan *chan = l2cap_pi(sk)->chan;
- DECLARE_WAITQUEUE(wait, current);
- int err = 0;
- int timeo = HZ/5;
-
- add_wait_queue(sk_sleep(sk), &wait);
- set_current_state(TASK_INTERRUPTIBLE);
- while (chan->unacked_frames > 0 && chan->conn) {
- if (!timeo)
- timeo = HZ/5;
-
- if (signal_pending(current)) {
- err = sock_intr_errno(timeo);
- break;
- }
-
- release_sock(sk);
- timeo = schedule_timeout(timeo);
- lock_sock(sk);
- set_current_state(TASK_INTERRUPTIBLE);
-
- err = sock_error(sk);
- if (err)
- break;
- }
- set_current_state(TASK_RUNNING);
- remove_wait_queue(sk_sleep(sk), &wait);
- return err;
-}
-
static void l2cap_monitor_timeout(struct work_struct *work)
{
struct l2cap_chan *chan = container_of(work, struct l2cap_chan,
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 997e0cb..cc26b1f 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -866,9 +866,6 @@ static int l2cap_sock_shutdown(struct socket *sock, int how)
lock_sock(sk);
if (!sk->sk_shutdown) {
- if (chan->mode == L2CAP_MODE_ERTM)
- err = __l2cap_wait_ack(sk);
-
sk->sk_shutdown = SHUTDOWN_MASK;
release_sock(sk);
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH obexd 7/7] client-doc: Update documentation of PhonebookAccess interface
From: Luiz Augusto von Dentz @ 2012-08-28 7:52 UTC (permalink / raw)
To: Patrick Ohly; +Cc: linux-bluetooth
In-Reply-To: <1346137014.9800.19.camel@pohly-mobl1.fritz.box>
Hi Patrick,
On Tue, Aug 28, 2012 at 9:56 AM, Patrick Ohly <patrick.ohly@intel.com> wrote:
> On Fri, 2012-08-24 at 16:59 +0300, Luiz Augusto von Dentz wrote:
>> + array{string} Fields:
>> +
>> + Item vcard fields, default is all
>> + values.
>> +
>> + Possible values:
>> +
>> + "VERSION",
>> + "FN",
>> + "N",
>> + "PHOTO",
>> + "BDAY",
>> + "ADR",
>> + "LABEL",
>> + "TEL",
>> + "EMAIL",
>> + "MAILER",
>> + "TZ",
>> + "GEO",
>> + "TITLE",
>> + "ROLE",
>> + "LOGO",
>> + "AGENT",
>> + "ORG",
>> + "NOTE",
>> + "REV",
>> + "SOUND",
>> + "URL",
>> + "UID",
>> + "KEY",
>> + "NICKNAME",
>> + "CATEGORIES",
>> + "PROID",
>> + "CLASS",
>> + "SORT-STRING",
>> + "X-IRMC-CALL-DATETIME"
>
> What about selecting the bits which don't have a named property
> associated with them? They are reported by ListFilterFields() and thus
> seem to be supported.
ListFilterFields is removed in this case, anyway setting bits is still
supported but Im not so sure I would keep it since apparently there is
no way to discover what they mean which could be different from stack
to stack.
> Should the API spec really specify the full list? IMHO the documentation
> should make it clear that the list is not exhaustive - more fields might
> be added in future releases of the PBAP standard and obexd, without
> changing the obexd API.
If we can discover what the bits mean then yes, but unfortunately this
is hardcoded in the PBAP spec (see page 30), so we are only defining
the one we know the meaning.
> In SyncEvolution, I use ListFilterFields() to a) do sanity checks on
> user input and to b) build a list of all fields from which the user can
> exclude specific fields. Because the field list is not hard-coded, that
> will work for fields which are not defined yet.
As you can see from the spec this is pretty static so adding a round
trip to discover the list sounds wrong to me, but perhaps you have
some way to discover the meaning of the bits not defined in the spec?
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [PATCH 2/2] Bluetooth: mgmt: Fix enabling LE while powered off
From: Andrei Emeltchenko @ 2012-08-28 7:40 UTC (permalink / raw)
To: Andrzej Kaczmarek; +Cc: linux-bluetooth
In-Reply-To: <1346078850-32704-2-git-send-email-andrzej.kaczmarek@tieto.com>
Hi Andrzej,
On Mon, Aug 27, 2012 at 04:47:30PM +0200, Andrzej Kaczmarek wrote:
> Set LE called when hdev is up but still has HCI_AUTO_OFF flag set will
> only change dev_flags and enable feature in host but won't enable feature
> in controller. As a resulit it's not possible to e.g. start LE only or
> interleaved discovery due to missing LE Supported flag in local features.
>
> This patch ensures HCI Write LE Host Supported is sent when Set Powered is
> called to clear HCI_AUTO_OFF flag.
>
> Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
> ---
> net/bluetooth/mgmt.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index ccc6716..f73441f 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -2897,6 +2897,17 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
> hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &ssp);
> }
>
> + if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
> + struct hci_cp_write_le_host_supported cp;
> +
> + memset(&cp, 0, sizeof(cp));
Why memset is needed here?
Best regards
Andrei Emeltchenko
> + cp.le = 1;
> + cp.simul = !!(hdev->features[6] & LMP_SIMUL_LE_BR);
> +
> + hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED,
> + sizeof(cp), &cp);
> + }
> +
> update_class(hdev);
> update_name(hdev, hdev->dev_name);
> update_eir(hdev);
> --
> 1.7.11.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH obexd 7/7] client-doc: Update documentation of PhonebookAccess interface
From: Luiz Augusto von Dentz @ 2012-08-28 7:00 UTC (permalink / raw)
To: Luiz Augusto von Dentz, linux-bluetooth
In-Reply-To: <20120828011708.GA11305@x220.sheraton.com>
Hi Johan,
On Tue, Aug 28, 2012 at 4:17 AM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> Hi Luiz,
>
> On Fri, Aug 24, 2012, Luiz Augusto von Dentz wrote:
>> ---
>> doc/client-api.txt | 180 ++++++++++++++++++++++++++++++++++++++++++-----------
>> 1 file changed, 145 insertions(+), 35 deletions(-)
>
> I had a chat with Marcel about this API which resulted with the
> following change proposals:
>
>> + string Order:
>> +
>> + Items order
>> +
>> + Possible values: "indexed" (default),
>> + "alphanumeric" or "phonetic"
>> +
>> + uint16 Offset:
>> +
>> + Offset of the first item, default is 0
>> +
>> + uint16 Items:
>> +
>> + Maximum number of items, default is
>> + unlimited (65535)
>
> Call this MaxCount or Count to make it clearer.
Will do it.
>> +
>> + array{string} Fields:
>> +
>> + Item vcard fields, default is all
>> + values.
>> +
>> + Possible values:
>> +
>> + "VERSION",
>> + "FN",
>> + "N",
>> + "PHOTO",
>> + "BDAY",
>> + "ADR",
>> + "LABEL",
>> + "TEL",
>> + "EMAIL",
>> + "MAILER",
>> + "TZ",
>> + "GEO",
>> + "TITLE",
>> + "ROLE",
>> + "LOGO",
>> + "AGENT",
>> + "ORG",
>> + "NOTE",
>> + "REV",
>> + "SOUND",
>> + "URL",
>> + "UID",
>> + "KEY",
>> + "NICKNAME",
>> + "CATEGORIES",
>> + "PROID",
>> + "CLASS",
>> + "SORT-STRING",
>> + "X-IRMC-CALL-DATETIME"
>
> Make these lower case (I know it's upper case in the spec. but let's
> keep the consistency with the rest of the D-Bus API).
Sure
>> @@ -244,8 +325,54 @@ Methods void Select(string location, string phonebook)
>> The properties of this transfer are also returned along
>> with the object path, to avoid a call to GetProperties.
>>
>> + filters:
>> +
>> + string Format:
>> +
>> + Items vcard format
>> +
>> + Possible values: "vcard21" (default) or
>> + "vcard30"
>> +
>> + array{string} Fields:
>> +
>> + Item vcard fields, default is all
>> + values.
>> +
>> + Possible values:
>> +
>> + "VERSION",
>> + "FN",
>> + "N",
>> + "PHOTO",
>> + "BDAY",
>> + "ADR",
>> + "LABEL",
>> + "TEL",
>> + "EMAIL",
>> + "MAILER",
>> + "TZ",
>> + "GEO",
>> + "TITLE",
>> + "ROLE",
>> + "LOGO",
>> + "AGENT",
>> + "ORG",
>> + "NOTE",
>> + "REV",
>> + "SOUND",
>> + "URL",
>> + "UID",
>> + "KEY",
>> + "NICKNAME",
>> + "CATEGORIES",
>> + "PROID",
>> + "CLASS",
>> + "SORT-STRING",
>> + "X-IRMC-CALL-DATETIME"
>
> Is this a duplicate of the previous section. Maybe just move this out to
> a common section and the refer to it from the places that need it.
Depending on the method some parameters may not be valid, but maybe we
can have a section explaining the filters parameter then in each of
method we just enumerate what are the possible parameters for its
filter.
--
Luiz Augusto von Dentz
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox