Andorid BlueZ Debug Enable

來源:互聯網
上載者:User

開啟Android BlueZ Debug 開關:

Enable Bluetoothd debugging
Way1:
    In file external/bluetooth/bluez/src/log.h
    Redefine DBG as follow:

1)
#define DBG(fmt, arg...) __android_log_print(ANDROID_LOG_DEBUG, "BlueZ", fmt, ## arg)
2)
add file as header in log.h:
#include <android/log.h>
3)
void __btd_toggle_debug()                                                                                                                                   
{
    struct btd_debug_desc *desc;

//  for (desc = __start___debug; desc < __stop___debug; desc++)
//      desc->flags |= BTD_DEBUG_FLAG_PRINT;
}

void __btd_log_init(const char *debug, int detach)
{
    int option = LOG_NDELAY | LOG_PID;
    struct btd_debug_desc *desc;
    const char *name = NULL, *file = NULL;

    if (debug != NULL)
        enabled = g_strsplit_set(debug, ":, ", 0);
/*
    for (desc = __start___debug; desc < __stop___debug; desc++) {
        if (file != NULL || name != NULL) {
            if (g_strcmp0(desc->file, file) == 0) {
                if (desc->name == NULL)
                    desc->name = name;
            } else
                file = NULL;
        }

        if (is_enabled(desc))
            desc->flags |= BTD_DEBUG_FLAG_PRINT;
    }
*/


Way 2:
In file external/bluetooth/bluez/src/log.h:
1.
Add
#include <cutils/logd.h>

2.
Before:
#define BTD_DEBUG_FLAG_DEFAULT (0)
#define BTD_DEBUG_FLAG_PRINT (1 << 0)
After
#define BTD_DEBUG_FLAG_DEFAULT 1
#define BTD_DEBUG_FLAG_PRINT 1

3.
Before:
#define DBG(fmt, arg...) do { \
static struct btd_debug_desc __btd_debug_desc \
__attribute__((used, section("__debug"), aligned(8))) = { \
.file = __FILE__, .flags = BTD_DEBUG_FLAG_DEFAULT, \
}; \
if (__btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \
btd_debug("%s:%s() " fmt, __FILE__, __FUNCTION__ , ## arg); \
} while (0)www.2cto.com
After:
#define DBG(fmt, arg...) do { \
static struct btd_debug_desc __btd_debug_desc \
__attribute__((used, section("__debug"), aligned(8))) = { \
.file = __FILE__, .flags = BTD_DEBUG_FLAG_DEFAULT, \
}; \
if (__btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \
__android_log_print(ANDROID_LOG_DEBUG, "BlueZ",fmt, ##arg); \
} while (0)

End.


作者:saturnbj

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.