pr_info in driver question

Denis Kirjanov dkirjanov at suse.de
Wed Jul 6 04:32:07 EDT 2022



On 7/6/22 10:58, A mp wrote:
> I believe I tried that, I seen a similar solution on stack overflow, something about changing the log level?

That should work since pr_info is just a macro:

/**
  * pr_info - Print an info-level message
  * @fmt: format string
  * @...: arguments for the format string
  *
  * This macro expands to a printk with KERN_INFO loglevel. It uses 
pr_fmt() to
  * generate the format string.
  */
#define pr_info(fmt, ...) \
         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)


and you're setting the log level even higher to DEBUG.
cat /proc/sys/kernel/printk shows you the current log level


> 
> 
> Any other suggestions perhaps?
> 
> Thanks,
> 
> Andrew.
> On Wed, Jul 06, 2022 at 10:53:12AM +0300, Denis Kirjanov wrote:
>>
>>
>> On 7/6/22 09:47, A mp wrote:
>>> Hi everyone,
>>>
>>> My name is Andrew.
>>>
>>> Recently, I went through the Linux Foundations intro to kernel development course. As part of the course, it gets us to put a print statement inside of the uvcvideo driver, recompile the kernel and then load the module and check dmesg for the print statement.
>>>
>>> After several attempts, I was unable to find this print statement inside of dmesg. I know that the modified drier was compiling successfully and my custom kernel was indeed installed but no idea about this pr_info statement.
>>>
>>> I tried this in Ubuntu and Fedora inside of virtualbox. Not sure if that would make any difference.
>>
>> echo "7" > /proc/sys/kernel/printk
>>
>> and make sure that you have your module listed in lsmod
>>
>>>
>>> Thanks,
>>>
>>> Andrew.
>>>
>>>
>>> _______________________________________________
>>> Kernelnewbies mailing list
>>> Kernelnewbies at kernelnewbies.org
>>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



More information about the Kernelnewbies mailing list