From: Tyszkowski Jakub <jakub.tyszkowski@tieto.com>
To: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/8] android: Fix turning BT off during pairing
Date: Thu, 05 Dec 2013 14:02:11 +0100 [thread overview]
Message-ID: <52A07953.4030804@tieto.com> (raw)
In-Reply-To: <1386239837-4102-1-git-send-email-jakub.tyszkowski@tieto.com>
On 12/05/2013 11:37 AM, Jakub Tyszkowski wrote:
> Not turning BT off in time due to actions queued in mgmt makes Android
> unstable and locks Bluetooth UI controlls. This patch fixes this issue
> by cancelling queued actions.
>
> ---
> android/bluetooth.c | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index 6174b1f..e67864a 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -1982,6 +1982,9 @@ static void pair_device_complete(uint8_t status, uint16_t length,
>
> DBG("status %u", status);
>
> + /*Data used for bond cancelling can be freed now*/
> + g_free(user_data);
> +
> /* On success bond state change will be send when new link key event
> * is received */
> if (status == MGMT_STATUS_SUCCESS)
> @@ -1991,19 +1994,34 @@ static void pair_device_complete(uint8_t status, uint16_t length,
> HAL_BOND_STATE_NONE);
> }
>
> +static void pair_device_cancelled(void *data)
> +{
> + bdaddr_t *addr = data;
> +
> + set_device_bond_state(addr, HAL_STATUS_FAILED, HAL_BOND_STATE_NONE);
> +
> + g_free(data);
> +}
> +
> static void handle_create_bond_cmd(const void *buf, uint16_t len)
> {
> const struct hal_cmd_create_bond *cmd = buf;
> uint8_t status;
> struct mgmt_cp_pair_device cp;
> + bdaddr_t *addr;
>
> cp.io_cap = DEFAULT_IO_CAPABILITY;
> cp.addr.type = BDADDR_BREDR;
> android2bdaddr(cmd->bdaddr, &cp.addr.bdaddr);
>
> + addr = g_new(bdaddr_t, 1);
> + bacpy(addr, &cp.addr.bdaddr);
> +
> if (mgmt_send(mgmt_if, MGMT_OP_PAIR_DEVICE, adapter.index, sizeof(cp),
> - &cp, pair_device_complete, NULL, NULL) == 0) {
> + &cp, pair_device_complete,
> + addr, pair_device_cancelled) == 0) {
> status = HAL_STATUS_FAILED;
> + g_free(addr);
> goto fail;
> }
>
> @@ -2253,6 +2271,8 @@ static void handle_disable_cmd(const void *buf, uint16_t len)
> goto failed;
> }
>
> + mgmt_cancel_index(mgmt_if, adapter.index);
> +
> if (!set_mode(MGMT_OP_SET_POWERED, 0x00)) {
> status = HAL_STATUS_FAILED;
> goto failed;
>
Hi,
Please ignore this one patch as it makes user_data being freed twice.
BR,
Jakub Tyszkowski
next prev parent reply other threads:[~2013-12-05 13:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-05 10:37 [PATCH 1/8] android: Fix turning BT off during pairing Jakub Tyszkowski
2013-12-05 10:37 ` [PATCH 2/8] android: Update haltest tool entry in README Jakub Tyszkowski
2013-12-05 10:37 ` [PATCH 3/8] android: Fix sending status on bluetooth init if already initialized Jakub Tyszkowski
2013-12-05 10:37 ` [PATCH 4/8] android/hidhost: Unregister ipc handlers if init fails Jakub Tyszkowski
2013-12-05 10:37 ` [PATCH 5/8] android/pan: " Jakub Tyszkowski
2013-12-05 10:37 ` [PATCH 6/8] android/a2dp: " Jakub Tyszkowski
2013-12-05 10:37 ` [PATCH 7/8] android/pan: Move logic from HAL layer to daemon Jakub Tyszkowski
2013-12-05 10:37 ` [PATCH 8/8] android/pan: Move logic from HAL " Jakub Tyszkowski
2013-12-05 13:02 ` Tyszkowski Jakub [this message]
2013-12-06 15:30 ` [PATCHv2] android: Fix delayed adapter turn off Jakub Tyszkowski
2013-12-08 16:07 ` Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52A07953.4030804@tieto.com \
--to=jakub.tyszkowski@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox