Skip to content

XIONE-18349 : Luna controller takes around 1 min to reconnect.#76

Merged
DamianoBaroneSky merged 21 commits intodevelopfrom
XIONE-18349
Feb 27, 2026
Merged

XIONE-18349 : Luna controller takes around 1 min to reconnect.#76
DamianoBaroneSky merged 21 commits intodevelopfrom
XIONE-18349

Conversation

@natrajmuthusamy
Copy link
Contributor

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 seperate thread.

Priority: P1
Test Procedure: Follow the steps provided in description

Risks: High
Signed-off-by:Natraj Muthusamy <Natraj_Muthusamy@comcast.com>
@natrajmuthusamy natrajmuthusamy requested a review from a team as a code owner February 20, 2026 12:39
Copilot AI review requested due to automatic review settings February 20, 2026 12:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_DeviceStatusCb to 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>
Copilot AI review requested due to automatic review settings February 20, 2026 12:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copilot AI review requested due to automatic review settings February 20, 2026 13:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

natrajmuthusamy and others added 2 commits February 24, 2026 14:49
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
Copilot AI review requested due to automatic review settings February 24, 2026 10:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copilot AI review requested due to automatic review settings February 25, 2026 07:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/gAcceptConnection with the writer in BTRMGR_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., gint with g_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>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

natrajmuthusamy and others added 2 commits February 25, 2026 13:52
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 25, 2026 08:23
natrajmuthusamy and others added 2 commits February 25, 2026 13:53
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • gBtrMgrAuthMutex is held while invoking gfpcBBTRMgrEventOut and then across the entire polling sleep loop. If you later fix the writer-side race by locking in BTRMGR_SetEventResponse, a synchronous/re-entrant UI implementation that calls BTRMGR_SetEventResponse from inside the event callback would deadlock. To avoid this, don’t hold the mutex while calling out to gfpcBBTRMgrEventOut; instead, use a condition variable (or another non-blocking mechanism) to wait for the response and have BTRMGR_SetEventResponse signal 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.

Copilot AI review requested due to automatic review settings February 26, 2026 08:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI review requested due to automatic review settings February 27, 2026 06:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@DamianoBaroneSky DamianoBaroneSky merged commit 41c7f19 into develop Feb 27, 2026
14 of 15 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants