Re: [PATCH v1] device: only use the address type selection algorithm when remote device is a dual-mode device when pair device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Cheng,

On Mon, Oct 28, 2024 at 7:37 AM Cheng Jiang <quic_chejiang@xxxxxxxxxxx> wrote:
>
> ---
>  src/device.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/src/device.c b/src/device.c
> index 7585184de..71fdbb145 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -3077,12 +3077,21 @@ static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg,
>         if (device->bonding)
>                 return btd_error_in_progress(msg);
>
> -       if (device->bredr_state.bonded)
> +       /* Only use this selection algorithms when device is combo
> +        * chip. Ohterwise, it will use the wrong bearer to establish
> +        * a connection if the device is already paired. which will
> +        * stall the pairing procedure.
> +        */
> +       if (device->bredr && device->le) {
> +               if (device->bredr_state.bonded)
> +                       bdaddr_type = device->bdaddr_type;
> +               else if (device->le_state.bonded)
> +                       bdaddr_type = BDADDR_BREDR;
> +               else
> +                       bdaddr_type = select_conn_bearer(device);
> +       } else {
>                 bdaddr_type = device->bdaddr_type;
> -       else if (device->le_state.bonded)
> -               bdaddr_type = BDADDR_BREDR;
> -       else
> -               bdaddr_type = select_conn_bearer(device);
> +       }

This seems weird without there being a bug with the state itself, for
instance how would it select the wrong bearer if it is not supported?
Also the lack of proper explanation in the commit message doesn't help
to grasp what is going on here, so please have backtrace or something
attached since we need to understand why it would be selecting the
wrong bearer, or perhaps the bearer is being advertised as supported
when in fact it isn't?

>         state = get_state(device, bdaddr_type);
>
> --
> 2.25.1
>
>


-- 
Luiz Augusto von Dentz





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux