linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dylan Van Assche <me@dylanvanassche.be>
To: linux-bluetooth@vger.kernel.org
Cc: Hannu Mallat <hmallat@gmail.com>
Subject: [PATCH BlueZ 4/4] obexd: phonebook: Set default apparams for PTS clients
Date: Fri, 23 Jul 2021 15:58:24 +0200	[thread overview]
Message-ID: <20210723135824.8032-5-me@dylanvanassche.be> (raw)
In-Reply-To: <20210723135824.8032-1-me@dylanvanassche.be>

From: Hannu Mallat <hmallat@gmail.com>

Some PTS clients do not send all the mandatory apparams
when retrieving the phonebook. Clients such as car multimedia systems
cannot be fixed, therefore working around this issue by inserting
default apparams which makes these clients work as well.
---
 obexd/plugins/pbap.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index efae92cd8..ab5236316 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
@@ -511,6 +511,21 @@ static int pbap_get(struct obex_session *os, void *user_data)
 		rsize = 0;
 	}
 
+	/* Workaround for PTS client not sending mandatory apparams */
+	if (!rsize && g_ascii_strcasecmp(type, VCARDLISTING_TYPE) == 0) {
+		static const uint8_t default_apparams[] = {
+			0x04, 0x02, 0xff, 0xff
+		};
+		buffer = default_apparams;
+		rsize = sizeof(default_apparams);
+	} else if (!rsize && g_ascii_strcasecmp(type, VCARDENTRY_TYPE) == 0) {
+		static const uint8_t default_apparams[] = {
+			0x07, 0x01, 0x00
+		};
+		buffer = default_apparams;
+		rsize = sizeof(default_apparams);
+	}
+
 	params = parse_aparam(buffer, rsize);
 	if (params == NULL)
 		return -EBADR;
-- 
2.32.0


      parent reply	other threads:[~2021-07-23 13:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23 13:58 [PATCH BlueZ 0/4] obexd: phonebook-ebook: modernize Dylan Van Assche
2021-07-23 13:58 ` [PATCH BlueZ 1/4] " Dylan Van Assche
2021-07-23 14:32   ` bluez.test.bot
2021-07-23 21:50     ` Luiz Augusto von Dentz
2021-07-23 13:58 ` [PATCH BlueZ 2/4] configure.ac: specify phonebook plugin at build time Dylan Van Assche
2021-07-23 13:58 ` [PATCH BlueZ 3/4] configure.ac: add libebook dependency Dylan Van Assche
2021-07-23 13:58 ` Dylan Van Assche [this message]

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=20210723135824.8032-5-me@dylanvanassche.be \
    --to=me@dylanvanassche.be \
    --cc=hmallat@gmail.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).