Linux driver中device_create()
来源:互联网 发布:r高性能编程 pdf 编辑:程序博客网 时间:2024/06/05 16:33
转自 http://blog.csdn.net/bailyzheng/article/details/8046801
使用内核版本Linux 2.6.32
通过驱动模块的加载在/dev下创建设备文件,在驱动模块卸载时又自动的删除在/dev下创建的设备文件非常方便。而这个过程就是通过device_create()和device_destroy()内核函数完成的,在Linux2.6.27之前是class_device_create()和class_device_destroy()。最近在开发过程中发现device_create()参数使用很灵活,一不小心就会导致加载时内核报oops错误(vsnprintf引起)。google上搜到的一些文章也有着问题。如如下使用就会出错:
device_create(my_class, NULL, MKDEV(major,minor), "hello" "%d",0);
在"hello" "%d"之间加上“,”能解决insmod 时oops错误,但是还是不能在/dev目录下创建想要的设备文件。正确的调用方法如下:
device_create(my_class, NULL, MKDEV(major,minor), NULL,"hello%d",0);
本篇文章来源于 Linux公社网站(www.linuxidc.com) 原文链接:http://www.linuxidc.com/Linux/2011-09/42836.htm
0 0
- Linux driver中device_create()
- Linux driver中device_create()
- 关于Linux driver中device_create()使用的注意事项
- 关于Linux driver中device_create()使用的注意事项
- 关于Linux driver中device_create()使用的注意事项
- linux device_create/__iomem
- device_create
- device_create
- device_create
- linux中serial driver理解
- linux-2.6.35内核版本中class_create()和device_create的使用
- linux-2.6.35下class_create(),device_create解析
- Linux Driver中阻塞与非阻塞
- Linux driver
- linux driver
- Linux Driver
- linux driver
- linux kernel, driver, network driver
- device_create ()详解
- Beyond Compare添加右键快捷方式
- poj 2226Muddy Fields
- POJ 2031 Building a Space Station(最小生成树)
- 为《31天成为IT服务达人》征求正式名字
- Linux driver中device_create()
- java代码 解析EXCEL(二)
- Cocos2dx-3.2自带例子的运行
- 最近公共祖先(LCA)
- Notepad++ 多行一起编辑
- Flex 弹出窗口
- C语言入门——C语言学习日志3
- 在网页中添加音乐
- hadoop 2.4.1 集群安装二