Interactivity with IOCTL
A more useful way to interact with the driver
static ssize_t ioctl_handler(struct file *file, unsigned int cmd, unsigned long arg) {
printk("Command: %d; Argument: %d", cmd, arg);
return 0;
}#include <sys/ioctl.h>
// [...]
ioctl(fd, 0x100, 0x12345678); // data is a stringstatic struct file_operations fops = {
.ioctl = ioctl_handler
};Last updated
Was this helpful?