From f229b932702acbbc24a9c1a4b8e5966a59cc1b78 Mon Sep 17 00:00:00 2001 From: Ruchit Marathe Date: Wed, 10 Aug 2022 11:32:28 +0530 Subject: [PATCH] sm7125: Bluetooth: Detect device and set device name in bt settings --- bluetooth/include/bdroid_buildcfg.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/bluetooth/include/bdroid_buildcfg.h b/bluetooth/include/bdroid_buildcfg.h index 30d64ea..0e588dc 100644 --- a/bluetooth/include/bdroid_buildcfg.h +++ b/bluetooth/include/bdroid_buildcfg.h @@ -23,7 +23,31 @@ #ifndef _BDROID_BUILDCFG_H #define _BDROID_BUILDCFG_H -#define BTM_DEF_LOCAL_NAME "Galaxy A52/A72 4G" +#pragma push_macro("PROPERTY_VALUE_MAX") + +#if !defined(OS_GENERIC) +#include +#include + +static inline const char* getBTDefaultName() +{ + char device[PROPERTY_VALUE_MAX]; + property_get("ro.product.device", device, ""); + + if (!strcmp("a52q", device)) { + return "Galaxy A52 4G"; + } + + if (!strcmp("a72q", device)) { + return "Galaxy A72 4G"; + } + + return "Samsung Galaxy"; +} + +#define BTM_DEF_LOCAL_NAME getBTDefaultName() +#endif /* OS_GENERIC */ + #define BLE_VND_INCLUDED TRUE #define MAX_ACL_CONNECTIONS 16 @@ -32,4 +56,6 @@ #define AVDT_NUM_SEPS 35 +#pragma pop_macro("PROPERTY_VALUE_MAX") + #endif