*******************************************************************************/
static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
{
-
UINT8 j;
tBTA_PREF_ROLES role;
tBTA_DM_PEER_DEVICE *p_dev;
APPL_TRACE_WARNING("bta_dm_rm_cback:%d, status:%d", bta_dm_cb.cur_av_count, status);
}
- bta_dm_adjust_roles(FALSE);
+ /* Don't adjust roles for each busy/idle state transition to avoid
+ excessive switch requests when individual profile busy/idle status
+ changes */
+ if ((status != BTA_SYS_CONN_BUSY) && (status != BTA_SYS_CONN_IDLE))
+ bta_dm_adjust_roles(FALSE);
}
/*******************************************************************************
static bool stream_corrupted_during_le_scan_workaround(const uint8_t byte_read)
{
if (!stream_corruption_detected && byte_read == HCI_BLE_EVENT) {
- LOG_ERROR(LOG_TAG, "%s HCI stream corrupted (message type 0x3E)!", __func__);
+ LOG_ERROR("%s HCI stream corrupted (message type 0x3E)!", __func__);
stream_corruption_detected = true;
return true;
}
if (stream_corruption_detected) {
if (stream_corruption_bytes_to_ignore == 0) {
stream_corruption_bytes_to_ignore = byte_read;
- LOG_ERROR(LOG_TAG, "%s About to skip %d bytes...", __func__, stream_corruption_bytes_to_ignore);
+ LOG_ERROR("%s About to skip %d bytes...", __func__, stream_corruption_bytes_to_ignore);
} else {
--stream_corruption_bytes_to_ignore;
}
if (stream_corruption_bytes_to_ignore == 0) {
- LOG_ERROR(LOG_TAG, "%s Back to our regularly scheduled program...", __func__);
+ LOG_ERROR("%s Back to our regularly scheduled program...", __func__);
stream_corruption_detected = false;
}
return true;
#include "osi/include/semaphore.h"
#include "osi/include/thread.h"
+// Make callbacks run at high thread priority. Some callbacks are used for audio
+// related timer tasks as well as re-transmissions etc. Since we at this point
+// cannot differentiate what callback we are dealing with, assume high priority
+// for now.
+// TODO(eisenbach): Determine correct thread priority (from parent?/per alarm?)
+static const int CALLBACK_THREAD_PRIORITY_HIGH = -19;
+
struct alarm_t {
// The lock is held while the callback for this alarm is being executed.
// It allows us to release the coarse-grained monitor lock while a potentially
goto error;
}
+ thread_set_priority(callback_thread, CALLBACK_THREAD_PRIORITY_HIGH);
thread_post(callback_thread, callback_dispatch, NULL);
return true;
UINT8 *p, *p_orig = (UINT8 *)(p_buf + 1) + p_buf->offset;
UINT32 counter;
+ if (p_buf->len < GATT_AUTH_SIGN_LEN + 4) {
+ GATT_TRACE_ERROR("%s: Data length %u less than expected %u",
+ __func__, p_buf->len, GATT_AUTH_SIGN_LEN + 4);
+ return;
+ }
cmd_len = p_buf->len - GATT_AUTH_SIGN_LEN + 4;
p = p_orig + cmd_len - 4;
STREAM_TO_UINT32(counter, p);