Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nimble/ll: Add debug printf vs hci event #1513

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions nimble/controller/include/controller/ble_ll_ctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ void ble_ll_calc_session_key(struct ble_ll_conn_sm *connsm);
void ble_ll_ctrl_phy_update_proc_complete(struct ble_ll_conn_sm *connsm);
void ble_ll_ctrl_initiate_dle(struct ble_ll_conn_sm *connsm, bool initial);
void ble_ll_hci_ev_send_vs_assert(const char *file, uint32_t line);
void ble_ll_hci_ev_send_vs_printf(uint8_t id, const char *fmt, ...);
void ble_ll_hci_ev_send_vs_llcp_trace(uint8_t type, uint16_t handle, uint16_t count,
void *pdu, size_t length);

Expand Down
31 changes: 30 additions & 1 deletion nimble/controller/src/ble_ll_hci_ev.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
#include <stdint.h>

#include <assert.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "syscfg/syscfg.h"
#include "nimble/ble.h"
Expand Down Expand Up @@ -609,6 +612,32 @@ ble_ll_hci_ev_send_vs_assert(const char *file, uint32_t line)
}
}

void
ble_ll_hci_ev_send_vs_printf(uint8_t id, const char *fmt, ...)
{
struct ble_hci_ev_vs *ev;
struct ble_hci_ev *hci_ev;
va_list ap;

hci_ev = ble_transport_alloc_evt(1);
if (!hci_ev) {
return;
}

hci_ev->opcode = BLE_HCI_EVCODE_VS;
hci_ev->length = sizeof(*ev);

ev = (void *) hci_ev->data;
ev->id = id;

va_start(ap, fmt);
hci_ev->length += vsnprintf((void *)ev->data,
BLE_HCI_MAX_DATA_LEN - sizeof(*ev), fmt, ap);
va_end(ap);

ble_ll_hci_event_send(hci_ev);
}

#if MYNEWT_VAL(BLE_LL_HCI_LLCP_TRACE)
void
ble_ll_hci_ev_send_vs_llcp_trace(uint8_t type, uint16_t handle, uint16_t count,
Expand Down