The character device driver code can be looked at in the article placed at this location – <character device driver example>.
The below user space sample code is to invoke the device file via the device driver.
The output of the sample code is provided below
The dmesg output indicates that the open, read, write and close operations were performed by the sample code on the device file
Finally, to exit the driver, run “sudo rmmod character_dev” and to remove the Character device file node that was created using mknod operation previously, use “rm command” to delete the device file instance.
Character Device driver – creating device file instance in code
Pingback: Device drivers – character device driver Example | Hitch Hiker's Guide to Learning
Pingback: Character Device driver – creating device file instance in code | Hitch Hiker's Guide to Learning