diff options
author | Vishal Agarwal <vishal.agarwal@stericsson.com> | 2012-04-26 09:49:56 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-05-16 15:13:19 -0400 |
commit | 9d939d948469b49912a76e789f7d4059eb1f8bc7 (patch) | |
tree | ab3a2255a084909fb69086abb26dbf0ecb5b783e /include/net | |
parent | a24299e6c82f624cd2c717c91f04f1d79113ada8 (diff) |
Bluetooth: Fix EIR data generation for mgmt_device_found
The mgmt_device_found function expects to receive only the significant
part of the EIR data so it needs to be removed before calling the
function. This patch adds a new eir_get_length() helper function to
calculate the length of the significant part.
Signed-off-by: Vishal Agarwal <vishal.agarwal@stericsson.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/bluetooth/hci_core.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index b60d2c844eba..9fc7728f94e4 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -926,6 +926,23 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type) | |||
926 | return false; | 926 | return false; |
927 | } | 927 | } |
928 | 928 | ||
929 | static inline size_t eir_get_length(u8 *eir, size_t eir_len) | ||
930 | { | ||
931 | size_t parsed = 0; | ||
932 | |||
933 | while (parsed < eir_len) { | ||
934 | u8 field_len = eir[0]; | ||
935 | |||
936 | if (field_len == 0) | ||
937 | return parsed; | ||
938 | |||
939 | parsed += field_len + 1; | ||
940 | eir += field_len + 1; | ||
941 | } | ||
942 | |||
943 | return eir_len; | ||
944 | } | ||
945 | |||
929 | static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data, | 946 | static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data, |
930 | u8 data_len) | 947 | u8 data_len) |
931 | { | 948 | { |