Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 346e2020 authored by cpasjuste's avatar cpasjuste Committed by Hashcode
Browse files

liblog: add Amazon logging functions for prebuilt compatibility

Most prebuilt binaries from the Kindle Fire HDX devices link to these
functions.   Adding them here with opt-in CFLAG: AMAZON_LOG

libcutils needs an external reference to these functions as well

liblog implementation follows the same pattern as MOTOROLA_LOG and HTCLOG

Change-Id: If7afb80405b2c444cddf9e17884a20b090b13012
parent c7b37250
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -25,6 +25,11 @@

#include <cutils/klog.h>

#ifdef AMAZON_LOG
extern int lab126_log_write(int bufID, int prio, const char *tag, const char *fmt, ...);
extern int __vitals_log_print(int bufID, int prio, const char *tag, const char *fmt, ...);
#endif // AMAZON_LOG

static int klog_fd = -1;
static int klog_level = KLOG_DEFAULT_LEVEL;

+44 −0
Original line number Diff line number Diff line
@@ -421,6 +421,50 @@ static int __write_to_log_init(log_id_t log_id, struct iovec *vec, size_t nr)
    return write_to_log(log_id, vec, nr);
}

#ifdef AMAZON_LOG
int lab126_log_write(int bufID, int prio, const char *tag, const char *fmt, ...)
{
	va_list ap;
	char buf[LOG_BUF_SIZE];
	int _a = bufID;
	int _b = prio;

	// skip flooding logs
	if (!tag)
	{
		tag = "";
	}
	if( strncmp(tag, "Sensors", 7) == 0
		||  strncmp(tag, "qcom_se", 7) == 0 )
	{
		return 0;
	}
	// skip flooding logs

	va_start(ap, fmt);
	vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
	va_end(ap);

	char new_tag[128];
	snprintf(new_tag, sizeof(new_tag), "AMZ-%s", tag);

	return __android_log_buf_write(LOG_ID_MAIN, ANDROID_LOG_DEBUG, new_tag, buf);
}

int __vitals_log_print(int bufID, int prio, const char *tag, const char *fmt, ...)
{
	va_list ap;
	char buf[LOG_BUF_SIZE];
	int _a = bufID;
	int _b = prio;

	va_start(ap, fmt);
	va_end(ap);

	return __android_log_write(ANDROID_LOG_DEBUG, tag, "__vitals_log_print not implemented");
}
#endif

int __android_log_write(int prio, const char *tag, const char *msg)
{
    struct iovec vec[3];