当前位置:网站首页>主设备号和次设备号均为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。裂开。。。
边栏推荐
- 2022年电工杯B 题 5G 网络环境下应急物资配送问题思路分析
- 二叉搜索树的实现
- [MySQL] row sorting in MySQL
- NoSQL之Redis配置与优化
- web服务性能监控方案
- 硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
- 机械臂速成小指南(十):可达工作空间
- Surpassing postman, the new generation of domestic debugging tool apifox is elegant enough to use
- 高薪程序员&面试题精讲系列120之Redis集群原理你熟悉吗?如何保证Redis的高可用(上)?
- 機器人(自動化)課程的持續學習-2022-
猜你喜欢
![[coded font series] opendyslexic font](/img/5e/e1512ffe494b5d0e7d6d6765644126.png)
[coded font series] opendyslexic font

SSM+JSP实现企业管理系统(OA管理系统源码+数据库+文档+PPT)

硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件

如何检测mysql代码运行是否出现死锁+binlog查看
![[record of question brushing] 2 Add two numbers](/img/3b/f8fec79dc2b5088ac57f8d7a18aea6.png)
[record of question brushing] 2 Add two numbers
![[system management] clear the icon cache of deleted programs in the taskbar](/img/cc/7aff85f1a33ef390623652eadb6f03.png)
[system management] clear the icon cache of deleted programs in the taskbar

opencv第三方库

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

SQL injection -day15

Class常量池与运行时常量池
随机推荐
NoSQL之Redis配置与优化
ABAP 動態內錶分組循環
Operational amplifier application summary 1
Do you choose pandas or SQL for the top 1 of data analysis in your mind?
Golang compresses and decompresses zip files
使用Thread类和Runnable接口实现多线程的区别
【mysql】mysql中行排序
Analysis on urban transportation ideas of 2022 Zhongqing cup C
Use dumping to back up tidb cluster data to GCS
使用 Dumpling 备份 TiDB 集群数据到 GCS
Imitate Tengu eating the moon with Avatar
AVL树插入操作与验证操作的简单实现
Formation continue en robotique (automatisation) - 2022 -
The most complete learning rate adjustment strategy in history LR_ scheduler
【ArcGIS教程】专题图制作-人口密度分布图——人口密度分析
POJ training plan 2253_ Frogger (shortest /floyd)
中青杯2022A题高校数学建模竞赛与课程教育思路分析
CUDA Programming
leetcode:面试题 17.24. 子矩阵最大累加和(待研究)
Redis source code learning (30), dictionary learning, dict.h