I am writing a device driver and have implemented file_operations write method. I would also like to be able to just redirect to the device driver, e.g.:

echo "this text is sent to driver" > /dev/driver_name

I originally assumed this would magically work with the user space message being sent to the .write and the other parameters set accordingly. LDD3 chapter 3 has some code which is pretty similar to mine, and the authors refer to testing/playing around both by invoking the write method directly and by redirecting to the driver (as I desire to do), making me think that I am on the right track. However, when I tried redirecting to the driver, I received a "Permission denied" error and it did nothing.

Any direction/links/suggestions would be greatly appreciated.

  • Do you have permissions to write to the device file? – Ignacio Vazquez-Abrams Apr 3 '18 at 1:23
  • I sudo'd the above echo line. the permissions are crw------- with root as owner. – Jebus Apr 3 '18 at 1:56
  • You ran the echo with superuser privileges, not the shell. – Ignacio Vazquez-Abrams Apr 3 '18 at 1:57
  • ty. How to make a driver install with different permissions? – Jebus Apr 3 '18 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.