Bluetooth: Use Zephyr standard log system instead of bluetooth/common/log
The `bluetooth/common/log.h` and `bluetooth/common/log.c` files have been removed. Files that were using them have been updated to use `zephyr/logging/log.h` instead. Those replacement have been done consequently: - `/BT_DBG/LOG_DBG/` - `/BT_ERR/LOG_ERR/` - `/BT_WARN/LOG_WRN/` - `/BT_INFO/LOG_INF/` - `/BT_HEXDUMP_DBG/LOG_HEXDUMP_DBG/` - `/BT_DBG_OBJ_ID/LOG_DBG_OBJ_ID/` Also, some files were relying on the `common/log.h` include to include `zephyr/bluetooth/hci.h`, in those cases the include of `hci.h` has been added. For files that were including `common/log.h` but not using any logs, the include has been removed and not replaced. Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This commit is contained in:
parent
808266a493
commit
e458f5aae6
253 changed files with 7131 additions and 7180 deletions
|
@ -21,11 +21,12 @@
|
|||
#include "foundation.h"
|
||||
#include "access.h"
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_MESH_DEBUG_KEYS)
|
||||
#define LOG_MODULE_NAME bt_mesh_app_keys
|
||||
#include "common/log.h"
|
||||
#include "common/bt_str.h"
|
||||
|
||||
#define LOG_LEVEL CONFIG_BT_MESH_KEYS_LOG_LEVEL
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(bt_mesh_app_keys);
|
||||
|
||||
/* Tracking of what storage changes are pending for App Keys. We track this in
|
||||
* a separate array here instead of within the respective bt_mesh_app_key
|
||||
* struct itself, since once a key gets deleted its struct becomes invalid
|
||||
|
@ -83,9 +84,9 @@ static void clear_app_key(uint16_t app_idx)
|
|||
snprintk(path, sizeof(path), "bt/mesh/AppKey/%x", app_idx);
|
||||
err = settings_delete(path);
|
||||
if (err) {
|
||||
BT_ERR("Failed to clear AppKeyIndex 0x%03x", app_idx);
|
||||
LOG_ERR("Failed to clear AppKeyIndex 0x%03x", app_idx);
|
||||
} else {
|
||||
BT_DBG("Cleared AppKeyIndex 0x%03x", app_idx);
|
||||
LOG_DBG("Cleared AppKeyIndex 0x%03x", app_idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +101,7 @@ static void store_app_key(uint16_t app_idx)
|
|||
|
||||
app = app_get(app_idx);
|
||||
if (!app) {
|
||||
BT_WARN("ApKeyIndex 0x%03x not found", app_idx);
|
||||
LOG_WRN("ApKeyIndex 0x%03x not found", app_idx);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -112,9 +113,9 @@ static void store_app_key(uint16_t app_idx)
|
|||
|
||||
err = settings_save_one(path, &key, sizeof(key));
|
||||
if (err) {
|
||||
BT_ERR("Failed to store AppKey %s value", path);
|
||||
LOG_ERR("Failed to store AppKey %s value", path);
|
||||
} else {
|
||||
BT_DBG("Stored AppKey %s value", path);
|
||||
LOG_DBG("Stored AppKey %s value", path);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,7 +149,7 @@ static void update_app_key_settings(uint16_t app_idx, bool store)
|
|||
struct app_key_update *update, *free_slot;
|
||||
uint8_t clear = store ? 0U : 1U;
|
||||
|
||||
BT_DBG("AppKeyIndex 0x%03x", app_idx);
|
||||
LOG_DBG("AppKeyIndex 0x%03x", app_idx);
|
||||
|
||||
update = app_key_update_find(app_idx, &free_slot);
|
||||
if (update) {
|
||||
|
@ -201,7 +202,7 @@ static struct app_key *app_key_alloc(uint16_t app_idx)
|
|||
|
||||
static void app_key_del(struct app_key *app)
|
||||
{
|
||||
BT_DBG("AppIdx 0x%03x", app->app_idx);
|
||||
LOG_DBG("AppIdx 0x%03x", app->app_idx);
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
|
||||
update_app_key_settings(app->app_idx, false);
|
||||
|
@ -236,8 +237,7 @@ uint8_t bt_mesh_app_key_add(uint16_t app_idx, uint16_t net_idx,
|
|||
{
|
||||
struct app_key *app;
|
||||
|
||||
BT_DBG("net_idx 0x%04x app_idx %04x val %s", net_idx, app_idx,
|
||||
bt_hex(key, 16));
|
||||
LOG_DBG("net_idx 0x%04x app_idx %04x val %s", net_idx, app_idx, bt_hex(key, 16));
|
||||
|
||||
if (!bt_mesh_subnet_get(net_idx)) {
|
||||
return STATUS_INVALID_NETKEY;
|
||||
|
@ -264,7 +264,7 @@ uint8_t bt_mesh_app_key_add(uint16_t app_idx, uint16_t net_idx,
|
|||
return STATUS_CANNOT_SET;
|
||||
}
|
||||
|
||||
BT_DBG("AppIdx 0x%04x AID 0x%02x", app_idx, app->keys[0].id);
|
||||
LOG_DBG("AppIdx 0x%04x AID 0x%02x", app_idx, app->keys[0].id);
|
||||
|
||||
app->net_idx = net_idx;
|
||||
app->app_idx = app_idx;
|
||||
|
@ -272,7 +272,7 @@ uint8_t bt_mesh_app_key_add(uint16_t app_idx, uint16_t net_idx,
|
|||
memcpy(app->keys[0].val, key, 16);
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
|
||||
BT_DBG("Storing AppKey persistently");
|
||||
LOG_DBG("Storing AppKey persistently");
|
||||
update_app_key_settings(app->app_idx, true);
|
||||
}
|
||||
|
||||
|
@ -287,8 +287,7 @@ uint8_t bt_mesh_app_key_update(uint16_t app_idx, uint16_t net_idx,
|
|||
struct app_key *app;
|
||||
struct bt_mesh_subnet *sub;
|
||||
|
||||
BT_DBG("net_idx 0x%04x app_idx %04x val %s", net_idx, app_idx,
|
||||
bt_hex(key, 16));
|
||||
LOG_DBG("net_idx 0x%04x app_idx %04x val %s", net_idx, app_idx, bt_hex(key, 16));
|
||||
|
||||
app = app_get(app_idx);
|
||||
if (!app) {
|
||||
|
@ -325,13 +324,13 @@ uint8_t bt_mesh_app_key_update(uint16_t app_idx, uint16_t net_idx,
|
|||
return STATUS_CANNOT_UPDATE;
|
||||
}
|
||||
|
||||
BT_DBG("app_idx 0x%04x AID 0x%02x", app_idx, app->keys[1].id);
|
||||
LOG_DBG("app_idx 0x%04x AID 0x%02x", app_idx, app->keys[1].id);
|
||||
|
||||
app->updated = true;
|
||||
memcpy(app->keys[1].val, key, 16);
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
|
||||
BT_DBG("Storing AppKey persistently");
|
||||
LOG_DBG("Storing AppKey persistently");
|
||||
update_app_key_settings(app->app_idx, true);
|
||||
}
|
||||
|
||||
|
@ -344,7 +343,7 @@ uint8_t bt_mesh_app_key_del(uint16_t app_idx, uint16_t net_idx)
|
|||
{
|
||||
struct app_key *app;
|
||||
|
||||
BT_DBG("AppIdx 0x%03x", app_idx);
|
||||
LOG_DBG("AppIdx 0x%03x", app_idx);
|
||||
|
||||
if (net_idx != BT_MESH_KEY_UNUSED && !bt_mesh_subnet_get(net_idx)) {
|
||||
return STATUS_INVALID_NETKEY;
|
||||
|
@ -381,7 +380,7 @@ int bt_mesh_app_key_set(uint16_t app_idx, uint16_t net_idx,
|
|||
return 0;
|
||||
}
|
||||
|
||||
BT_DBG("AppIdx 0x%04x AID 0x%02x", app_idx, app->keys[0].id);
|
||||
LOG_DBG("AppIdx 0x%04x AID 0x%02x", app_idx, app->keys[0].id);
|
||||
|
||||
memcpy(app->keys[0].val, old_key, 16);
|
||||
if (bt_mesh_app_id(old_key, &app->keys[0].id)) {
|
||||
|
@ -456,7 +455,7 @@ int bt_mesh_keys_resolve(struct bt_mesh_msg_ctx *ctx,
|
|||
*/
|
||||
*sub = bt_mesh_subnet_get(ctx->net_idx);
|
||||
if (!*sub) {
|
||||
BT_WARN("Unknown NetKey 0x%03x", ctx->net_idx);
|
||||
LOG_WRN("Unknown NetKey 0x%03x", ctx->net_idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -465,13 +464,13 @@ int bt_mesh_keys_resolve(struct bt_mesh_msg_ctx *ctx,
|
|||
struct bt_mesh_cdb_node *node;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_BT_MESH_CDB)) {
|
||||
BT_WARN("No DevKey for 0x%04x", ctx->addr);
|
||||
LOG_WRN("No DevKey for 0x%04x", ctx->addr);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
node = bt_mesh_cdb_node_get(ctx->addr);
|
||||
if (!node) {
|
||||
BT_WARN("No DevKey for 0x%04x", ctx->addr);
|
||||
LOG_WRN("No DevKey for 0x%04x", ctx->addr);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -486,13 +485,13 @@ int bt_mesh_keys_resolve(struct bt_mesh_msg_ctx *ctx,
|
|||
|
||||
app = app_get(ctx->app_idx);
|
||||
if (!app) {
|
||||
BT_WARN("Unknown AppKey 0x%03x", ctx->app_idx);
|
||||
LOG_WRN("Unknown AppKey 0x%03x", ctx->app_idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*sub = bt_mesh_subnet_get(app->net_idx);
|
||||
if (!*sub) {
|
||||
BT_WARN("Unknown NetKey 0x%03x", app->net_idx);
|
||||
LOG_WRN("Unknown NetKey 0x%03x", app->net_idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -626,7 +625,7 @@ static int app_key_set(const char *name, size_t len_rd,
|
|||
int err;
|
||||
|
||||
if (!name) {
|
||||
BT_ERR("Insufficient number of arguments");
|
||||
LOG_ERR("Insufficient number of arguments");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
|
@ -644,11 +643,11 @@ static int app_key_set(const char *name, size_t len_rd,
|
|||
err = bt_mesh_app_key_set(app_idx, key.net_idx, key.val[0],
|
||||
key.updated ? key.val[1] : NULL);
|
||||
if (err) {
|
||||
BT_ERR("Failed to set \'app-key\'");
|
||||
LOG_ERR("Failed to set \'app-key\'");
|
||||
return err;
|
||||
}
|
||||
|
||||
BT_DBG("AppKeyIndex 0x%03x recovered from storage", app_idx);
|
||||
LOG_DBG("AppKeyIndex 0x%03x recovered from storage", app_idx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue