#define BT_PERMANENT_LOG_FILE_PATH "/opt/usr/home/owner/media/Downloads/.bt_dump/permanent_log.txt"
#define BT_PERMANENT_LOG_OLD_FILE_PATH "/opt/usr/home/owner/media/Downloads/.bt_dump/permanent_log_old.txt"
+#define BT_PERMANENT_LOG_FIRMWARE_DIR_PATH "/usr/lib/firmware"
#define PERMANENT_LOG_MAX (128 * 1024)
+
+static void __bt_write_firmware_name(FILE *fp)
+{
+ DIR *pDir;
+ struct dirent *pEntry;
+
+ pDir = opendir(BT_PERMANENT_LOG_FIRMWARE_DIR_PATH);
+ if (pDir == NULL) {
+ BT_ERR("Read directory failed");
+ return;
+ }
+
+ pEntry = readdir(pDir);
+ while (pEntry) {
+ if (!strncmp(pEntry->d_name, "BCM", 3))
+ fprintf(fp, "BTFW: %s\n", pEntry->d_name);
+ pEntry = readdir(pDir);
+ }
+ closedir(pDir);
+}
+
void _bt_permanent_log(const char *fmt, ...)
{
FILE *fp;
char time_buf[32];
long lsize = 0;
va_list ap;
+ gboolean is_first = FALSE;
#ifndef TIZEN_FEATURE_BT_PERMANENT_LOG
return;
fclose(fp);
fclose(fp2);
fp = fopen(BT_PERMANENT_LOG_FILE_PATH, "w");
+ is_first = TRUE;
} else {
- if (fp != NULL)
+ if (fp == NULL)
+ is_first = TRUE;
+ else
fclose(fp);
fp = fopen(BT_PERMANENT_LOG_FILE_PATH, "a");
}
if (fp != NULL) {
char buf[100];
+ if (is_first == TRUE)
+ __bt_write_firmware_name(fp);
+
va_start(ap, fmt);
vsnprintf(buf, 100, fmt, ap);
va_end(ap);