From: Sohyeon Choi Date: Fri, 13 Dec 2024 06:19:53 +0000 (+0900) Subject: shared/gatt-client: Do not read device name gatt char in DA X-Git-Tag: accepted/tizen/7.0/unified/20241219.160525^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=da99d5542c8d5118abf66f62d1ee342a2bf9313f;p=platform%2Fupstream%2Fbluez.git shared/gatt-client: Do not read device name gatt char in DA if remote adv is non-discoverable and not bonded, request for reading GATT characterisitic device name (2A00) makes confirm popup for security. to prevent unnecessary popup, Do not read device name in DA products. Change-Id: Id3067e8e1ec83ec0c5c985022b9164822fd6780c Signed-off-by: Wootak Jung --- diff --git a/Makefile.tools b/Makefile.tools index 2cceb693..495ac23d 100755 --- a/Makefile.tools +++ b/Makefile.tools @@ -103,7 +103,7 @@ peripheral_btsensor_SOURCES = peripheral/main.c \ peripheral/log.h peripheral/log.c \ peripheral/gap.h peripheral/gap.c \ peripheral/gatt.h peripheral/gatt.c -peripheral_btsensor_LDADD = src/libshared-mainloop.la \ +peripheral_btsensor_LDADD = src/libshared-mainloop.la @LIBXML_LIBS@ \ lib/libbluetooth-internal.la tools_3dsp_SOURCES = tools/3dsp.c monitor/bt.h @@ -348,7 +348,7 @@ noinst_PROGRAMS += tools/bdaddr tools/avinfo \ tools/test-runner tools/check-selftest tools_bdaddr_SOURCES = tools/bdaddr.c src/oui.h src/oui.c -tools_bdaddr_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@ +tools_bdaddr_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@ @LIBXML_LIBS@ tools_avinfo_LDADD = lib/libbluetooth-internal.la @@ -410,7 +410,7 @@ tools_ibeacon_SOURCES = tools/ibeacon.c monitor/bt.h tools_ibeacon_LDADD = src/libshared-mainloop.la tools_btgatt_client_SOURCES = tools/btgatt-client.c src/uuid-helper.c -tools_btgatt_client_LDADD = src/libshared-mainloop.la \ +tools_btgatt_client_LDADD = src/libshared-mainloop.la @LIBXML_LIBS@ \ lib/libbluetooth-internal.la tools_btgatt_server_SOURCES = tools/btgatt-server.c src/uuid-helper.c diff --git a/profiles/gap/gas.c b/profiles/gap/gas.c index 2125b723..5d80ecff 100755 --- a/profiles/gap/gas.c +++ b/profiles/gap/gas.c @@ -39,6 +39,10 @@ #include "src/service.h" #include "src/log.h" +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY +#include "../../profile.h" +#endif + #define GAP_UUID16 0x1800 /* Generic Attribute/Access Service */ @@ -109,6 +113,13 @@ static void read_device_name_cb(bool success, uint8_t att_ecode, static void handle_device_name(struct gas *gas, uint16_t value_handle) { +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + if (TIZEN_FEATURE_BLUEZ_DA) { + DBG("Do not try to read device name in DA"); + return; + } +#endif + if (!bt_gatt_client_read_long_value(gas->client, value_handle, 0, read_device_name_cb, gas, NULL)) DBG("Failed to send request to read device name"); diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c index 0416d05d..16ebc212 100644 --- a/src/shared/gatt-client.c +++ b/src/shared/gatt-client.c @@ -1086,10 +1086,15 @@ static void discover_chrcs_cb(bool success, uint8_t att_ecode, #ifdef TIZEN_FEATURE_BLUEZ_MODIFY if (!strcmp(uuid_str, "00002a00-0000-1000-8000-00805f9b34fb")) { - if (!bt_gatt_client_read_value(client, chrc_data->value_handle, - read_name_cb, client, NULL)) { + if (TIZEN_FEATURE_BLUEZ_DA) { util_debug(client->debug_callback, client->debug_data, - "Failed to read value"); + "device name char found but do not read in DA"); + } else { + if (!bt_gatt_client_read_value(client, chrc_data->value_handle, + read_name_cb, client, NULL)) { + util_debug(client->debug_callback, client->debug_data, + "Failed to read value"); + } } } #endif