当前位置:网站首页>主设备号和次设备号均为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。裂开。。。
边栏推荐
- Analysis on the thinking of college mathematical modeling competition and curriculum education of the 2022a question of the China Youth Cup
- HW notes (II)
- How to write a resume that shines in front of another interviewer [easy to understand]
- PHP implements lottery according to probability
- 2022电工杯A题高比例风电电力系统储能运行及配置分析思路
- Leetcode: interview question 17.24 Maximum cumulative sum of submatrix (to be studied)
- 机械臂速成小指南(十):可达工作空间
- Antd Comment 递归循环评论
- 硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
- opencv第三方库
猜你喜欢
Force buckle ----- path sum III
史上最全MongoDB之Mongo Shell使用
Web service performance monitoring scheme
SSM+jsp实现仓库管理系统,界面那叫一个优雅
CUDA Programming
tflite模型转换和量化
DAB-DETR: DYNAMIC ANCHOR BOXES ARE BETTER QUERIES FOR DETR翻译
Tflite model transformation and quantification
力扣------路径总和 III
Machine learning notes - bird species classification using machine learning
随机推荐
Some common software related
The most complete learning rate adjustment strategy in history LR_ scheduler
Collection of idea gradle Lombok errors
【OA】Excel 文档生成器: Openpyxl 模块
One of oscp tools: dirsearch usage Encyclopedia
机械臂速成小指南(十):可达工作空间
Hangzhou Electric 3711 binary number
SSM+jsp实现仓库管理系统,界面那叫一个优雅
vim —- 自己主动的按钮indent该命令「建议收藏」
Class常量池与运行时常量池
【ArcGIS教程】专题图制作-人口密度分布图——人口密度分析
tflite模型转换和量化
Redis source code learning (31), dictionary learning, dict.c (1)
CUDA Programming
【mysql】mysql中行排序
[record of question brushing] 2 Add two numbers
2022中青杯数学建模B题开放三孩背景下的生育政策研究思路
使用切面实现记录操作日志
PHP 实现根据概率抽奖
[development software] tilipa Developer Software