混杂设备
#include <linux/miscdevice.h>
- 概念
- 将不容易分类的设备,归纳为混杂设备
- 可以简化编程
- 可以省略设备号,cdev,设备文件的创建
- 数据结构
- struct miscdevice {
- int minor; //设备号
- const char *name; //名字
- const struct file_operations *fops; //操作函数集合
- …
- };
- struct miscdevice {
- 注册函数
- extern int misc_register(struct miscdevice * misc);
- 注销函数
- extern int misc_deregister(struct miscdevice *misc);