espressif / esp-hosted

Hosted Solution (Linux/MCU) with ESP32 (Wi-Fi + BT + BLE)
Other
706 stars 169 forks source link

Can I change the BT MAC address via esp-hosted-fg?I was used linux driver. #501

Open 244219195 opened 1 month ago

244219195 commented 1 month ago

Checklist

Issue or Suggestion Description

I want to add device node in linux .and then .,i can set this node value to set BT mac for ESP32 -C3 .if have other way to set the BT MAC address.Please tell me .Actually, my idea is to be able to set the Bluetooth address through Linux instead of using the default address.however ,my linux kernel is low ,it can"t support python.

mantriyogesh commented 1 month ago

Hello @244219195 , yes this needs to be added.

Plan would be to make wifi_set_mac deprecated and add up additional mode (diff name then with uint32) for Bluetooth with newer api, set_mac()

We will add this support and let you know. However, It might take some time.

For your case, you can just make small changes and re-use this API at higher layer, with hacks to handle bluetooth case, at both esp and host side code.

244219195 commented 1 month ago

Can you provide some examples?

mantriyogesh commented 1 month ago

Slave side hack

Get

https://github.com/espressif/esp-hosted/blob/250e29294a740a45dd853115a25b62f1b2cfc51b/esp_hosted_fg/esp/esp_driver/network_adapter/main/slave_control.c#L303-L316

Set

https://github.com/espressif/esp-hosted/blob/250e29294a740a45dd853115a25b62f1b2cfc51b/esp_hosted_fg/esp/esp_driver/network_adapter/main/slave_control.c#L1517-L1537

Host side hack

Get

Add test_get_bt_mac_addr() similar to https://github.com/espressif/esp-hosted/blob/250e29294a740a45dd853115a25b62f1b2cfc51b/esp_hosted_fg/host/linux/host_control/c_support/test_utils.c#L697-L701

Set

https://github.com/espressif/esp-hosted/blob/250e29294a740a45dd853115a25b62f1b2cfc51b/esp_hosted_fg/host/linux/host_control/c_support/test_utils.c#L732

mantriyogesh commented 1 month ago

Above are not exactly the solution, but the code places to hack, to easily get your work done for now.

244219195 commented 1 month ago

Thanks,mantriyogesh. Looking forward to the development of MAC address configuration in the future.