申请设备号:
register_chrdev_region(dev_t first,unsigned int count,char *name)
First :要分配的设备编号范围的初始值(次设备号常设为0);
Count:连续编号范围.
Name:编号相关联的设备名称. (/proc/devices);
动态分配:
Int alloc_chrdev_region(dev_t *dev,unsigned int firstminor,unsigned int count,char *name);
Firstminor : 通常为0;
*dev:存放返回的设备号;
count:连续编号范围.
这个意思说假如major是248,count是2的话,249也就是相当于被使用的了呗
成功返回0,失败返回-1;
释放:
Void unregist_chrdev_region(dev_t first,unsigned int count);
调用cat /proc/devices中能够找到已分配的设备号