Results 1 to 6 of 6

Thread: Qt4/C++ - QProcess output to QList<uint>

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Oct 2006
    Posts
    105
    Thanks
    13
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt4/C++ - Qprocess and piping values of a QList<uint>

    Hello,

    I'm getting somewhere with QProcess.write, but.....

    I use 'i2cdump -y -f 1 0x50 c' to check the eeprom. I can write data to the eeprom,
    but nothing shows until a powerdown and boot, a soft reboot does not update.
    Qt Code:
    1. uint num = 0xac; //172;
    2. int8_t _bytes [1] {0x0A}; //line feed
    3.  
    4. process->start("eeprog-tear -f -16 -w 0xc2 -t 5 /dev/i2c-1 0x50");
    5.  
    6. process->write(QString::number(num).toLocal8Bit()); //writes 31 37 32
    7. process->write((char *)_bytes, 1); //line feed
    8.  
    9. fflush(stdout);
    10. process->waitForBytesWritten();
    11.  
    12. process->waitForFinished();
    13. p_stdOut = process->readAllStandardOutput();
    14. qDebug() << "99 - " << p_stdOut;
    15. p_stdErr = process->readAllStandardError();
    16. qDebug() << "100 - " << p_stdErr;
    17. process->close();//->terminate();
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. i2cdump -y -f 1 0x50 c
    2. 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
    3. ...
    4. b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    5. c0: ff ff 31 37 32 0a ff ff ff ff ff ff ff ff ff ff ..172?..........
    6. d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
    7. ...
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. Output:-
    2. 99 - ""
    3. 100 - "eeprog 0.7.6-tear12, a 24Cxx EEPROM reader/writer
    4. Copyright (c) 2003-2004 by Stefano Barbato - All rights reserved.
    5. Copyright (c) 2011 by Kris Rusocki - All rights reserved.
    6. Bus: /dev/i2c-1, Address: 0x50, Mode: 16bit
    7. Operation: write at offset 194, Input file: <stdin>
    8. Write cycle time: 5 milliseconds
    9. Writing <stdin> starting at address 0xc2
    To copy to clipboard, switch view to plain text mode 

    The GUI I'm running from becomes un-responsive for about the same time as it would normally take to write the total eeprom.
    I'm guessing that I'm not appplying the line feed properly.

    Any suggestions would be greatly appreciated.

    Regards
    Last edited by jimbo; 6th September 2015 at 19:07.

Similar Threads

  1. Replies: 10
    Last Post: 29th August 2014, 09:02
  2. why can't QProcess read all output?
    By Raul in forum Qt Programming
    Replies: 32
    Last Post: 15th June 2013, 12:17
  3. QProcess Standard Output
    By Decessus in forum Qt Programming
    Replies: 4
    Last Post: 15th August 2012, 17:10
  4. Can't get QProcess output
    By croscato in forum Qt Programming
    Replies: 6
    Last Post: 18th November 2010, 15:56
  5. QT4 debug mode output / QList: Out of memory
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 29th May 2007, 09:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.