-
Notifications
You must be signed in to change notification settings - Fork 4
Enabling Driver Debug Messages
One easy way of debugging the Linux driver is to enable the dev_dbg messages that are coded into the driver to help understand the flow of logic. The messages are facilitated by the printk function used as a basis for kernel logging.
The prints messages from the kernel are based on levels. Error messages are sent using the dev_err symbol and are sent at level 3. Messages that are considered informative are sent using dev_info at level 6. The dev_dbg messages are not typically enabled during normal operation of the driver so enabling these messages are required.
The main mechanism used to enable these messages is adding a debug statement to the very top of the Linux driver before compiling.
#define DEBUG /* Can be added to the driver to get dev_dbg messages, first line */
Don't forget to remove the DEBUG statement before production.