Remove use of printk.

This commit is contained in:
Pete Johanson 2020-08-14 16:45:05 -04:00
parent 8b61beb2bb
commit 7e8a07e693

View file

@ -31,11 +31,11 @@ static void connected(struct bt_conn *conn, u8_t err)
if (err) if (err)
{ {
printk("Failed to connect to %s (%u)\n", addr, err); LOG_WRN("Failed to connect to %s (%u)", log_strdup(addr), err);
return; return;
} }
printk("Connected %s\n", addr); LOG_DBG("Connected %s", log_strdup(addr));
bt_conn_le_param_update(conn, BT_LE_CONN_PARAM(0x0006, 0x000c, 30, 400)); bt_conn_le_param_update(conn, BT_LE_CONN_PARAM(0x0006, 0x000c, 30, 400));
@ -45,7 +45,7 @@ static void connected(struct bt_conn *conn, u8_t err)
if (bt_conn_set_security(conn, BT_SECURITY_L2)) if (bt_conn_set_security(conn, BT_SECURITY_L2))
{ {
printk("Failed to set security\n"); LOG_ERR("Failed to set security");
} }
} }
@ -55,7 +55,7 @@ static void disconnected(struct bt_conn *conn, u8_t reason)
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
printk("Disconnected from %s (reason 0x%02x)\n", addr, reason); LOG_DBG("Disconnected from %s (reason 0x%02x)", log_strdup(addr), reason);
} }
static void security_changed(struct bt_conn *conn, bt_security_t level, static void security_changed(struct bt_conn *conn, bt_security_t level,
@ -67,11 +67,11 @@ static void security_changed(struct bt_conn *conn, bt_security_t level,
if (!err) if (!err)
{ {
printk("Security changed: %s level %u\n", addr, level); LOG_DBG("Security changed: %s level %u", log_strdup(addr), level);
} }
else else
{ {
printk("Security failed: %s level %u err %d\n", addr, level, LOG_ERR("Security failed: %s level %u err %d", log_strdup(addr), level,
err); err);
} }
} }
@ -107,7 +107,7 @@ static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey)
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
printk("Passkey for %s: %06u\n", addr, passkey); LOG_DBG("Passkey for %s: %06u", log_strdup(addr), passkey);
} }
#ifdef CONFIG_ZMK_BLE_PASSKEY_ENTRY #ifdef CONFIG_ZMK_BLE_PASSKEY_ENTRY
@ -118,7 +118,7 @@ static void auth_passkey_entry(struct bt_conn *conn)
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
printk("Passkey entry requested for %s\n", addr); LOG_DBG("Passkey entry requested for %s", log_strdup(addr));
auth_passkey_entry_conn = bt_conn_ref(conn); auth_passkey_entry_conn = bt_conn_ref(conn);
} }
@ -138,7 +138,7 @@ static void auth_cancel(struct bt_conn *conn)
passkey_digit = 0; passkey_digit = 0;
printk("Pairing cancelled: %s\n", addr); LOG_DBG("Pairing cancelled: %s", log_strdup(addr));
} }
static struct bt_conn_auth_cb zmk_ble_auth_cb_display = { static struct bt_conn_auth_cb zmk_ble_auth_cb_display = {
@ -169,14 +169,14 @@ static void zmk_ble_ready(int err)
LOG_DBG("ready? %d", err); LOG_DBG("ready? %d", err);
if (err) if (err)
{ {
printk("Bluetooth init failed (err %d)\n", err); LOG_ERR("Bluetooth init failed (err %d)", err);
return; return;
} }
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, zmk_ble_ad, ARRAY_SIZE(zmk_ble_ad), NULL, 0); err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, zmk_ble_ad, ARRAY_SIZE(zmk_ble_ad), NULL, 0);
if (err) if (err)
{ {
printk("Advertising failed to start (err %d)\n", err); LOG_ERR("Advertising failed to start (err %d)", err);
return; return;
} }
} }
@ -187,7 +187,7 @@ static int zmk_ble_init(struct device *_arg)
if (err) if (err)
{ {
printk("BLUETOOTH FAILED"); LOG_ERR("BLUETOOTH FAILED (%d)", err);
return err; return err;
} }