obexd: phonebook: Set default apparams for PTS clients
authorHannu Mallat <hmallat@gmail.com>
Fri, 23 Jul 2021 13:58:24 +0000 (15:58 +0200)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:36 +0000 (19:08 +0530)
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.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
obexd/plugins/pbap.c

index 3965a69..04ffcfa 100755 (executable)
@@ -605,6 +605,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;