From 6e81d7ec5ae820047783ccdb3a79351dd8b581e2 Mon Sep 17 00:00:00 2001 From: nmuthu523 Date: Mon, 23 Mar 2026 09:51:02 +0000 Subject: [PATCH 01/12] RDKEMW-15846 : Elite classic controller is not disconnect on standby Reason for change : Sets the operation to modify the device's blocked property, enabling dynamic block/unblock control via this function. Priority: P1 Test Procedure: Follow the steps provided in description Risks: High Signed-off-by:Natraj Muthusamy --- src/btrCore.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/btrCore.c b/src/btrCore.c index d1d5967..2abb389 100644 --- a/src/btrCore.c +++ b/src/btrCore.c @@ -5135,6 +5135,45 @@ BTRCore_ConnectDevice ( return enBTRCoreSuccess; } +enBTRCoreRet btrCore_UpdateDeviceBlockState ( + stBTRCoreHdl* pstlhBTRCore, + tBTRCoreDevId aBTRCoreDevId, + enBTRCoreDeviceType aenBTRCoreDevType, + int isBlocked +) { + + if (!pstlhBTRCore || !pstlhBTRCore->connHdl) { + BTRCORELOG_ERROR("Invalid BT Core Handle\n"); + return enBTRCoreInvalidArg; + } + + const char *pDeviceAddress = NULL; + int i; + enBTDeviceType enBTDevice = enBTDevUnknown; + + for (i = 0; i < pstlhBTRCore->numOfPairedDevices; ++i) { + if (pstlhBTRCore->stKnownDevicesArr[i].tDeviceId == aBTRCoreDevId) { + pDeviceAddress = pstlhBTRCore->stKnownDevicesArr[i].pcDeviceAddress; + break; + } + } + + if (!pDeviceAddress) { + BTRCORELOG_ERROR("Device ID %lld not found\n", aBTRCoreDevId); + return enBTRCoreDeviceNotFound; + } + + unBTOpIfceProp lunBtOpDevProp; + lunBtOpDevProp.enBtDeviceProp = enBTDevPropBlocked; + int BlockDevice = block ? 1 : 0; + + if (BtrCore_BTSetProp(pstlhBTRCore->connHdl, pDeviceAddress, enBTDevice, lunBtOpDevProp, &BlockDevice)) { + BTRCORELOG_ERROR("Set Device Property enBTDevPropBlocked - FAILED\n"); + return enBTRCoreFailure; + } + + return enBTRCoreSuccess; +} enBTRCoreRet BTRCore_DisconnectDevice ( From 2d949101c3c5415136897f8b61a0d7cb27bbaf6e Mon Sep 17 00:00:00 2001 From: natrajmuthusamy <52849136+natrajmuthusamy@users.noreply.github.com> Date: Mon, 23 Mar 2026 15:28:04 +0530 Subject: [PATCH 02/12] Update btrCore.c --- src/btrCore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/btrCore.c b/src/btrCore.c index 2abb389..c4e06c2 100644 --- a/src/btrCore.c +++ b/src/btrCore.c @@ -5154,6 +5154,7 @@ enBTRCoreRet btrCore_UpdateDeviceBlockState ( for (i = 0; i < pstlhBTRCore->numOfPairedDevices; ++i) { if (pstlhBTRCore->stKnownDevicesArr[i].tDeviceId == aBTRCoreDevId) { pDeviceAddress = pstlhBTRCore->stKnownDevicesArr[i].pcDeviceAddress; + enBTDevice = pstlhBTRCore->stKnownDevicesArr[i].enDeviceType; break; } } From 2e03b6189f19bc5b67f052a060a4d69af2a19835 Mon Sep 17 00:00:00 2001 From: natrajmuthusamy <52849136+natrajmuthusamy@users.noreply.github.com> Date: Mon, 23 Mar 2026 15:57:37 +0530 Subject: [PATCH 03/12] Update btrCore.h --- include/btrCore.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/btrCore.h b/include/btrCore.h index 3b5e64a..9fe85aa 100644 --- a/include/btrCore.h +++ b/include/btrCore.h @@ -1348,6 +1348,25 @@ enBTRCoreRet BTRCore_GetBluetoothVersion(char *version); */ BOOLEAN BTRCore_IsUnsupportedGamepad(unsigned int ui32Vendor, unsigned int ui32Product, unsigned int ui32DeviceId); +/** + * @brief Updates the block state (blocked/unblocked) of a Bluetooth device. + * + * This API sets the device block state for the specified Bluetooth device using its device ID and type. + * It may be used to block or unblock a device from interacting with the Bluetooth core. + * + * @param[in] pstlhBTRCore Pointer to the Bluetooth Core handle. + * @param[in] aBTRCoreDevId Device ID of the target Bluetooth device. + * @param[in] aenBTRCoreDevType Device type of the target Bluetooth device. + * @param[in] isBlocked Desired block state: 1 to block the device, 0 to unblock it. + * + * @return Returns the status of the operation. + * @retval enBTRCoreSuccess Operation successful. + * @retval enBTRCoreFailure Operation failed; see logs for details. + * @retval enBTRCoreInvalidArg Invalid argument provided. + * @retval enBTRCoreDeviceNotFound Device with given ID not found. + */ +enBTRCoreRet btrCore_UpdateDeviceBlockState (stBTRCoreHdl* pstlhBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType, int isBlocked); + // Outgoing callbacks Registration Interfaces /* BTRCore_RegisterDiscoveryCb - Callback to notify the application every time when a new device is found and added to discovery list */ enBTRCoreRet BTRCore_RegisterDiscoveryCb (tBTRCoreHandle hBTRCore, fPtr_BTRCore_DeviceDiscCb afpcBBTRCoreDeviceDiscovery, void* apUserData); From b267872f07a6fee7202a4a4ac96ffbd77f65b81e Mon Sep 17 00:00:00 2001 From: natrajmuthusamy <52849136+natrajmuthusamy@users.noreply.github.com> Date: Mon, 23 Mar 2026 16:15:21 +0530 Subject: [PATCH 04/12] Update btrCore.c --- src/btrCore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/btrCore.c b/src/btrCore.c index c4e06c2..2997146 100644 --- a/src/btrCore.c +++ b/src/btrCore.c @@ -5136,7 +5136,7 @@ BTRCore_ConnectDevice ( } enBTRCoreRet btrCore_UpdateDeviceBlockState ( - stBTRCoreHdl* pstlhBTRCore, + tBTRCoreHandle* pstlhBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType, int isBlocked From 0e9e89a8ba4950565ecf22d47f28a9f221519b6a Mon Sep 17 00:00:00 2001 From: natrajmuthusamy <52849136+natrajmuthusamy@users.noreply.github.com> Date: Mon, 23 Mar 2026 16:16:00 +0530 Subject: [PATCH 05/12] Update btrCore.h --- include/btrCore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/btrCore.h b/include/btrCore.h index 9fe85aa..912d4c8 100644 --- a/include/btrCore.h +++ b/include/btrCore.h @@ -1365,7 +1365,7 @@ BOOLEAN BTRCore_IsUnsupportedGamepad(unsigned int ui32Vendor, unsigned int ui32P * @retval enBTRCoreInvalidArg Invalid argument provided. * @retval enBTRCoreDeviceNotFound Device with given ID not found. */ -enBTRCoreRet btrCore_UpdateDeviceBlockState (stBTRCoreHdl* pstlhBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType, int isBlocked); +enBTRCoreRet btrCore_UpdateDeviceBlockState (tBTRCoreHandle* pstlhBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType, int isBlocked); // Outgoing callbacks Registration Interfaces /* BTRCore_RegisterDiscoveryCb - Callback to notify the application every time when a new device is found and added to discovery list */ From 36a497d205d2fa119cb1b0c3f9dcfc295181708b Mon Sep 17 00:00:00 2001 From: natrajmuthusamy <52849136+natrajmuthusamy@users.noreply.github.com> Date: Mon, 23 Mar 2026 16:18:30 +0530 Subject: [PATCH 06/12] Update btrCore.c --- src/btrCore.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/btrCore.c b/src/btrCore.c index 2997146..e857635 100644 --- a/src/btrCore.c +++ b/src/btrCore.c @@ -5136,17 +5136,19 @@ BTRCore_ConnectDevice ( } enBTRCoreRet btrCore_UpdateDeviceBlockState ( - tBTRCoreHandle* pstlhBTRCore, + tBTRCoreHandle* hBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType, int isBlocked ) { - if (!pstlhBTRCore || !pstlhBTRCore->connHdl) { + if (!hBTRCore) { BTRCORELOG_ERROR("Invalid BT Core Handle\n"); return enBTRCoreInvalidArg; } - + + pstlhBTRCore = (stBTRCoreHdl*)hBTRCore; + const char *pDeviceAddress = NULL; int i; enBTDeviceType enBTDevice = enBTDevUnknown; From abc5d8050bf6ea73e2cb0c28e1297d9aa129f8e8 Mon Sep 17 00:00:00 2001 From: natrajmuthusamy <52849136+natrajmuthusamy@users.noreply.github.com> Date: Mon, 23 Mar 2026 16:19:05 +0530 Subject: [PATCH 07/12] Update btrCore.h --- include/btrCore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/btrCore.h b/include/btrCore.h index 912d4c8..b6fd2af 100644 --- a/include/btrCore.h +++ b/include/btrCore.h @@ -1365,7 +1365,7 @@ BOOLEAN BTRCore_IsUnsupportedGamepad(unsigned int ui32Vendor, unsigned int ui32P * @retval enBTRCoreInvalidArg Invalid argument provided. * @retval enBTRCoreDeviceNotFound Device with given ID not found. */ -enBTRCoreRet btrCore_UpdateDeviceBlockState (tBTRCoreHandle* pstlhBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType, int isBlocked); +enBTRCoreRet btrCore_UpdateDeviceBlockState (tBTRCoreHandle* hBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType, int isBlocked); // Outgoing callbacks Registration Interfaces /* BTRCore_RegisterDiscoveryCb - Callback to notify the application every time when a new device is found and added to discovery list */ From 7c25b41b84fb009141901539aad16c110693dae4 Mon Sep 17 00:00:00 2001 From: natrajmuthusamy <52849136+natrajmuthusamy@users.noreply.github.com> Date: Mon, 23 Mar 2026 16:23:36 +0530 Subject: [PATCH 08/12] Update btrCore.c --- src/btrCore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/btrCore.c b/src/btrCore.c index e857635..06b44a4 100644 --- a/src/btrCore.c +++ b/src/btrCore.c @@ -5142,6 +5142,7 @@ enBTRCoreRet btrCore_UpdateDeviceBlockState ( int isBlocked ) { + stBTRCoreHdl* pstlhBTRCore = NULL; if (!hBTRCore) { BTRCORELOG_ERROR("Invalid BT Core Handle\n"); return enBTRCoreInvalidArg; @@ -5168,7 +5169,7 @@ enBTRCoreRet btrCore_UpdateDeviceBlockState ( unBTOpIfceProp lunBtOpDevProp; lunBtOpDevProp.enBtDeviceProp = enBTDevPropBlocked; - int BlockDevice = block ? 1 : 0; + int BlockDevice = isBlocked ? 1 : 0; if (BtrCore_BTSetProp(pstlhBTRCore->connHdl, pDeviceAddress, enBTDevice, lunBtOpDevProp, &BlockDevice)) { BTRCORELOG_ERROR("Set Device Property enBTDevPropBlocked - FAILED\n"); From 9d47b90f864ead7029d425ccbef25629a256cb8f Mon Sep 17 00:00:00 2001 From: natrajmuthusamy <52849136+natrajmuthusamy@users.noreply.github.com> Date: Mon, 23 Mar 2026 21:10:12 +0530 Subject: [PATCH 09/12] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/btrCore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/btrCore.c b/src/btrCore.c index 06b44a4..581f594 100644 --- a/src/btrCore.c +++ b/src/btrCore.c @@ -5163,7 +5163,7 @@ enBTRCoreRet btrCore_UpdateDeviceBlockState ( } if (!pDeviceAddress) { - BTRCORELOG_ERROR("Device ID %lld not found\n", aBTRCoreDevId); + BTRCORELOG_ERROR("Device ID %llu not found\n", aBTRCoreDevId); return enBTRCoreDeviceNotFound; } From b7f6b66e41d4dfa4a5f65f39806151cc05b2a2e1 Mon Sep 17 00:00:00 2001 From: natrajmuthusamy <52849136+natrajmuthusamy@users.noreply.github.com> Date: Mon, 23 Mar 2026 21:11:11 +0530 Subject: [PATCH 10/12] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/btrCore.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/btrCore.c b/src/btrCore.c index 581f594..bd604f0 100644 --- a/src/btrCore.c +++ b/src/btrCore.c @@ -5150,20 +5150,20 @@ enBTRCoreRet btrCore_UpdateDeviceBlockState ( pstlhBTRCore = (stBTRCoreHdl*)hBTRCore; - const char *pDeviceAddress = NULL; + const char *pDevicePath = NULL; int i; enBTDeviceType enBTDevice = enBTDevUnknown; for (i = 0; i < pstlhBTRCore->numOfPairedDevices; ++i) { if (pstlhBTRCore->stKnownDevicesArr[i].tDeviceId == aBTRCoreDevId) { - pDeviceAddress = pstlhBTRCore->stKnownDevicesArr[i].pcDeviceAddress; + pDevicePath = pstlhBTRCore->stKnownDevicesArr[i].pcDevicePath; enBTDevice = pstlhBTRCore->stKnownDevicesArr[i].enDeviceType; break; } } - if (!pDeviceAddress) { - BTRCORELOG_ERROR("Device ID %llu not found\n", aBTRCoreDevId); + if (!pDevicePath) { + BTRCORELOG_ERROR("Device ID %lld not found\n", aBTRCoreDevId); return enBTRCoreDeviceNotFound; } @@ -5171,7 +5171,7 @@ enBTRCoreRet btrCore_UpdateDeviceBlockState ( lunBtOpDevProp.enBtDeviceProp = enBTDevPropBlocked; int BlockDevice = isBlocked ? 1 : 0; - if (BtrCore_BTSetProp(pstlhBTRCore->connHdl, pDeviceAddress, enBTDevice, lunBtOpDevProp, &BlockDevice)) { + if (BtrCore_BTSetProp(pstlhBTRCore->connHdl, pDevicePath, enBTDevice, lunBtOpDevProp, &BlockDevice)) { BTRCORELOG_ERROR("Set Device Property enBTDevPropBlocked - FAILED\n"); return enBTRCoreFailure; } From d55b49d8cc92838e8f3f0256465b77b68b8e5fc5 Mon Sep 17 00:00:00 2001 From: natrajmuthusamy <52849136+natrajmuthusamy@users.noreply.github.com> Date: Mon, 23 Mar 2026 21:17:52 +0530 Subject: [PATCH 11/12] Update btrCore.c --- src/btrCore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/btrCore.c b/src/btrCore.c index bd604f0..38e3fcc 100644 --- a/src/btrCore.c +++ b/src/btrCore.c @@ -5136,7 +5136,7 @@ BTRCore_ConnectDevice ( } enBTRCoreRet btrCore_UpdateDeviceBlockState ( - tBTRCoreHandle* hBTRCore, + tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType, int isBlocked From 90131d0384f36d01abd8e875aa633ccfc97168ab Mon Sep 17 00:00:00 2001 From: natrajmuthusamy <52849136+natrajmuthusamy@users.noreply.github.com> Date: Mon, 23 Mar 2026 21:18:42 +0530 Subject: [PATCH 12/12] Update btrCore.h --- include/btrCore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/btrCore.h b/include/btrCore.h index b6fd2af..82b729b 100644 --- a/include/btrCore.h +++ b/include/btrCore.h @@ -1365,7 +1365,7 @@ BOOLEAN BTRCore_IsUnsupportedGamepad(unsigned int ui32Vendor, unsigned int ui32P * @retval enBTRCoreInvalidArg Invalid argument provided. * @retval enBTRCoreDeviceNotFound Device with given ID not found. */ -enBTRCoreRet btrCore_UpdateDeviceBlockState (tBTRCoreHandle* hBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType, int isBlocked); +enBTRCoreRet btrCore_UpdateDeviceBlockState (tBTRCoreHandle hBTRCore, tBTRCoreDevId aBTRCoreDevId, enBTRCoreDeviceType aenBTRCoreDevType, int isBlocked); // Outgoing callbacks Registration Interfaces /* BTRCore_RegisterDiscoveryCb - Callback to notify the application every time when a new device is found and added to discovery list */