Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: host: handle error case on sync cmd #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

karthi012
Copy link

return error when no response is received from
controller when CONFIG_BT_ASSERT is disabled.

@@ -529,6 +529,15 @@ static int h4_open(void)
return 0;
}

static int h4_close(void)
{
LOG_DBG("");
Copy link
Member

Choose a reason for hiding this comment

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

remove it

@@ -750,6 +750,19 @@ static void h5_init(void)
k_work_init_delayable(&retx_work, retx_timeout);
}

static void h5_deinit(void)
{
LOG_DBG("");
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@@ -768,10 +781,20 @@ static int h5_open(void)
return 0;
}

static int h5_close(void)
{
LOG_DBG("");
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@@ -768,10 +781,20 @@ static int h5_open(void)
return 0;
}

static int h5_close(void)
Copy link
Member

Choose a reason for hiding this comment

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

I think it's void type

@@ -4065,17 +4078,31 @@ int bt_enable(bt_ready_cb_t cb)
err = bt_dev.drv->open();
if (err) {
LOG_ERR("HCI driver open failed (%d)", err);
return err;
goto error;
}

bt_monitor_send(BT_MONITOR_OPEN_INDEX, NULL, 0);

if (!cb) {
Copy link
Member

Choose a reason for hiding this comment

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

change to if but else

{
h5_deinit();

uart_irq_rx_disable(h5_dev);
Copy link
Member

Choose a reason for hiding this comment

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

disable the interrupt first to be sure that we can cancel the works and kill the rx thread.

} else {
err = bt_init();
if (err) {
bt_dev.drv->close();

Choose a reason for hiding this comment

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

check close is non-NULL

added hci driver close support for h4 and h5

Signed-off-by: Karthikeyan Krishnasamy <karthikeyan@linumiz.com>
bt_hci_cmd_send_sync will return 0 on error if
CONFIG_BT_ASSERT is disabled, which make bt_enable
success even if there is no response from controller

Signed-off-by: Karthikeyan Krishnasamy <karthikeyan@linumiz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants