From: Luiz Augusto von Dentz Date: Mon, 4 Apr 2022 20:15:18 +0000 (-0700) Subject: gap: Don't attempt to read the appearance if already set X-Git-Tag: accepted/tizen/unified/20230608.164325~293 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff3eea970bb1155f7d987a3427b85f4abb1f8e56;p=platform%2Fupstream%2Fbluez.git gap: Don't attempt to read the appearance if already set Devices are unlikely to change appearance over time which is the reason why we cache then on the storage so this skips reading it on every reconnection. Signed-off-by: Manika Shrivastava Signed-off-by: Ayush Garg --- diff --git a/profiles/gap/gas.c b/profiles/gap/gas.c index 2125b72..9c4e4a4 100755 --- a/profiles/gap/gas.c +++ b/profiles/gap/gas.c @@ -141,6 +141,11 @@ static void read_appearance_cb(bool success, uint8_t att_ecode, static void handle_appearance(struct gas *gas, uint16_t value_handle) { + uint16_t value; + + if (!device_get_appearance(gas->device, &value)) + return; + if (!bt_gatt_client_read_value(gas->client, value_handle, read_appearance_cb, gas, NULL)) DBG("Failed to send request to read appearance");