QProcess & NVRAM



  • 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();

    @



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


  • Lifetime Qt Champion

    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.


Log in to reply
 

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