简体   繁体   English

Linux如何与PCI驱动程序通信

[英]Linux How to communicate with a PCI driver

I'm new on driver programming. 我是驱动程序编程的新手。 So I 'm faced with some "problems". 所以我遇到了一些“问题”。

I wrote a PCI driver. 我写了一个PCI驱动程序。 The question is now How can a app communicate with this driver. 问题是现在应用程序如何与此驱动程序通信。

My purpose is to write a test app for the driver. 我的目的是为驱动程序编写测试应用程序。 It's a kind of "basic research" to learn the driver programming. 这是学习驱动程序编程的一种“基础研究”。

Normally I would say over the device file in /dev . 通常我会说/dev的设备文件。 But my file in this directory has no permission for reading or writing except root. 但是我在此目录中的文件除了root之外没有读取或写入权限。 So how communicate? 怎么沟通? Via attribute files? 通过属性文件?

Using the node in /dev is the correct approach. 使用/dev的节点是正确的方法。 What you need to do is to fix the permissions. 您需要做的是修复权限。

You can do that using chmod but you'll have to do that every time you reboot. 您可以使用chmod执行此操作,但每次重新启动时都必须这样做。 A better solution is to create a udev rule which matches the ID of your PCI device. 更好的解决方案是创建一个与PCI设备ID匹配的udev规则。 Then, you can run the chmod in the rule. 然后,您可以在规则中运行chmod

Documentation: Writing udev rules 文档: 编写udev规则

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM