Search code examples
clinux-kernelprintk

printk outputs only timestamp and does not print the message


I can't see any effect of the printk except the timestamp:

enter image description here

The first line was printed by the dev_xxx macro in a driver.

The print (I simply want to see the converted values as I have some problems with it)

void touchscreen_report_pos(struct input_dev *input,
                const struct touchscreen_properties *prop,
                unsigned int x, unsigned int y,
                bool multitouch)
{
    touchscreen_apply_prop_to_x_y(prop, &x, &y);
    printk(KERN_WARNING, "AFTER: x:%u y:%u\n", x, y); 
    input_report_abs(input, multitouch ? ABS_MT_POSITION_X : ABS_X, x);
    input_report_abs(input, multitouch ? ABS_MT_POSITION_Y : ABS_Y, y);
}

Settings

root@myboard:~# cat /proc/sys/kernel/printk
7       4       1       7

printk enabled in kernel configuration:

enter image description here

Any clues?


Solution

  • As the documentation say:

    the log level is not a separate argument

    [Emphasis mine]

    Since you pass the loglevel as a separate argument, that will be the whole format string, and nothing will be printed.

    Change to

    printk(KERN_WARNING "AFTER: x:%u y:%u\n", x, y); 
    //                 ^
    // Note no comma here