* [PATCH 1/2] Fix not responding to pbap GET when data is already cached
@ 2011-02-17 8:53 Luiz Augusto von Dentz
2011-02-17 8:53 ` [PATCH 2/2] Add workaround for devices which use absolute path in pbap Name header Luiz Augusto von Dentz
2011-02-17 18:45 ` [PATCH 1/2] Fix not responding to pbap GET when data is already cached Johan Hedberg
0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2011-02-17 8:53 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
When data is cached but no stream/body is set the driver .write is never
called so no response is generated.
---
src/obex.c | 35 +++++++++++++++--------------------
1 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/src/obex.c b/src/obex.c
index 98f0e4d..e6e22f5 100644
--- a/src/obex.c
+++ b/src/obex.c
@@ -813,30 +813,25 @@ static void cmd_get(struct obex_session *os, obex_t *obex, obex_object_t *obj)
/* Add body header */
hd.bs = NULL;
- if (os->size == 0)
- OBEX_ObjectAddHeader (obex, obj, OBEX_HDR_BODY,
- hd, 0, OBEX_FL_FIT_ONE_PACKET);
- else if (!stream) {
- /* Asynchronous operation that doesn't use stream */
+ if (os->size == 0) {
+ OBEX_ObjectAddHeader(obex, obj, OBEX_HDR_BODY, hd, 0,
+ OBEX_FL_FIT_ONE_PACKET);
+ goto done;
+ }
+
+ if (stream)
+ /* Standard data stream */
+ OBEX_ObjectAddHeader(obex, obj, OBEX_HDR_BODY, hd, 0,
+ OBEX_FL_STREAM_START);
+
+ /* Try to write to stream and suspend the stream immediately
+ * if no data available to send. */
+ err = obex_write_stream(os, obex, obj);
+ if (err == -EAGAIN) {
OBEX_SuspendRequest(obex, obj);
os->obj = obj;
os->driver->set_io_watch(os->object, handle_async_io, os);
return;
- } else {
- /* Standard data stream */
- OBEX_ObjectAddHeader (obex, obj, OBEX_HDR_BODY,
- hd, 0, OBEX_FL_STREAM_START);
-
- /* Try to write to stream and suspend the stream immediately
- * if no data available to send. */
- err = obex_write_stream(os, obex, obj);
- if (err == -EAGAIN) {
- OBEX_SuspendRequest(obex, obj);
- os->obj = obj;
- os->driver->set_io_watch(os->object, handle_async_io,
- os);
- return;
- }
}
done:
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] Add workaround for devices which use absolute path in pbap Name header
2011-02-17 8:53 [PATCH 1/2] Fix not responding to pbap GET when data is already cached Luiz Augusto von Dentz
@ 2011-02-17 8:53 ` Luiz Augusto von Dentz
2011-02-17 18:45 ` [PATCH 1/2] Fix not responding to pbap GET when data is already cached Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2011-02-17 8:53 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
The pbap spec says:
"5.1.2 Name
The Name header shall contain the absolute path in the virtual folders
architecture of the PSE, appended with the name of the file representation of
one of the Phone Book Objects.
Example: telecom/pb.vcf or SIM1/telecom/pb.vcf for the main phone book
objects."
The example actually uses relative paths but text state absolute paths although
the OBEX specification says that the Name header is always relative to the
current path.
---
plugins/pbap.c | 6 +++++-
plugins/phonebook-tracker.c | 26 +++++++++++++-------------
2 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/plugins/pbap.c b/plugins/pbap.c
index b04dca9..61e7e42 100644
--- a/plugins/pbap.c
+++ b/plugins/pbap.c
@@ -658,7 +658,11 @@ static int pbap_get(struct obex_session *os, obex_object_t *obj,
if (strcmp(type, PHONEBOOK_TYPE) == 0) {
/* Always contains the absolute path */
- path = g_strdup(name);
+ if (g_path_is_absolute(name))
+ path = g_strdup(name);
+ else
+ path = g_build_filename("/", name, NULL);
+
*stream = (params->maxlistcount == 0 ? FALSE : TRUE);
} else if (strcmp(type, VCARDLISTING_TYPE) == 0) {
/* Always relative */
diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index eb38a46..8a0246a 100644
--- a/plugins/phonebook-tracker.c
+++ b/plugins/phonebook-tracker.c
@@ -934,15 +934,15 @@ static TrackerSparqlConnection *connection = NULL;
static const char *name2query(const char *name)
{
- if (g_str_equal(name, "telecom/pb.vcf"))
+ if (g_str_equal(name, "/telecom/pb.vcf"))
return CONTACTS_QUERY_ALL;
- else if (g_str_equal(name, "telecom/ich.vcf"))
+ else if (g_str_equal(name, "/telecom/ich.vcf"))
return INCOMING_CALLS_QUERY;
- else if (g_str_equal(name, "telecom/och.vcf"))
+ else if (g_str_equal(name, "/telecom/och.vcf"))
return OUTGOING_CALLS_QUERY;
- else if (g_str_equal(name, "telecom/mch.vcf"))
+ else if (g_str_equal(name, "/telecom/mch.vcf"))
return MISSED_CALLS_QUERY;
- else if (g_str_equal(name, "telecom/cch.vcf"))
+ else if (g_str_equal(name, "/telecom/cch.vcf"))
return COMBINED_CALLS_QUERY;
return NULL;
@@ -950,15 +950,15 @@ static const char *name2query(const char *name)
static const char *name2count_query(const char *name)
{
- if (g_str_equal(name, "telecom/pb.vcf"))
+ if (g_str_equal(name, "/telecom/pb.vcf"))
return CONTACTS_COUNT_QUERY;
- else if (g_str_equal(name, "telecom/ich.vcf"))
+ else if (g_str_equal(name, "/telecom/ich.vcf"))
return INCOMING_CALLS_COUNT_QUERY;
- else if (g_str_equal(name, "telecom/och.vcf"))
+ else if (g_str_equal(name, "/telecom/och.vcf"))
return OUTGOING_CALLS_COUNT_QUERY;
- else if (g_str_equal(name, "telecom/mch.vcf"))
+ else if (g_str_equal(name, "/telecom/mch.vcf"))
return MISSED_CALLS_COUNT_QUERY;
- else if (g_str_equal(name, "telecom/cch.vcf"))
+ else if (g_str_equal(name, "/telecom/cch.vcf"))
return COMBINED_CALLS_COUNT_QUERY;
return NULL;
@@ -1921,11 +1921,11 @@ done:
}
if (data->params->maxlistcount == 0) {
- query = name2count_query("telecom/mch.vcf");
+ query = name2count_query("/telecom/mch.vcf");
col_amount = COUNT_QUERY_COL_AMOUNT;
pull_cb = pull_contacts_size;
} else {
- query = name2query("telecom/mch.vcf");
+ query = name2query("/telecom/mch.vcf");
col_amount = PULL_QUERY_COL_AMOUNT;
pull_cb = pull_contacts;
}
@@ -1970,7 +1970,7 @@ int phonebook_pull_read(void *request)
if(!data)
return -ENOENT;
- if (g_strcmp0(data->req_name, "telecom/mch.vcf") == 0) {
+ if (g_strcmp0(data->req_name, "/telecom/mch.vcf") == 0) {
query = NEW_MISSED_CALLS_LIST;
col_amount = PULL_QUERY_COL_AMOUNT;
pull_cb = pull_newmissedcalls;
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] Fix not responding to pbap GET when data is already cached
2011-02-17 8:53 [PATCH 1/2] Fix not responding to pbap GET when data is already cached Luiz Augusto von Dentz
2011-02-17 8:53 ` [PATCH 2/2] Add workaround for devices which use absolute path in pbap Name header Luiz Augusto von Dentz
@ 2011-02-17 18:45 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2011-02-17 18:45 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
On Thu, Feb 17, 2011, Luiz Augusto von Dentz wrote:
> When data is cached but no stream/body is set the driver .write is never
> called so no response is generated.
> ---
> src/obex.c | 35 +++++++++++++++--------------------
> 1 files changed, 15 insertions(+), 20 deletions(-)
Thanks. Both patches have been pushed upstream.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-02-17 18:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-17 8:53 [PATCH 1/2] Fix not responding to pbap GET when data is already cached Luiz Augusto von Dentz
2011-02-17 8:53 ` [PATCH 2/2] Add workaround for devices which use absolute path in pbap Name header Luiz Augusto von Dentz
2011-02-17 18:45 ` [PATCH 1/2] Fix not responding to pbap GET when data is already cached Johan Hedberg
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).