Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> Andorid BlueZ Debug Enable

Andorid BlueZ Debug Enable

編輯:關於Android編程

打開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
  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved