Character device driver sample user space code

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.

Sample User space code

The output of the sample code is provided below

write and read operation from the driver device file

The dmesg output indicates that the open, read, write and close operations were performed by the sample code on the device file

Character device file output after running sample application

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

Comments

  1. Pingback: Device drivers – character device driver Example | Hitch Hiker's Guide to Learning

  2. Pingback: Character Device driver – creating device file instance in code | Hitch Hiker's Guide to Learning

Leave a Reply

Your email address will not be published. Required fields are marked *