btdev: Add support for setting bdaddr

This adds btdev_set_bdaddr so it is possible to set an arbritrary
address.
This commit is contained in:
Luiz Augusto von Dentz 2022-10-07 18:14:08 -07:00
parent 3da439ae3c
commit c94cdbc6d7
2 changed files with 12 additions and 0 deletions

View File

@ -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;

View File

@ -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);