Re: [PATCH BlueZ 4/4] eir: Read GAP appearance from advertising data

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

 



Hi Bruna,

On Tue, Mar 27, 2012, Bruna Moreira wrote:
> --- a/src/eir.c
> +++ b/src/eir.c
> @@ -108,6 +108,7 @@ int eir_parse(struct eir_data *eir, uint8_t *eir_data, uint8_t eir_len)
>  	while (len < eir_len - 1) {
>  		uint8_t field_len = eir_data[0];
>  		uint8_t data_len, *data = &eir_data[2];
> +		uint16_t *u16;
>  
>  		/* Check for the end of EIR */
>  		if (field_len == 0)
> @@ -164,6 +165,14 @@ int eir_parse(struct eir_data *eir, uint8_t *eir_data, uint8_t eir_len)
>  			if (data_len < 3)
>  				break;
>  			memcpy(eir->dev_class, data, 3);
> +			break;
> +
> +		case EIR_GAP_APPEARANCE:
> +			if (data_len < 2)
> +				break;
> +			u16 = (uint16_t *) data;
> +			eir->appearance = btohs(bt_get_unaligned(u16));
> +			break;
>  		}

I don't think you need the u16 variable at all. Just do:

	eir->appearance = bt_get_le16(data);

Johan
--
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