In this recipe, we will see how to add custom commands to configure or manage our peripheral in a very customized manner.
Using ioctl() for custom commands
Getting ready
Now, in order to present a simple example about how we can implement an ioctl() system call within our driver, we can still use the chrdev driver presented earlier, where we add the unlocked_ioctl() method, as explained later.
How to do it...
Let's see how to do it by following these steps:
- First of all, we have to add the unlocked_ioctl() method within the chrdev_fops structure:
static const struct...