Skip to content

Commit 14f5fa0

Browse files
Merge branch 'fix/cliend_id' into 'master'
Cover the case for SOC without MAC address See merge request espressif/esp-mqtt!202
2 parents 37cb056 + 5e3abd4 commit 14f5fa0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/platform_esp32_idf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ char *platform_create_id_string(void)
2525
uint8_t mac[6];
2626
char *id_string = calloc(1, MAX_ID_STRING);
2727
ESP_MEM_CHECK(TAG, id_string, return NULL);
28+
#ifndef MAC_TYPE
29+
ESP_LOGW(TAG, "Soc doesn't provide MAC, client could be disconnected in case of device with same name in the broker.");
30+
sprintf(id_string, "esp_mqtt_client_id");
31+
#else
2832
esp_read_mac(mac, MAC_TYPE);
2933
sprintf(id_string, "ESP32_%02x%02X%02X", mac[3], mac[4], mac[5]);
34+
#endif
3035
return id_string;
3136
}
3237

0 commit comments

Comments
 (0)