Linux 字符设备驱动入门
Linux 字符设备驱动入门
难度:入门。本文为中文技术整理,保留来源中的技术边界;示例只用于阅读,未在本服务器执行。
字符设备通过 file_operations 连接用户空间。read/write 必须使用用户空间拷贝函数,退出路径要按创建逆序释放资源。
示例
static const struct file_operations fops = {
.owner = THIS_MODULE,
.read = demo_read,
};
来源
- https://docs.kernel.org/driver-api/
Linux 字符设备驱动入门
https://blog.529808.xyz//archives/tech-3a0b2ea3090e