Hi,
I can see the prints that uses dev_err if any error is printing
but,I want to print the debug logs that uses dev_dbg as below
dev_dbg(imxmd->md.dev, "subdev %s bound\n", sd->name);
can anyone help me to enable these prints
thanks and regards,
mukesh
dev_dbg is controlled by an debug flag.
1. Turn on the debugging switch: the file you are debugging must include <linux/device.h> or "linux /paltforam_device.h", the latter includes the former, before including this header file, use #define DEBUG 1 to Turn on the debugging switch: for example
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/clk.h>
#include <linux/module.h>
#define DEBUG 1
#include <linux/platform_device.h>
In the linux/device.h file:
#define dev_printk(level, dev, format, arg...) \
printk(level "%s %s: "format, dev_driver_string(dev), (dev)->bus_id, ## arg)
#ifdef DEBUG
#define dev_dbg(dev, format, arg...) \
dev_printk(KERN_DEBUG, dev, format, ## arg)
#else
static inline int __attribute__ ((format (printf, 2, 3)))
dev_dbg(struct device * dev, const char * fmt, ...)
{
return 0;
}
#endif
But after this is turned on, the information cannot be output smoothly, because printk has a default information level.
linux/kernel file
#define KERN_EMERG "<0>" /* system is unusable */
#define KERN_ALERT "<1>" /* action must be taken immediately */
#define KERN_CRIT "<2>" /* critical conditions */
#define KERN_ERR "<3>" /* error conditions */
#define KERN_WARNING "<4>" /* warning conditions */
#define KERN_NOTICE "<5>" /* normal but significant condition */
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */
You can see that KERN_DEBUG is the lowest level.
2. Modify the file kernel/printk file
/* printk's without a loglevel use this.. */
#define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */
/* We show everything that is MORE important than this.. */
#define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */
#define DEFAULT_CONSOLE_LOGLEVEL 8 /* anything MORE serious than KERN_DEBUG */
Among them, DEFAULT_CONSOLE_LOGLEVEL is the lowest level output by the terminal console, and anything more serious will be output. The original value is 7, the debugging information cannot be output, and if it is modified to 8, all the debugging information is output.