Commit 7107bf5d authored by spiiroin's avatar spiiroin

[modesetting] Log origin of sysfs writes in debug verbosity. JB#38433

When debugging configuration issues, it is sometimes hard to tell where the
various sysfs control writes are made from.

To ease debugging, log also call site when logging sysfs writes.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent e1dc87e9
......@@ -105,7 +105,8 @@ cleanup:
}
#endif /* LOG_ENABLE_DEBUG */
int write_to_file(const char *path, const char *text)
int write_to_file_real(const char *file, int line, const char *func,
const char *path, const char *text)
{
int err = -1;
int fd = -1;
......@@ -130,7 +131,9 @@ int write_to_file(const char *path, const char *text)
if(log_level >= LOG_DEBUG)
{
char *prev = read_from_file(path, 0x1000);
log_debug("WRITE '%s' : '%s' --> '%s'", path, prev ?: "???", text);
log_debug("%s:%d: %s(): WRITE '%s' : '%s' --> '%s'",
file, line, func,
path, prev ?: "???", text);
free(prev);
}
#endif
......
......@@ -22,7 +22,11 @@
#include "usb_moded-dyn-config.h"
int write_to_file(const char *path, const char *text);
int write_to_file_real(const char *file, int line, const char *func, const char *path, const char *text);
#define write_to_file(path,text)\
write_to_file_real(__FILE__,__LINE__,__FUNCTION__,(path),(text))
int set_mtp_mode(void);
int set_dynamic_mode(void);
void unset_dynamic_mode(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment