From b94e33f90aa019dd865879d801445f99ca1dca07 Mon Sep 17 00:00:00 2001 From: Iulia Tanasescu Date: Wed, 4 Oct 2023 18:31:48 +0300 Subject: [PATCH] hciemu: Add support for setting emulator bdaddr This adds support for the user to explicitly set a desired bdaddr to a client emulator. --- emulator/hciemu.c | 9 +++++++++ emulator/hciemu.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/emulator/hciemu.c b/emulator/hciemu.c index 25874ded5..f13b4bda1 100644 --- a/emulator/hciemu.c +++ b/emulator/hciemu.c @@ -550,6 +550,15 @@ const uint8_t *hciemu_client_bdaddr(struct hciemu_client *client) return btdev_get_bdaddr(client->dev); } +bool hciemu_set_client_bdaddr(struct hciemu_client *client, + const uint8_t *bdaddr) +{ + if (!client) + return NULL; + + return btdev_set_bdaddr(client->dev, bdaddr); +} + const uint8_t *hciemu_get_client_bdaddr(struct hciemu *hciemu) { struct hciemu_client *client; diff --git a/emulator/hciemu.h b/emulator/hciemu.h index 3449eae41..dba920fdd 100644 --- a/emulator/hciemu.h +++ b/emulator/hciemu.h @@ -39,6 +39,8 @@ void hciemu_unref(struct hciemu *hciemu); struct hciemu_client *hciemu_get_client(struct hciemu *hciemu, int num); struct bthost *hciemu_client_host(struct hciemu_client *client); const uint8_t *hciemu_client_bdaddr(struct hciemu_client *client); +bool hciemu_set_client_bdaddr(struct hciemu_client *client, + const uint8_t *bdaddr); typedef void (*hciemu_debug_func_t)(const char *str, void *user_data); typedef void (*hciemu_destroy_func_t)(void *user_data); -- 2.47.3