Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Open a character device
Forum Updated to NodeBB v4.3 + New Features

Open a character device

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Swinetha
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      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?

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Swinetha
        wrote on last edited by
        #3

        @

        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

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mlong
          wrote on last edited by
          #4

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

          Software Engineer
          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Swinetha
            wrote on last edited by
            #5

            its not readable.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mlong
              wrote on last edited by
              #6

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

              Software Engineer
              My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Swinetha
                wrote on last edited by
                #7

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

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved