当前位置:网站首页>主设备号和次设备号均为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。裂开。。。
边栏推荐
- Termux set up the computer to connect to the mobile phone. (knock the command quickly), mobile phone termux port 8022
- Use facet to record operation log
- Kotlin Android 环境搭建
- Preprocessing - interpolation
- ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be installed directly
- 2022年电工杯B 题 5G 网络环境下应急物资配送问题思路分析
- How to manage the expiration of enterprise distribution certificates- How to manage Enterprise Distribution certificate expiration?
- golang 根据生日计算星座和属相
- Class常量池与运行时常量池
- One of oscp tools: dirsearch usage Encyclopedia
猜你喜欢

Surpassing postman, the new generation of domestic debugging tool apifox is elegant enough to use

接口自动化测试实践指导(中):接口测试场景有哪些

Quick completion guide of manipulator (10): accessible workspace

【系统管理】清理任务栏的已删除程序的图标缓存

Food Chem | in depth learning accurately predicts food categories and nutritional components based on ingredient statements

Kbone与小程序跨端开发的一些思考

史上最全MongoDB之安全认证

2022中青杯C题城市交通思路分析

5年自动化测试,终于进字节跳动了,年薪30w其实也并非触不可及

Kotlin Android environment construction
随机推荐
cuda编程
【自动化经验谈】自动化测试成长之路
【OA】Excel 文档生成器: Openpyxl 模块
PHP implements lottery according to probability
Redis source code learning (30), dictionary learning, dict.h
Unity3D在一建筑GL材料可以改变颜色和显示样本
True Global Ventures新成立的1.46亿美元后续基金关账,其中普通合伙人认缴6,200万美元以对后期阶段的Web3赢家进行投资
史上最全MongoDB之部署篇
Create commonly used shortcut icons at the top of the ad interface (menu bar)
One of oscp tools: dirsearch usage Encyclopedia
使用 TiDB Lightning 恢复 GCS 上的备份数据
pyqt5 失焦 监听无操作 定时器
UltraEdit-32 温馨提示:右协会,取消 bak文件[通俗易懂]
HW notes (II)
Binary, octal, hexadecimal
Redis source code learning (31), dictionary learning, dict.c (1)
手机号国际区号JSON格式另附PHP获取
Redis源码学习(30),字典学习,dict.h
[written to the person who first published the paper] common problems in writing comprehensive scientific and Technological Papers
Triple half circle progress bar, you can use it directly