For more information about linux Device Drivers-general Linux technology-Linux programming and kernel, see the following. The device driver in linux is not as difficult as you think. To write a linux driver, the most important thing is to understand the device to be driven, in many cases, the driver we write is hard to understand the device, which leads to such a bug. When writing a linux driver, the kernel oops error may occur in many cases, this is actually an incorrect address operation, so we need to have a certain understanding of linux memory management, and carefully observe the problems such as address out-of-bounds. Another common problem is that after the application calls the driver, it will find that the kernel does not print any messages, and the application stops. Some seem to be dead, but the application is forcibly suspended, you can still exit. Most of these cases are caused by blocking in the driver, and no event causes the driver to launch a blocking wait state, in this case, you need to find out where the driver is blocked. Some of them are indeed dead, and the external cannot be stopped. That is to say, blocking is adopted and the interrupt cannot respond, in this case, you need to find out where the driver is blocked, and check whether the interrupt is blocked. Most of the time, we do not have any good tools when driving the program. Usually we use the printk statement to print and debug the program in a suspicious place and trace it step by step. Although this is not very efficient, but it can basically solve the problem.
The above is a common situation in the write driver process. If these problems are solved, the driver should work properly. To make the driver better work and fault tolerance, you must have a deep understanding of the features of the device.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.