开发者

printk in driver

开发者 https://www.devze.com 2023-04-08 21:42 出处:网络
I am really new to linux module programming. I开发者_如何学Go need to some how be able to do some tweak to the ath9k driver in linux.

I am really new to linux module programming. I开发者_如何学Go need to some how be able to do some tweak to the ath9k driver in linux. I finally got the compat wireless source code of ath9k to compile in ubuntu 11.04 and was trying to play around with the code. I tried using printk to tried to get to see what happen. First I put printk in the init.c file, the message I printed show up when I use dmesg in the terminal. However, when I tried to use the same printk in another file like rc.c it does not show up at all. I am wondering why is that? And is there some other way that I could some how log some information from the code similar to the fprintf. What I need is I need to extract somehow the packet header from the driver.

Thank you Best Regards.


read about the proc fs, it's a great framework to extract data from device drivers. once you have registered a device node as proc fs, you can read from it. once the the read function is called, a callback function you defined is creating the output. this is an excellent way to retrieve data from device.

there are also two other methods, one is sysfs, you can google for it. and the second, if the the device is a char device, you can implement an ioctrl function which returns the info you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号