Character device, multi-device support, LED practical operation

github Source: https://github.com/gaoyang3513/Drivers

The core idea: the same type of device (the LED, character devices) using the same primary device number, device number is used to distinguish between specific times child device.

Which will involve: inode, dev_t, fops of knowledge, specifically refer to my article: https://www.cnblogs.com/gaoyang3513/p/10949207.html

Process Description:
Register the system a plurality of character devices (alloc_chrdev_region, cdev_init, cdev_add);
create a device node;
when the application calls the Open to open a node, passed in the inode, to the corresponding apparatus according to the apparatus identification number;
the other device operation (iOctl, read, write).

Guess you like

Origin www.cnblogs.com/gaoyang3513/p/10961128.html