当前位置:网站首页>主设备号和次设备号均为0
主设备号和次设备号均为0
2022-07-06 21:42:00 【火红色祥云】
如题
驱动模块装载后,打印的字符设备的主设备号和次设备号均为0
原因
代码问题
问题代码
st_ap3216cDev.dev_id = alloc_chrdev_region(&st_ap3216cDev.dev_id,0,1,NAME);
st_ap3216cDev.major = MAJOR(st_ap3216cDev.dev_id);
st_ap3216cDev.minor = MINOR(st_ap3216cDev.dev_id);
printk("Major:%d minor:%d\n",st_ap3216cDev.major,st_ap3216cDev.minor);
看着好像没什么问题
其实代码应该为:
alloc_chrdev_region(&st_ap3216cDev.dev_id,0,1,NAME);
st_ap3216cDev.major = MAJOR(st_ap3216cDev.dev_id);
st_ap3216cDev.minor = MINOR(st_ap3216cDev.dev_id);
printk("Major:%d minor:%d\n",st_ap3216cDev.major,st_ap3216cDev.minor);
- 设备号申请成功后,返回值为0,把返回值有赋值为设备号变量,所以打印的注射号和次设备号为0。裂开。。。
边栏推荐
- 1.19.11.SQL客户端、启动SQL客户端、执行SQL查询、环境配置文件、重启策略、自定义函数(User-defined Functions)、构造函数参数
- True Global Ventures新成立的1.46亿美元后续基金关账,其中普通合伙人认缴6,200万美元以对后期阶段的Web3赢家进行投资
- 接口自动化测试实践指导(中):接口测试场景有哪些
- leetcode:面试题 17.24. 子矩阵最大累加和(待研究)
- Arduino droplet detection
- cuda编程
- On file uploading of network security
- Class常量池与运行时常量池
- Use dumping to back up tidb cluster data to GCS
- 5年自动化测试,终于进字节跳动了,年薪30w其实也并非触不可及
猜你喜欢
DAB-DETR: DYNAMIC ANCHOR BOXES ARE BETTER QUERIES FOR DETR翻译
【编码字体系列】OpenDyslexic字体
Operational amplifier application summary 1
【knife-4j 快速搭建swagger】
Kbone与小程序跨端开发的一些思考
Arduino droplet detection
Antd Comment 递归循环评论
【OA】Excel 文档生成器: Openpyxl 模块
Ggplot facet detail adjustment summary
Formation continue en robotique (automatisation) - 2022 -
随机推荐
Arduino droplet detection
2022 electrician cup a question high proportion wind power system energy storage operation and configuration analysis ideas
使用 Dumpling 备份 TiDB 集群数据到 GCS
史上最全学习率调整策略lr_scheduler
高薪程序员&面试题精讲系列120之Redis集群原理你熟悉吗?如何保证Redis的高可用(上)?
Using thread class and runnable interface to realize the difference between multithreading
Food Chem|深度学习根据成分声明准确预测食品类别和营养成分
[leetcode]Spiral Matrix II
如何检测mysql代码运行是否出现死锁+binlog查看
Kbone与小程序跨端开发的一些思考
Force buckle ----- path sum III
Class constant pool and runtime constant pool
史上最全MongoDB之安全认证
Enter the rough outline of the URL question (continuously updated)
Antd comment recursive loop comment
学习使用js把两个对象合并成一个对象的方法Object.assign()
EasyUI export excel cannot download the method that the box pops up
The most complete security certification of mongodb in history
Continuous learning of Robotics (Automation) - 2022-
Redis源码学习(30),字典学习,dict.h