Implementing Character Device Driver.
-
Device driver are use to communicate with specific hardware devices.
-
Every Device Driver is module but every module are not device driver.
-
There are three type of Device Driver
- Character device Driver ( device which take and give input and output directly).
- Block Device Driver.
- Network Device Driver.
- USB Device Driver.
-
Module is use for
- To increase the functionality .
- To write system call.
- lsmod : list of module in Kernal.
- modinfo module_name : to see information of module.
- insmod : use to insert .ko (module) file inside the kernal.
- rmmod : Use to remove module from kernal.
All the printk() message is written in a kernal log file ( syslog ). This file is present inn /var/log
You can also see this file using command dmesg
$ make
$ sudo insmod MyFirstDeviceDriver.ko
$ lsmod
$ modinfo MyFirstDeviceDriver.ko
$ sudo rmmod MyFirstDeviceDriver.ko
$ dmesg