lkpdesigners.blogg.se

Creating character device in linux
Creating character device in linux









The devices in UNIX fall in two categories- Character devices and Block devices.

creating character device in linux

The post helps understand how to write a device driver, the significance of a device file and its role in the interaction between a user program and device driver. We will be simulating the functionality of the device in the driver itself (and this is precisely what is done in emulation tools like Daemon Tools, Alcohol etc). If we write any string to the device file represented by the device and then read that file, we get the string written earlier but reversed (for eg., myDev being our device, echo “hello” >/dev/myDev cat /dev/ myDev would print “olleh”).

creating character device in linux

In this post, we would be writing a Linux device driver for a hypothetical character device which reverses any string that is given to it.











Creating character device in linux