Find the answer to your Linux question:
Results 1 to 2 of 2
Can we use fifos for transfering data from device driver to an user application?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    13

    Can we use fifos for transfering data from device driver to an user ap


    Can we use fifos for transfering data from device driver to an user application?

  2. #2
    Linux User
    Join Date
    Nov 2008
    Location
    Tokyo, Japan
    Posts
    260
    Yes you can use FIFO's for that purpose. However it is not necessary.

    You can just read the device driver file directly. For example:
    Code:
    hexdump /dev/random
    Using a FIFO in between the application and the device file is just adding an extra complication.

    If you are writing a script to access data from a driver like "/dev/audio", you may need set the group identity of the script file using "chgrp audio script.file", and then "chmod" the "setgid" permissions bit of the script file using "chmod g+s script.file. If you do this, executing the script will allow you to access the device file as a member of that group. Be careful of security, you may not want all users of that group to be able to use that script -- it depends on the purpose of your script.

    If you want to use a program like "tee" to read data from a device and copy it to more than one FIFO so many applications can receive the same data, just keep in mind that "tee" needs to buffer the data it sends, and it will not read another buffer-full of data from your device until every FIFO has read its data from "tee", and this means the data access to all programs will be as slow as the slowest program reading it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •