Re: [PATCH v4 03/12] Move legacy verification to a new function

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

 



Hi,

On Tue, May 17, 2011 at 3:25 PM, Claudio Takahasi
<claudio.takahasi@xxxxxxxxxxxxx> wrote:
> ---
> Âsrc/adapter.c | Â 35 ++++++++++++++++++++++-------------
> Â1 files changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index 3188974..d4e1121 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -3002,6 +3002,26 @@ void adapter_update_device_from_info(struct btd_adapter *adapter,
> Â Â Â Âadapter_emit_device_found(adapter, dev);
> Â}
>
> +static gboolean pairing_is_legacy(bdaddr_t *local, bdaddr_t *peer,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â gboolean eir, gboolean name)

Based on the discussion in the IRC, a new patch series will be sent
replacing the booleans("name" and "data") by pointers.

Claudio.

> +{
> + Â Â Â unsigned char features[8];
> +
> + Â Â Â if (eir)
> + Â Â Â Â Â Â Â return FALSE;
> +
> + Â Â Â if (name == FALSE)
> + Â Â Â Â Â Â Â return TRUE;
> +
> + Â Â Â if (read_remote_features(local, peer, NULL, features) < 0)
> + Â Â Â Â Â Â Â return TRUE;
> +
> + Â Â Â if (features[0] & 0x01)
> + Â Â Â Â Â Â Â return FALSE;
> + Â Â Â else
> + Â Â Â Â Â Â Â return TRUE;
> +}
> +
> Âvoid adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âuint32_t class, int8_t rssi, uint8_t *data)
> Â{
> @@ -3011,7 +3031,6 @@ void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
> Â Â Â Âchar *alias, *name;
> Â Â Â Âgboolean new_dev, legacy;
> Â Â Â Âname_status_t name_status;
> - Â Â Â unsigned char features[8];
> Â Â Â Âconst char *dev_name;
> Â Â Â Âint err;
>
> @@ -3037,18 +3056,8 @@ void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
> Â Â Â Âcreate_name(filename, PATH_MAX, STORAGEDIR, local_addr, "names");
> Â Â Â Âname = textfile_get(filename, peer_addr);
>
> - Â Â Â if (data)
> - Â Â Â Â Â Â Â legacy = FALSE;
> - Â Â Â else if (name == NULL)
> - Â Â Â Â Â Â Â legacy = TRUE;
> - Â Â Â else if (read_remote_features(&adapter->bdaddr, bdaddr, NULL,
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â features) == 0) {
> - Â Â Â Â Â Â Â if (features[0] & 0x01)
> - Â Â Â Â Â Â Â Â Â Â Â legacy = FALSE;
> - Â Â Â Â Â Â Â else
> - Â Â Â Â Â Â Â Â Â Â Â legacy = TRUE;
> - Â Â Â } else
> - Â Â Â Â Â Â Â legacy = TRUE;
> + Â Â Â legacy = pairing_is_legacy(&adapter->bdaddr, bdaddr,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â data ? TRUE : FALSE, name ? TRUE : FALSE);
>
> Â Â Â Â/* Complete EIR names are always used. Shortened EIR names are only
> Â Â Â Â * used if there is no name already in storage. */
> --
> 1.7.5.rc3
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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