printk 只输出时间戳,不打印消息

问题描述 投票:0回答:1

除了时间戳之外,我看不到

printk
的任何效果:

第一行是由驱动程序中的

dev_xxx
宏打印的。

打印(我只是想查看转换后的值,因为我有一些问题)

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);
}

设置

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

printk
在内核配置中启用:

有什么线索吗?

c linux-kernel printk
1个回答
0
投票

正如文档所说:

日志级别不是一个单独的参数

[强调我的]

由于您将日志级别作为单独的参数传递,因此这将是整个格式字符串,并且不会打印任何内容。

更改为

printk(KERN_WARNING "AFTER: x:%u y:%u\n", x, y); 
//                 ^
// Note no comma here
© www.soinside.com 2019 - 2024. All rights reserved.