summaryrefslogtreecommitdiff
path: root/emulator
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-10-07 18:14:08 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-10-10 13:06:16 -0700
commitc94cdbc6d73ffd818d862975895d48dd01361234 (patch)
tree0cdc329357d557b2fe064d949d4f0fb9b74911a0 /emulator
parent3da439ae3c76e5008d007c2c41f6e7e1828b7321 (diff)
downloadbluez-c94cdbc6d73ffd818d862975895d48dd01361234.tar.gz
btdev: Add support for setting bdaddr
This adds btdev_set_bdaddr so it is possible to set an arbritrary address.
Diffstat (limited to 'emulator')
-rw-r--r--emulator/btdev.c10
-rw-r--r--emulator/btdev.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/emulator/btdev.c b/emulator/btdev.c
index 3fdfb64a9..549f93645 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -6960,6 +6960,16 @@ const uint8_t *btdev_get_bdaddr(struct btdev *btdev)
return btdev->bdaddr;
}
+bool btdev_set_bdaddr(struct btdev *btdev, const uint8_t *bdaddr)
+{
+ if (!btdev || !bdaddr)
+ return false;
+
+ memcpy(btdev->bdaddr, bdaddr, sizeof(btdev->bdaddr));
+
+ return true;
+}
+
uint8_t *btdev_get_features(struct btdev *btdev)
{
return btdev->features;
diff --git a/emulator/btdev.h b/emulator/btdev.h
index 228bf205c..cad5f699f 100644
--- a/emulator/btdev.h
+++ b/emulator/btdev.h
@@ -72,6 +72,8 @@ bool btdev_set_debug(struct btdev *btdev, btdev_debug_func_t callback,
void *user_data, btdev_destroy_func_t destroy);
const uint8_t *btdev_get_bdaddr(struct btdev *btdev);
+bool btdev_set_bdaddr(struct btdev *btdev, const uint8_t *bdaddr);
+
uint8_t *btdev_get_features(struct btdev *btdev);
uint8_t btdev_get_scan_enable(struct btdev *btdev);