* [PATCH v1 1/2] obexd/pbap: Fix NewMissedCalls parameter size
2026-10-26 13:15 [PATCH v1 0/2] obexd/pbap: Report NewMissedCalls for mch Jinwang Li
@ 2026-10-26 13:15 ` Jinwang Li
2026-10-26 14:54 ` obexd/pbap: Report NewMissedCalls for mch bluez.test.bot
2026-10-26 13:15 ` [PATCH v1 2/2] " Jinwang Li
2026-10-28 13:30 ` [PATCH v1 0/2] " patchwork-bot+bluetooth
2 siblings, 1 reply; 5+ messages in thread
From: Jinwang Li @ 2026-10-26 13:15 UTC (permalink / raw)
To: linux-bluetooth
Cc: cheng.jiang, quic_chezhou, wei.deng, shuai.zhang, mengshi.wu,
jinwang.li, xiuzhuo.shang
NewMissedCalls is a one-byte apparam, but was encoded with
g_obex_apparam_set_uint16(). Use uint8 instead, and update the
phonebook callback type to match.
Fixes: 398d3e23533a ("obexd: Make use of GObexApparam API")
Signed-off-by: Jinwang Li <jinwang.li@oss.qualcomm.com>
---
obexd/plugins/irmc.c | 4 ++--
obexd/plugins/pbap.c | 8 ++++----
obexd/plugins/phonebook-tracker.c | 2 +-
obexd/plugins/phonebook.h | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/obexd/plugins/irmc.c b/obexd/plugins/irmc.c
index cfd8a45d4..e343fa1fa 100644
--- a/obexd/plugins/irmc.c
+++ b/obexd/plugins/irmc.c
@@ -74,7 +74,7 @@ static const char *owner_vcard =
"END:VCARD\r\n";
static void phonebook_size_result(const char *buffer, size_t bufsize,
- int vcards, int missed,
+ int vcards, uint8_t missed,
gboolean lastpart, void *user_data)
{
struct irmc_session *irmc = user_data;
@@ -90,7 +90,7 @@ static void phonebook_size_result(const char *buffer, size_t bufsize,
}
static void query_result(const char *buffer, size_t bufsize, int vcards,
- int missed, gboolean lastpart, void *user_data)
+ uint8_t missed, gboolean lastpart, void *user_data)
{
struct irmc_session *irmc = user_data;
const char *s, *t;
diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index 9f8684863..29b308cb7 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
@@ -159,7 +159,7 @@ static void cache_clear(struct cache *cache)
}
static void phonebook_size_result(const char *buffer, size_t bufsize,
- int vcards, int missed,
+ int vcards, uint8_t missed,
gboolean lastpart, void *user_data)
{
struct pbap_session *pbap = user_data;
@@ -186,7 +186,7 @@ static void phonebook_size_result(const char *buffer, size_t bufsize,
DBG("missed %d", missed);
}
- pbap->obj->apparam = g_obex_apparam_set_uint16(pbap->obj->apparam,
+ pbap->obj->apparam = g_obex_apparam_set_uint8(pbap->obj->apparam,
NEWMISSEDCALLS_TAG,
missed);
@@ -194,7 +194,7 @@ static void phonebook_size_result(const char *buffer, size_t bufsize,
}
static void query_result(const char *buffer, size_t bufsize, int vcards,
- int missed, gboolean lastpart, void *user_data)
+ uint8_t missed, gboolean lastpart, void *user_data)
{
struct pbap_session *pbap = user_data;
@@ -224,7 +224,7 @@ static void query_result(const char *buffer, size_t bufsize, int vcards,
pbap->obj->firstpacket = TRUE;
}
- pbap->obj->apparam = g_obex_apparam_set_uint16(pbap->obj->apparam,
+ pbap->obj->apparam = g_obex_apparam_set_uint8(pbap->obj->apparam,
NEWMISSEDCALLS_TAG,
missed);
diff --git a/obexd/plugins/phonebook-tracker.c b/obexd/plugins/phonebook-tracker.c
index 36e73db77..ba0940c40 100644
--- a/obexd/plugins/phonebook-tracker.c
+++ b/obexd/plugins/phonebook-tracker.c
@@ -488,7 +488,7 @@ struct phonebook_data {
GSList *contacts;
phonebook_cache_ready_cb ready_cb;
phonebook_entry_cb entry_cb;
- int newmissedcalls;
+ uint8_t newmissedcalls;
GCancellable *query_canc;
char *req_name;
int vcard_part_count;
diff --git a/obexd/plugins/phonebook.h b/obexd/plugins/phonebook.h
index b878b143d..7e99de6e7 100644
--- a/obexd/plugins/phonebook.h
+++ b/obexd/plugins/phonebook.h
@@ -61,7 +61,7 @@ struct apparam_field {
* Contacts will be returned in the vcard format.
*/
typedef void (*phonebook_cb) (const char *buffer, size_t bufsize,
- int vcards, int missed, gboolean lastpart, void *user_data);
+ int vcards, uint8_t missed, gboolean lastpart, void *user_data);
/*
* Interface between the PBAP core and backends to
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v1 2/2] obexd/pbap: Report NewMissedCalls for mch
2026-10-26 13:15 [PATCH v1 0/2] obexd/pbap: Report NewMissedCalls for mch Jinwang Li
2026-10-26 13:15 ` [PATCH v1 1/2] obexd/pbap: Fix NewMissedCalls parameter size Jinwang Li
@ 2026-10-26 13:15 ` Jinwang Li
2026-10-28 13:30 ` [PATCH v1 0/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 5+ messages in thread
From: Jinwang Li @ 2026-10-26 13:15 UTC (permalink / raw)
To: linux-bluetooth
Cc: cheng.jiang, quic_chezhou, wei.deng, shuai.zhang, mengshi.wu,
jinwang.li, xiuzhuo.shang
The dummy backend always reports zero NewMissedCalls. Count the
vCards in the folder instead, capped at UINT8_MAX.
Fixes PTS test PBAP/PSE/PBD/BV-05-C
Signed-off-by: Jinwang Li <jinwang.li@oss.qualcomm.com>
---
obexd/plugins/phonebook-dummy.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/obexd/plugins/phonebook-dummy.c b/obexd/plugins/phonebook-dummy.c
index 782b8948d..0a0ae24ff 100644
--- a/obexd/plugins/phonebook-dummy.c
+++ b/obexd/plugins/phonebook-dummy.c
@@ -41,6 +41,7 @@ struct dummy_data {
char *folder;
int fd;
guint id;
+ uint8_t newmissedcalls;
};
struct cache_query {
@@ -244,7 +245,8 @@ static gboolean read_dir(void *user_data)
closedir(dp);
done:
/* FIXME: Missing vCards fields filtering */
- dummy->cb(buffer->str, buffer->len, count, 0, TRUE, dummy->user_data);
+ dummy->cb(buffer->str, buffer->len, count, dummy->newmissedcalls,
+ TRUE, dummy->user_data);
g_string_free(buffer, TRUE);
@@ -360,6 +362,22 @@ static gboolean is_dir(const char *dir)
return S_ISDIR(st.st_mode);
}
+static uint8_t count_vcards(const char *folder)
+{
+ DIR *dp;
+ uint16_t count = 0;
+
+ dp = opendir(folder);
+ if (dp == NULL)
+ return 0;
+
+ foreach_vcard(dp, NULL, 0, UINT8_MAX, NULL, &count);
+
+ closedir(dp);
+
+ return count;
+}
+
char *phonebook_set_folder(const char *current_folder,
const char *new_folder, uint8_t flags, int *err)
{
@@ -490,6 +508,9 @@ void *phonebook_pull(const char *name, const struct apparam_field *params,
dummy->folder = folder;
dummy->fd = -1;
+ if (g_strcmp0(name, PB_CALLS_MISSED) == 0)
+ dummy->newmissedcalls = count_vcards(folder);
+
if (err)
*err = 0;
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread