linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alain Michaud <alainmichaud@google.com>
To: Archie Pusaka <apusaka@google.com>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth <linux-bluetooth@vger.kernel.org>,
	Archie Pusaka <apusaka@chromium.org>,
	Alain Michaud <alainm@chromium.org>
Subject: Re: [Bluez PATCH v3 1/2] device: add device_remove_bonding function
Date: Tue, 28 Jul 2020 09:18:52 -0400	[thread overview]
Message-ID: <CALWDO_UsrzyLFkmxcnE59zaZPjP8ByN3sSOLDse6LwwpTA=ZsQ@mail.gmail.com> (raw)
In-Reply-To: <20200717020332.Bluez.v3.1.I1322f6745fa50365c1c88de3e2c50c9c5962c094@changeid>

Friendly ping to maintainers on this one.

Thanks,
Alain

On Thu, Jul 16, 2020 at 2:04 PM Archie Pusaka <apusaka@google.com> wrote:
>
> From: Archie Pusaka <apusaka@chromium.org>
>
> This patch splits the "bonding removal" function in device.c,
> because we need to remove bonding information when receiving
> "virtual cable unplug" in HID profile.
>
> Reviewed-by: Alain Michaud <alainm@chromium.org>
> ---
>
> Changes in v3:
> - Call device_set_temporary on device_remove_bonding
>
> Changes in v2: None
>
>  src/device.c | 28 ++++++++++++++++++----------
>  src/device.h |  1 +
>  2 files changed, 19 insertions(+), 10 deletions(-)
>
> diff --git a/src/device.c b/src/device.c
> index 226216235..b23ecb7fd 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -4356,6 +4356,20 @@ static void delete_folder_tree(const char *dirname)
>         rmdir(dirname);
>  }
>
> +void device_remove_bonding(struct btd_device *device, uint8_t bdaddr_type)
> +{
> +       if (bdaddr_type == BDADDR_BREDR)
> +               device->bredr_state.bonded = false;
> +       else
> +               device->le_state.bonded = false;
> +
> +       if (!device->bredr_state.bonded && !device->le_state.bonded)
> +               btd_device_set_temporary(device, true);
> +
> +       btd_adapter_remove_bonding(device->adapter, &device->bdaddr,
> +                                                       bdaddr_type);
> +}
> +
>  static void device_remove_stored(struct btd_device *device)
>  {
>         char device_addr[18];
> @@ -4364,17 +4378,11 @@ static void device_remove_stored(struct btd_device *device)
>         char *data;
>         gsize length = 0;
>
> -       if (device->bredr_state.bonded) {
> -               device->bredr_state.bonded = false;
> -               btd_adapter_remove_bonding(device->adapter, &device->bdaddr,
> -                                                               BDADDR_BREDR);
> -       }
> +       if (device->bredr_state.bonded)
> +               device_remove_bonding(device, BDADDR_BREDR);
>
> -       if (device->le_state.bonded) {
> -               device->le_state.bonded = false;
> -               btd_adapter_remove_bonding(device->adapter, &device->bdaddr,
> -                                                       device->bdaddr_type);
> -       }
> +       if (device->le_state.bonded)
> +               device_remove_bonding(device, device->bdaddr_type);
>
>         device->bredr_state.paired = false;
>         device->le_state.paired = false;
> diff --git a/src/device.h b/src/device.h
> index cb8d884e8..956fec1ae 100644
> --- a/src/device.h
> +++ b/src/device.h
> @@ -50,6 +50,7 @@ uint16_t btd_device_get_vendor(struct btd_device *device);
>  uint16_t btd_device_get_vendor_src(struct btd_device *device);
>  uint16_t btd_device_get_product(struct btd_device *device);
>  uint16_t btd_device_get_version(struct btd_device *device);
> +void device_remove_bonding(struct btd_device *device, uint8_t bdaddr_type);
>  void device_remove(struct btd_device *device, gboolean remove_stored);
>  int device_address_cmp(gconstpointer a, gconstpointer b);
>  int device_bdaddr_cmp(gconstpointer a, gconstpointer b);
> --
> 2.27.0.389.gc38d7665816-goog
>

  parent reply	other threads:[~2020-07-28 13:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 18:04 [Bluez PATCH v3 1/2] device: add device_remove_bonding function Archie Pusaka
2020-07-16 18:04 ` [Bluez PATCH v3 2/2] input: Remove bonding info when receiving virtual cable unplug Archie Pusaka
2020-07-28 13:18 ` Alain Michaud [this message]
2020-07-28 18:03   ` [Bluez PATCH v3 1/2] device: add device_remove_bonding function 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='CALWDO_UsrzyLFkmxcnE59zaZPjP8ByN3sSOLDse6LwwpTA=ZsQ@mail.gmail.com' \
    --to=alainmichaud@google.com \
    --cc=alainm@chromium.org \
    --cc=apusaka@chromium.org \
    --cc=apusaka@google.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).