diff --git a/src/usb_moded-modesetting.c b/src/usb_moded-modesetting.c index 31445ca..adc3805 100644 --- a/src/usb_moded-modesetting.c +++ b/src/usb_moded-modesetting.c @@ -105,7 +105,8 @@ static char *read_from_file(const char *path, size_t maxsize) } #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 diff --git a/src/usb_moded-modesetting.h b/src/usb_moded-modesetting.h index 249f5a5..73af9ef 100644 --- a/src/usb_moded-modesetting.h +++ b/src/usb_moded-modesetting.h @@ -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);