As g_obex_apparam_set_uint16() converts data to big-endian format internally, do not call htons() prior to it. --- obexd/plugins/pbap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c index 4740188..acac3aa 100644 --- a/obexd/plugins/pbap.c +++ b/obexd/plugins/pbap.c @@ -188,7 +188,7 @@ static void phonebook_size_result(const char *buffer, size_t bufsize, DBG("vcards %d", vcards); - phonebooksize = htons(vcards); + phonebooksize = vcards; pbap->obj->apparam = g_obex_apparam_set_uint16(NULL, PHONEBOOKSIZE_TAG, phonebooksize); @@ -365,7 +365,7 @@ static int generate_response(void *user_data) if (max == 0) { /* Ignore all other parameter and return PhoneBookSize */ - uint16_t size = htons(g_slist_length(pbap->cache.entries)); + uint16_t size = g_slist_length(pbap->cache.entries); pbap->obj->apparam = g_obex_apparam_set_uint16( pbap->obj->apparam, -- 1.8.5.3 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html