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/.
Forum Updated to NodeBB v4.3 + New Features

Reading devices under /dev/.

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
16 Posts 4 Posters 4.0k 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.
  • J jigarp

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

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on 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
    0
    • jsulmJ jsulm

      @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 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

      jsulmJ 1 Reply Last reply
      0
      • J jigarp

        @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

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on 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 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?

          jsulmJ 1 Reply Last reply
          0
          • J jigarp

            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?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on 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 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.

              jsulmJ 1 Reply Last reply
              0
              • J jigarp

                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.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on 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
                • Cleiton BuenoC Offline
                  Cleiton BuenoC Offline
                  Cleiton Bueno
                  wrote on 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
                  1
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 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
                    • Cleiton BuenoC Cleiton Bueno

                      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 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???

                      jsulmJ 1 Reply Last reply
                      0
                      • J jigarp

                        @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???

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 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
                        0
                        • jsulmJ jsulm

                          @jigarp Take a look at what @SGaist suggested

                          J Offline
                          J Offline
                          jigarp
                          wrote on last edited by jigarp
                          #15

                          @jsulm @SGaist
                          Not Working..

                          jsulmJ 1 Reply Last reply
                          -1
                          • J jigarp

                            @jsulm @SGaist
                            Not Working..

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on 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

                            • Login

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