path: root/src
diff options
authorJohan Hedberg <johan.hedberg@intel.com>2012-01-18 13:27:16 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-01-18 13:27:16 +0200
commit4548e3a6b21bbc185dd8284e128751ce87d108ae (patch)
treef8623ea5c6f55c2603fdd2017f9c8337c133a080 /src
parent26a2456f1f3a075b1a4b94454dcc6f13274b7c03 (diff)
storage: Add variable-length EIR support to write_remote_eir
Diffstat (limited to 'src')
3 files changed, 6 insertions, 4 deletions
diff --git a/src/event.c b/src/event.c
index 30666354..91ce103e 100644
--- a/src/event.c
+++ b/src/event.c
@@ -261,7 +261,7 @@ void btd_event_device_found(bdaddr_t *local, bdaddr_t *peer, addr_type_t type,
update_lastseen(local, peer);
if (data)
- write_remote_eir(local, peer, data);
+ write_remote_eir(local, peer, data, data_len);
adapter_update_found_devices(adapter, peer, type, rssi,
confirm_name, data, data_len);
diff --git a/src/storage.c b/src/storage.c
index a47720a4..248e3971 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -359,13 +359,14 @@ int read_device_name(const char *src, const char *dst, char *name)
return 0;
-int write_remote_eir(bdaddr_t *local, bdaddr_t *peer, uint8_t *data)
+int write_remote_eir(bdaddr_t *local, bdaddr_t *peer, uint8_t *data,
+ uint8_t data_len)
char filename[PATH_MAX + 1], addr[18], str[481];
int i;
memset(str, 0, sizeof(str));
- for (i = 0; i < HCI_MAX_EIR_LENGTH; i++)
+ for (i = 0; i < data_len; i++)
sprintf(str + (i * 2), "%2.2X", data[i]);
create_filename(filename, PATH_MAX, local, "eir");
diff --git a/src/storage.h b/src/storage.h
index 51259f60..4046e99b 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -40,7 +40,8 @@ int write_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t class);
int read_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t *class);
int write_device_name(bdaddr_t *local, bdaddr_t *peer, char *name);
int read_device_name(const char *src, const char *dst, char *name);
-int write_remote_eir(bdaddr_t *local, bdaddr_t *peer, uint8_t *data);
+int write_remote_eir(bdaddr_t *local, bdaddr_t *peer, uint8_t *data,
+ uint8_t data_len);
int read_remote_eir(bdaddr_t *local, bdaddr_t *peer, uint8_t *data);
int write_version_info(bdaddr_t *local, bdaddr_t *peer, uint16_t manufacturer, uint8_t lmp_ver, uint16_t lmp_subver);
int write_features_info(bdaddr_t *local, bdaddr_t *peer, unsigned char *page1, unsigned char *page2);