0

I'm new on driver programming. So I 'm faced with some "problems".

I wrote a PCI driver. 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. But my file in this directory has no permission for reading or writing except root. So how communicate? Via attribute files?

Manfred
  • 159
  • 5
  • 17
  • Sorry, but this makes no sense. If you wrote the driver, you should have provided the means for an app to communicate with it (that's part of writing the driver). – Ken White Sep 12 '12 at 13:26
  • @KenWhite Of course, sry for the missing information. My purpose is to write a test app for the driver. It's a kind of "basic research" to learn the driver programming. – Manfred Sep 12 '12 at 13:32
  • Again, if you wrote the driver, you should know how the test app needs to communicate with it. Your question makes absolutely no sense. – Ken White Sep 12 '12 at 13:33
  • @KenWhite `Normally I would say over the device file in /dev. But my file in this directory has no permission for reading or writing except root.` – Manfred Sep 12 '12 at 13:40

1 Answers1

2

Using the node in /dev is the correct approach. 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. A better solution is to create a udev rule which matches the ID of your PCI device. Then, you can run the chmod in the rule.

Documentation: Writing udev rules

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
  • Thanks for the answer Isn't there a possibility to do that direct in the driver? – Manfred Sep 12 '12 at 13:57
  • No, because on modern Linux systems, the device node is created by udev. The main reason for this is that the sysadmin can assign special permissions (like certain groups) to a dev node. If that was compiled into your driver, there was no simple way to change that. – Aaron Digulla Sep 12 '12 at 15:50