Important: Please read the Qt Code of Conduct -

How to get Hardware Info in the Linux using Qt?

  • Dear All,
    I have developed one application in the Qt Creator. I have one requirment for get hardward information in the Linux system, Then i try dmidecode using and run in Qt.It will occur error message for "dev/mem" permission denied". So i try to terminal to run sudo ./application. it will ask password after enter the password the application running and get hardwareinfo also. So how to do in Qt. Please help me it urgent.

    how to get Hardware without sudo permission in the Linux using Qt?


  • I would think you should be able to use QProcess to do it. You can access the input and output channels of the process. Start dmidecode with a QProcess. Check the program output for whether it asks the password, and then ask the same from the user in a dialog in Qt.. then send that password back on the input channel.

    From Documentation of QProcess:

    bq. QProcess allows you to treat a process as a sequential I/O device. You can write to and read from the process just as you would access a network connection using QTcpSocket. You can then write to the process's standard input by calling write(), and read the standard output by calling read(), readLine(), and getChar().

  • Thanks i will to update..

Log in to reply