Open a character device



  • Hai, We created character device in dev/ folder.

    from normal c application to open device in this folder we use open() system call, read the data from that using read().

    my question is from Qt how can I open the device and read the data from that device?

    I tired using QFile, but it is not opened.

    can any one give some example regarding this
    Thanks in advance


  • Moderators

    Is there possibly a permissions problem with the device you created? Is it readable by the user which is running the app?

    Can you show a snippet of your code where you're trying to open and read from the device?



  • @

    QFile *file = new QFile("/dev/fp");
    if(!file->open(QFile::ReadWrite))
    {
    qDebug()<<"file not opened\n";
    }
    @

    this is tested on desktop, but my application is in embedded development board


  • Moderators

    How about the file permissions on /dev/fp are they reasonable for the user?



  • its not readable.


  • Moderators

    Do you need to chmod a+r /dev/fp then?



  • we have already root privileges in dev folder. but when i open from qt its not opened that file any thing different?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.