XIONE-18349 : Luna controller takes around 1 min to reconnect.#76
XIONE-18349 : Luna controller takes around 1 min to reconnect.#76DamianoBaroneSky merged 21 commits intodevelopfrom
Conversation
Reason for change: Run the callback to receive the response from UI in a seperate thread. Priority: P1 Test Procedure: Follow the steps provided in description Risks: High Signed-off-by:Natraj Muthusamy <Natraj_Muthusamy@comcast.com>
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce reconnection latency for Luna (LE HID) auto-connect by moving the UI confirmation wait (btrMgr_IncomingConnectionAuthentication) off the device status callback path into a separate thread.
Changes:
- Added a new GThread entrypoint (
btrMgr_IncomingAuthCb) to run incoming connection authentication asynchronously. - Added a helper (
btrMgr_StartIncomingAuthThread) to spawn/unref the authentication thread. - Updated the AUTO_CONNECT_ENABLED flow in
btrMgr_DeviceStatusCbto start the auth thread instead of synchronously waiting for the UI response.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Reason for change: Run the callback to receive the response from UI in a separate thread. Priority: P1 Test Procedure: Follow the steps provided in description Risks: High Signed-off-by:Natraj Muthusamy <Natraj_Muthusamy@comcast.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Update from develop
Reason for change: Run the callback to receive the response from UI in a separate thread. Priority: P1 Test Procedure: Follow the steps provided in description Risks: High Signed-off-by:Natraj Muthusamy Natraj_Muthusamy@comcast.com
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 12 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Reason for change: Run the callback to receive the response from UI in a separate thread. Priority: P1 Test Procedure: Follow the steps provided in description Risks: High Signed-off-by:Natraj Muthusamy Natraj_Muthusamy@comcast.com
Reason for change: Run the callback to receive the response from UI in a separate thread. Priority: P1 Test Procedure: Follow the steps provided in description Risks: High Signed-off-by:Natraj Muthusamy Natraj_Muthusamy@comcast.com
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 8 comments.
Comments suppressed due to low confidence (1)
src/ifce/btrMgr.c:9460
- The mutex here does not actually synchronize access to
gEventRespReceived/gAcceptConnectionwith the writer inBTRMGR_SetEventResponse(which does not lock this mutex). This leaves a data race between threads. A safer approach is to protect both read and write with the same mutex +GCond(wait releases the mutex), or switch these globals to atomics (e.g.,gintwithg_atomic_int_get/set).
unsigned int ui32sleepIdx = 40;
do {
usleep(500000);
} while ((gEventRespReceived == 0) && (--ui32sleepIdx));
if (gEventRespReceived == 0) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Reason for change: Run the callback to receive the response from UI in a separate thread. Priority: P1 Test Procedure: Follow the steps provided in description Risks: High Signed-off-by:Natraj Muthusamy Natraj_Muthusamy@comcast.com
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 10 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
src/ifce/btrMgr.c:9458
gBtrMgrAuthMutexis held while invokinggfpcBBTRMgrEventOutand then across the entire polling sleep loop. If you later fix the writer-side race by locking inBTRMGR_SetEventResponse, a synchronous/re-entrant UI implementation that callsBTRMGR_SetEventResponsefrom inside the event callback would deadlock. To avoid this, don’t hold the mutex while calling out togfpcBBTRMgrEventOut; instead, use a condition variable (or another non-blocking mechanism) to wait for the response and haveBTRMGR_SetEventResponsesignal it.
if (gfpcBBTRMgrEventOut) {
gfpcBBTRMgrEventOut(lstEventMessage);
}
BTRMGR_GetPairedDevices (lstEventMessage.m_adapterIndex, &gListOfPairedDevices);
BTRMGRLOG_INFO("Waiting for the external connection response from UI for LE HID device\n");
unsigned int ui32sleepIdx = 40;
do {
usleep(500000);
} while ((gEventRespReceived == 0) && (--ui32sleepIdx));
if (gEventRespReceived == 0) {
BTRMGRLOG_INFO("External connection response not received from UI for LE HID device, So disconnecting the device.\n");
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Reason for change:
Run the callback to receive the response from UI in a separate thread.
Priority: P1
Test Procedure: Follow the steps provided in description
Risks: High
Signed-off-by:Natraj Muthusamy Natraj_Muthusamy@comcast.com