Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Reading devices under /dev/.

Reading devices under /dev/.

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
16 Posts 4 Posters 3.8k Views
  • 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.
  • J Offline
    J Offline
    jigarp
    wrote on 22 Mar 2018, 10:07 last edited by jigarp
    #3

    It is like RPMSG device used for communication between multiple core for linux kernel.
    I'm using linux kernel 4.9.59 .

    J 1 Reply Last reply 22 Mar 2018, 10:12
    0
    • J jigarp
      22 Mar 2018, 10:07

      It is like RPMSG device used for communication between multiple core for linux kernel.
      I'm using linux kernel 4.9.59 .

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 22 Mar 2018, 10:12 last edited by
      #4

      @jigarp OK, I don't know about it. I don't think it is really a Qt related topic. Is there any documentation for this device? Any examples in C/C++?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply 22 Mar 2018, 10:19
      0
      • J jsulm
        22 Mar 2018, 10:12

        @jigarp OK, I don't know about it. I don't think it is really a Qt related topic. Is there any documentation for this device? Any examples in C/C++?

        J Offline
        J Offline
        jigarp
        wrote on 22 Mar 2018, 10:19 last edited by jigarp
        #5

        @jsulm
        This link provides information for linux drivers
        https://www.kernel.org/doc/Documentation/rpmsg.txt

        This will provide interface for Ti processors
        http://processors.wiki.ti.com/index.php/PRU-ICSS_Remoteproc_and_RPMsg
        http://processors.wiki.ti.com/index.php/PRU-ICSS_Rpmsg_Driver

        It is a kind of charcter device.
        I'm able to write it using QFile
        don't know how to read.

        Sample for linux userspace commands

        echo Hello > /dev/rpmsg*
        cat /dev/rpmsg*
        C^
        

        Can you provide details for how to read and write Character Device.

        Thank you

        J 1 Reply Last reply 22 Mar 2018, 11:13
        0
        • J jigarp
          22 Mar 2018, 10:19

          @jsulm
          This link provides information for linux drivers
          https://www.kernel.org/doc/Documentation/rpmsg.txt

          This will provide interface for Ti processors
          http://processors.wiki.ti.com/index.php/PRU-ICSS_Remoteproc_and_RPMsg
          http://processors.wiki.ti.com/index.php/PRU-ICSS_Rpmsg_Driver

          It is a kind of charcter device.
          I'm able to write it using QFile
          don't know how to read.

          Sample for linux userspace commands

          echo Hello > /dev/rpmsg*
          cat /dev/rpmsg*
          C^
          

          Can you provide details for how to read and write Character Device.

          Thank you

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 22 Mar 2018, 11:13 last edited by
          #6

          @jigarp You read like any other file

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • J Offline
            J Offline
            jigarp
            wrote on 22 Mar 2018, 11:49 last edited by
            #7

            In this way i'm trying to write data to rpmsg

            QFile armIpcWriteMsg("/dev/rpmsg_pru30");
            QTextStream outstream(&armIpcWriteMsg);
            qDebug() << "Writing PRU Data";
            if(armIpcWriteMsg.open(QIODevice::WriteOnly))
            {
                outstream << "Hello";
            armIpcWriteMsg.close();
            }
            

            In this way i'm trying to read.

            QFile armIpcReadMsg("/dev/rpmsg_pru30");
            if(armIpcReadMsg.exists())
            {
                if(armIpcReadMsg.open(QIODevice::ReadOnly | QIODevice::Unbuffered))
                {
                    char buff[20];
            
                    armIpcReadMsg.read(buff,1);
                    qDebug() << "PRU2ARM:" << buff;
                    armIpcReadMsg.close();
                }
            }
            

            Is it the right way?

            J 1 Reply Last reply 22 Mar 2018, 13:14
            0
            • J jigarp
              22 Mar 2018, 11:49

              In this way i'm trying to write data to rpmsg

              QFile armIpcWriteMsg("/dev/rpmsg_pru30");
              QTextStream outstream(&armIpcWriteMsg);
              qDebug() << "Writing PRU Data";
              if(armIpcWriteMsg.open(QIODevice::WriteOnly))
              {
                  outstream << "Hello";
              armIpcWriteMsg.close();
              }
              

              In this way i'm trying to read.

              QFile armIpcReadMsg("/dev/rpmsg_pru30");
              if(armIpcReadMsg.exists())
              {
                  if(armIpcReadMsg.open(QIODevice::ReadOnly | QIODevice::Unbuffered))
                  {
                      char buff[20];
              
                      armIpcReadMsg.read(buff,1);
                      qDebug() << "PRU2ARM:" << buff;
                      armIpcReadMsg.close();
                  }
              }
              

              Is it the right way?

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 22 Mar 2018, 13:14 last edited by
              #8

              @jigarp Should be OK. Did you try it out?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jigarp
                wrote on 22 Mar 2018, 13:33 last edited by
                #9

                I've tried it.
                I'm able to write successfully.

                But while trying to read file it waits until data became available.
                I wan't to check for data availability before reading that file.

                I've tried QFileinfo by monitoring its size but it is always zero.
                Is there any way to check for ready read.

                J 1 Reply Last reply 22 Mar 2018, 13:49
                0
                • J jigarp
                  22 Mar 2018, 13:33

                  I've tried it.
                  I'm able to write successfully.

                  But while trying to read file it waits until data became available.
                  I wan't to check for data availability before reading that file.

                  I've tried QFileinfo by monitoring its size but it is always zero.
                  Is there any way to check for ready read.

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 22 Mar 2018, 13:49 last edited by
                  #10

                  @jigarp I don't think there is anything in Qt for that.
                  I see two possibilities:

                  1. Use a second thread where you call read()
                  2. Use C API call select() (see man select)

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    Cleiton Bueno
                    wrote on 22 Mar 2018, 14:25 last edited by
                    #11

                    I agree!

                    Create a separate thread to handle the device, use (select () or poll ()) and signals to notify other classes or get to the GUI.

                    J 1 Reply Last reply 23 Mar 2018, 03:55
                    1
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 22 Mar 2018, 21:16 last edited by
                      #12

                      Hi,

                      QFileSystemWatcher might be of interest.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      2
                      • C Cleiton Bueno
                        22 Mar 2018, 14:25

                        I agree!

                        Create a separate thread to handle the device, use (select () or poll ()) and signals to notify other classes or get to the GUI.

                        J Offline
                        J Offline
                        jigarp
                        wrote on 23 Mar 2018, 03:55 last edited by jigarp
                        #13

                        @Cleiton-Bueno @jsulm
                        In my case i'm reading this file in a thread but there are some more work involved so it is necessory to check whether data available or not.I can not wait until data available.
                        Is there any way to check data available like size or any other.
                        File.size() always responds with 0

                        Create a separate thread to handle the device, use (select () or poll ()) and signals to notify other classes or get to the GUI.
                        

                        How to use Can you provide any samples???

                        J 1 Reply Last reply 23 Mar 2018, 06:58
                        0
                        • J jigarp
                          23 Mar 2018, 03:55

                          @Cleiton-Bueno @jsulm
                          In my case i'm reading this file in a thread but there are some more work involved so it is necessory to check whether data available or not.I can not wait until data available.
                          Is there any way to check data available like size or any other.
                          File.size() always responds with 0

                          Create a separate thread to handle the device, use (select () or poll ()) and signals to notify other classes or get to the GUI.
                          

                          How to use Can you provide any samples???

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 23 Mar 2018, 06:58 last edited by
                          #14

                          @jigarp Take a look at what @SGaist suggested

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          J 1 Reply Last reply 23 Mar 2018, 10:44
                          0
                          • J jsulm
                            23 Mar 2018, 06:58

                            @jigarp Take a look at what @SGaist suggested

                            J Offline
                            J Offline
                            jigarp
                            wrote on 23 Mar 2018, 10:44 last edited by jigarp
                            #15

                            @jsulm @SGaist
                            Not Working..

                            J 1 Reply Last reply 23 Mar 2018, 11:33
                            -1
                            • J jigarp
                              23 Mar 2018, 10:44

                              @jsulm @SGaist
                              Not Working..

                              J Offline
                              J Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on 23 Mar 2018, 11:33 last edited by
                              #16

                              @jigarp said in Reading devices under /dev/.:

                              Not Working..

                              Well, with such information it is impossible to say why it is not working.
                              Can you show what you tried and what the result was?

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0

                              12/16

                              22 Mar 2018, 21:16

                              • Login

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