how to redirect from stdin to dev driver

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












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.







share|improve this question






















  • Do you have permissions to write to the device file?
    – Ignacio Vazquez-Abrams
    Apr 3 at 1:23










  • I sudo'd the above echo line. the permissions are crw------- with root as owner.
    – Jebus
    Apr 3 at 1:56










  • You ran the echo with superuser privileges, not the shell.
    – Ignacio Vazquez-Abrams
    Apr 3 at 1:57










  • ty. How to make a driver install with different permissions?
    – Jebus
    Apr 3 at 2:08














up vote
0
down vote

favorite












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.







share|improve this question






















  • Do you have permissions to write to the device file?
    – Ignacio Vazquez-Abrams
    Apr 3 at 1:23










  • I sudo'd the above echo line. the permissions are crw------- with root as owner.
    – Jebus
    Apr 3 at 1:56










  • You ran the echo with superuser privileges, not the shell.
    – Ignacio Vazquez-Abrams
    Apr 3 at 1:57










  • ty. How to make a driver install with different permissions?
    – Jebus
    Apr 3 at 2:08












up vote
0
down vote

favorite









up vote
0
down vote

favorite











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.







share|improve this question














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.









share|improve this question













share|improve this question




share|improve this question








edited Apr 3 at 0:59

























asked Apr 3 at 0:47









Jebus

114




114











  • Do you have permissions to write to the device file?
    – Ignacio Vazquez-Abrams
    Apr 3 at 1:23










  • I sudo'd the above echo line. the permissions are crw------- with root as owner.
    – Jebus
    Apr 3 at 1:56










  • You ran the echo with superuser privileges, not the shell.
    – Ignacio Vazquez-Abrams
    Apr 3 at 1:57










  • ty. How to make a driver install with different permissions?
    – Jebus
    Apr 3 at 2:08
















  • Do you have permissions to write to the device file?
    – Ignacio Vazquez-Abrams
    Apr 3 at 1:23










  • I sudo'd the above echo line. the permissions are crw------- with root as owner.
    – Jebus
    Apr 3 at 1:56










  • You ran the echo with superuser privileges, not the shell.
    – Ignacio Vazquez-Abrams
    Apr 3 at 1:57










  • ty. How to make a driver install with different permissions?
    – Jebus
    Apr 3 at 2:08















Do you have permissions to write to the device file?
– Ignacio Vazquez-Abrams
Apr 3 at 1:23




Do you have permissions to write to the device file?
– Ignacio Vazquez-Abrams
Apr 3 at 1:23












I sudo'd the above echo line. the permissions are crw------- with root as owner.
– Jebus
Apr 3 at 1:56




I sudo'd the above echo line. the permissions are crw------- with root as owner.
– Jebus
Apr 3 at 1:56












You ran the echo with superuser privileges, not the shell.
– Ignacio Vazquez-Abrams
Apr 3 at 1:57




You ran the echo with superuser privileges, not the shell.
– Ignacio Vazquez-Abrams
Apr 3 at 1:57












ty. How to make a driver install with different permissions?
– Jebus
Apr 3 at 2:08




ty. How to make a driver install with different permissions?
– Jebus
Apr 3 at 2:08















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f435165%2fhow-to-redirect-from-stdin-to-dev-driver%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f435165%2fhow-to-redirect-from-stdin-to-dev-driver%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay