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

QProcess & NVRAM

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.1k 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 Offline
    J Offline
    jastmc
    wrote on last edited by
    #1

    I am running Qt4.8 on a Beaglebone. The problem is that I can change the NVRAM in the RTC from the console but cannot do the same thing from Qt with the QProcess command. It seems I cannot write to hardware. What is the issue?

    Regards,
    James

    I can change the contents of the NVRAM on the Beaglebone by running:
    @root@med:~# echo "zzzzzzzzzzzzzzzzzzzzzzzzzzz" > /sys/devices/platform/omap/omap_i2c.3/i2c-3/3-0068/nvram@
    and verify that it has changed with:
    @root@med:~# od -Ax -tx1z -v /sys/devices/platform/omap/omap_i2c.3/i2c-3/3-0068/nvram
    000000 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a >zzzzzzzzzzzzzzzz<
    000010 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 0a 39 63 31 32 >zzzzzzzzzzz.9c12<
    000020 24 20 08 14 00 02 30 10 20 49 10 00 98 00 20 41 >$ ....0. I.... A<
    000030 ac 05 12 04 48 2a 00 00 >....H*..<
    000038@

    However, using QProcess the NVRAM does not seem to be writable to - here is the code:
    @ rtc.start("find /sys -name nvram");
    rtc.waitForStarted();
    rtc.waitForFinished();
    rtcAddr = rtc.readAllStandardOutput().trimmed();
    qDebug() << "RTC File Name = " << QString(rtcAddr).toUtf8();

        rtcString = "echo \"UUUUUUUUUUUUU\" > " + QString(rtcAddr).toUtf8();
        qDebug() << "Clear NVRAM with " << rtcString;
        rtc.start(rtcString);
        rtc.waitForStarted();
        rtc.waitForFinished();
        rtcData = rtc.readAllStandardOutput();
        qDebug() << "RTC Response = " << QString(rtcData).toUtf8();
    
        rtcString = "od -Ax -tx1z -v " + QString(rtcAddr).toUtf8();
        qDebug() << "Verify NVRAM by reading " << rtcString;
        rtc.start(rtcString);
        rtc.waitForStarted();
        rtc.waitForFinished();
        rtcData = rtc.readAllStandardOutput();
        qDebug() << "RAM Contents =  "; qDebug() << rtcData;
    
        rtcString = "echo \"Test String\" > " + QString(rtcAddr).toUtf8();
        qDebug() << "Write RAM with " << rtcString;
        rtc.start(rtcString);
        rtc.waitForStarted();
        rtc.waitForFinished();
        rtcData = rtc.readAllStandardOutput();
        qDebug() << "RTC Response = " << QString(rtcData).toUtf8();
    
        rtcString = "od -Ax -tx1z -v " + QString(rtcAddr).toUtf8();
        qDebug() << "Verify RAM by reading " << rtcString;
        rtc.start(rtcString);
        rtc.waitForStarted();
        rtc.waitForFinished();
        rtcData = rtc.readAllStandardOutput();
        qDebug() << "RTC Response = "; qDebug() << QString(rtcData).toUtf8();
        rtc.close();
    

    @

    And this is what appears on the Output Application window:

    @RTC File Name = "/sys/devices/platform/omap/omap_i2c.3/i2c-3/3-0068/nvram"
    Clear NVRAM with "echo "UUUUUUUUUUUUU" > /sys/devices/platform/omap/omap_i2c.3/i2c-3/3-0068/nvram"
    RTC Response = "UUUUUUUUUUUUU > /sys/devices/platform/omap/omap_i2c.3/i2c-3/3-0068/nvram
    "
    Verify NVRAM by reading "od -Ax -tx1z -v /sys/devices/platform/omap/omap_i2c.3/i2c-3/3-0068/nvram"
    RAM Contents =
    "000000 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a >zzzzzzzzzzzzzzzz<
    000010 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 0a 39 63 31 32 >zzzzzzzzzzz.9c12<
    000020 24 20 08 14 00 02 30 10 20 49 10 00 98 00 20 41 >$ ....0. I.... A<
    000030 ac 05 12 04 48 2a 00 00 >....H*..<
    000038
    "
    Write RAM with "echo "Test String" > /sys/devices/platform/omap/omap_i2c.3/i2c-3/3-0068/nvram"
    RTC Response = "Test String > /sys/devices/platform/omap/omap_i2c.3/i2c-3/3-0068/nvram
    "
    Verify RAM by reading "od -Ax -tx1z -v /sys/devices/platform/omap/omap_i2c.3/i2c-3/3-0068/nvram"
    RTC Response =
    "000000 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a >zzzzzzzzzzzzzzzz<
    000010 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 7a 0a 39 63 31 32 >zzzzzzzzzzz.9c12<
    000020 24 20 08 14 00 02 30 10 20 49 10 00 98 00 20 41 >$ ....0. I.... A<
    000030 ac 05 12 04 48 2a 00 00 >....H*..<
    000038
    " @

    I also tried writing to a file but that did not work either - no file was created. I did that with:
    @ rtcString = "echo "UUUUUUUUUUUUU" > /home/root/echotest";
    qDebug() << "Test ECHO with " << rtcString;
    rtc.start(rtcString);
    rtc.waitForStarted();
    rtc.waitForFinished();
    rtcData = rtc.readAllStandardOutput();
    qDebug() << "RTC Response = " << QString(rtcData).toUtf8();

    @

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hi,
      Move this post to the embedded forum! It's not real a desktop issue now is it?

      Greetz, Jeroen

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        I would say you are not building the command properly. See "QProcess":http://qt-project.org/doc/qt-5/qprocess.html#details details for an example of a command with parameter call.

        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
        0

        • Login

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