Printk (KERN_INFO “gpio_keys_gpio_isr()\n”); You can output debugging information during the driver loading phase. However, after the driver is loaded, no output information is displayed on the serial port

In the kernel /

/* We show everything that is MORE important than this.. / #define MINIMUM_CONSOLE_LOGLEVEL 1 / Minimum loglevel we let people use / #define DEFAULT_CONSOLE_LOGLEVEL 7 / anything MORE serious than KERN_DEBUG */

int console_printk[4] = { DEFAULT_CONSOLE_LOGLEVEL, /* console_loglevel / DEFAULT_MESSAGE_LOGLEVEL, / default_message_loglevel / MINIMUM_CONSOLE_LOGLEVEL, / minimum_console_loglevel / DEFAULT_CONSOLE_LOGLEVEL, / default_console_loglevel */ };

The following is a brief introduction to the console log levels. The corresponding log levels of the console are defined as follows: #define MINIMUM_CONSOLE_LOGLEVEL 1 / Minimum log level that can be used / #define DEFAULT_CONSOLE_LOGLEVEL 7 / Messages more important than KERN_DEBUG are printed /

Int console_printk[4] = {DEFAULT_CONSOLE_LOGLEVEL,/ Console log level, messages with priorities higher than this value will be displayed in console / / Default message log level, printk does not define priority, Print messages above this priority/DEFAULT_MESSAGE_LOGLEVEL, / minimum console log level, Minimum console log level that can be set (highest priority)/MINIMUM_CONSOLE_LOGLEVEL, DEFAULT_CONSOLE_LOGLEVEL,/* Default console log level */};

You can run the cat /proc/sys/kernel/printk command to view the values 6, 6, 1, 7. The default console level is the first 6, and the information level you want to output is KERN_INFO(which is exactly 6). If you want to output this information, you can run the following command: Echo “7 6 1 7” > /proc/sys/kernel/printk (KERN_INFO “gpio_keys_gpio_isr()\n”); You can change it to KERN_ERR or something higher.

But without changing the printer level, you can also catch debugging information by cat /proc/kmsg.