Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am trying to learn how to write a device driver for an input device. As a start I tried to understand the actual device driver code written for linux 2.6.9 kernel. It is always good to follow masters in programming . I understood some parts of the code . But I got stuck with some library functions and macros . Hope you masters can shed some light in to my doubts.
1. What is time_after() function ? It is used in the actual serial mouse driver for kernel 2.6.9. Below given is the line where it is used
if (time_after(jiffies, my_mouse->last + HZ/10))
my_mouse->count = 0;
I tried to get the logic behind the line but I failed to do so . I read that jiffies is a global variable that increase with every time tick starting from system log on. Can anybody help me to understand the logic behind this line.
2. There is a mouse connect function which is called whenever we connect a serial mouse to the serial port. The function takes two arguments, a pointer to struct serio and struct serio_drv. This struct serio pointer is used throughout the connect function but we are not initializing it anywhere. So What I understand is that when we connect the serial mouse the input sub system automatically initializes this structure with the details of the mouse we connected so that the driver program can use these details to select the protocol and type of mouse. I just want a conformation from you that what I understand is right (I hope so) .
3. in serio.h headerfile there are some macros defined. like
In the both definition the label UL is used which I believe(?) stands for unsigned long. What my doubt is that why ff (small letter) and FF(capital letter ) is used . What is the difference between these two .
Sorry if the way I asked my questine is not right. My english is not that great. Can anyone help me to understand these points. Thanking you...
Thanks for the quick replay. But my problem was not how to find where are these macros and function defined. What I want to know is that what they are meant by in my context, say serial mouse. Again thanking for the replay.