Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions src/ifce/btrMgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4093,7 +4093,6 @@ BTRMGR_DeInit (
BTRMGR_DiscoveryHandle_t* ldiscoveryHdl = NULL;
unsigned short ui16LoopIdx = 0;
BTRMGR_ConnectedDevicesList_t lstConnectedDevices;
unsigned int ui32sleepTimeOut = 1;
gboolean isRemoteDev = FALSE;

isDeinitInProgress = TRUE;
Expand All @@ -4115,7 +4114,6 @@ BTRMGR_DeInit (
BTRMGRLOG_DEBUG ("Connected Devices = %d\n", lstConnectedDevices.m_numOfDevices);

for (ui16LoopIdx = 0; ui16LoopIdx < lstConnectedDevices.m_numOfDevices; ui16LoopIdx++) {
unsigned int ui32confirmIdx = 2;
enBTRCoreDeviceType lenBtrCoreDevTy = enBTRCoreUnknown;
enBTRCoreDeviceClass lenBtrCoreDevCl = enBTRCore_DC_Unknown;

Expand All @@ -4126,14 +4124,6 @@ BTRMGR_DeInit (
if (BTRCore_DisconnectDevice(ghBTRCoreHdl, lstConnectedDevices.m_deviceProperty[ui16LoopIdx].m_deviceHandle, lenBtrCoreDevTy) != enBTRCoreSuccess) {
BTRMGRLOG_ERROR ("Failed to Disconnect - %llu\n", lstConnectedDevices.m_deviceProperty[ui16LoopIdx].m_deviceHandle);
}
do {
unsigned int ui32sleepIdx = 2;

do {
sleep(ui32sleepTimeOut);
lenBtrCoreRet = BTRCore_GetDeviceDisconnected(ghBTRCoreHdl, lstConnectedDevices.m_deviceProperty[ui16LoopIdx].m_deviceHandle, lenBtrCoreDevTy);
} while ((lenBtrCoreRet != enBTRCoreSuccess) && (--ui32sleepIdx));
} while (--ui32confirmIdx);
}
}
}
Expand Down Expand Up @@ -4695,7 +4685,7 @@ BTRMGR_StartDeviceDiscovery_Internal (

do {
usleep(5000);
} while ((!gIsAdapterDiscovering) && (--ui32sleepIdx));
} while ((!gIsAdapterDiscovering) && (--ui32sleepIdx) && !isDeinitInProgress);
}

if (!gIsAdapterDiscovering) {
Expand Down Expand Up @@ -4776,7 +4766,7 @@ BTRMGR_StopDeviceDiscovery_Internal (
{ /* Max 3 sec timeout - Polled at 50ms second interval */
unsigned int ui32sleepIdx = 60;

while ((gIsAdapterDiscovering) && (ui32sleepIdx--)) {
while ((gIsAdapterDiscovering) && (ui32sleepIdx--) && !isDeinitInProgress) {
usleep(50000);
}
}
Expand Down
Loading