Write an implementation of the ioctl function in the file_operations structure to read the input signal of the gpg13 port in gpio

We can use the following code to implement the ioctl function: int ioctl(struct file *file, unsigned int cmd, unsigned long arg){ int retval; unsigned int value; switch (cmd) { case READ_GPIO13: // read the GPIO13 port Input signal retval = gpio_get_value(13); // read value from GPIO13 port value = (unsigned int)retval; if (copy_

Guess you like

Origin blog.csdn.net/weixin_42588555/article/details/129521492