linux - Qt 4.8.2

Hello,

I've managed to use QProcess to get data from an eeprom and convert to a QList<uint>.
Just seems unnecessarily complex, is it just me (trying to learn) or is there an easier way?
Thanks for reading.

Regards
Qt Code:
  1. QString p_stdOut;
  2. QString p_stdErr;
  3. QList<uint> pages = QList<uint>() << 128 << 256 << 512 << 1024 << 2048 << 4096;
  4. QList<uint> data = QList<uint>();
  5.  
  6. //eeprog-tear -xf /dev/i2c-1 0x50 -x -16 -r 0x8160:0x20 - read last 32 bytes of eeprom
  7. cmd = "eeprog-tear -xf /dev/i2c-1 0x50 -x -16 -r 0x" + (QString::number((pages[i] - 1) * 32)) + ":0x20";
  8. process->start(cmd);
  9. process->waitForFinished(-1);
  10.  
  11. p_stdOut = process->readAllStandardOutput();
  12. qDebug() << "1 - " << p_stdOut;
  13.  
  14. p_stdOut = p_stdOut.right(p_stdOut.length() - ((p_stdOut.indexOf("|")) + 1)); //get rid of first address
  15. qDebug() << "2 - " << p_stdOut;
  16.  
  17. p_stdOut.replace((p_stdOut.indexOf("|") - 5), 6, ""); //get rid of second sddress
  18. qDebug() << "3 - " << p_stdOut;
  19.  
  20. p_stdOut.replace((p_stdOut.indexOf("\n") ), 1, ""); //get rid of linefeed
  21. qDebug() << "4 - " << p_stdOut;
  22.  
  23. p_stdOut = p_stdOut.simplified().replace(" ", ","); //get rid of extra spaces, add commas
  24. qDebug() << "5 - " << p_stdOut;
  25.  
  26. QRegExp rx(",");
  27. list = p_stdOut.split(rx, QString::SkipEmptyParts);
  28. qDebug() << "6 list - " << list;
  29.  
  30. for (int j = 0; j < list.length() - 1; j++) data << list[j].toUInt(&ok, 16);
  31. qDebug() << "7 uint - " << data;
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. Output
  2. ******
  3. 1 - "
  4. 4064| 64 6d e8 02 00 01 00 20 00 00 00 62 02 00 00 00
  5. 4074| 00 00 00 80 00 00 00 a1 00 00 00 00 00 00 00 00
  6.  
  7. "
  8. 2 - " 64 6d e8 02 00 01 00 20 00 00 00 62 02 00 00 00
  9. 4074| 00 00 00 80 00 00 00 a1 00 00 00 00 00 00 00 00
  10.  
  11. "
  12. 3 - " 64 6d e8 02 00 01 00 20 00 00 00 62 02 00 00 00
  13. 00 00 00 80 00 00 00 a1 00 00 00 00 00 00 00 00
  14.  
  15. "
  16. 4 - " 64 6d e8 02 00 01 00 20 00 00 00 62 02 00 00 00 00 00 00 80 00 00 00 a1 00 00 00 00 00 00 00 00
  17.  
  18. "
  19. 5 - "64,6d,e8,02,00,01,00,20,00,00,00,62,02,00,00,00,00,00,00,80,00,00,00,a1,00,00,00,00,00,00,00,00"
  20. 6 list - ("64", "6d", "e8", "02", "00", "01", "00", "20", "00", "00", "00", "62", "02", "00", "00", "00", "00", "00", "00", "80", "00", "00", "00", "a1", "00", "00", "00", "00", "00", "00", "00", "00")
  21. 7 uint - (100, 109, 232, 2, 0, 1, 0, 32, 0, 0, 0, 98, 2, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 161, 0, 0, 0, 0, 0, 0, 0)
To copy to clipboard, switch view to plain text mode