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. How to Write data to PCI Device Address from GUI?
Forum Updated to NodeBB v4.3 + New Features

How to Write data to PCI Device Address from GUI?

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 1.2k 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.
  • P Offline
    P Offline
    PraviN3738
    wrote on 5 Mar 2020, 06:35 last edited by
    #1

    Hi everyone,

    I want to communicate with my PCI device using Linux commands in GUI.
    In Linux Terminal, I can able to Read & Write the PCI address.
    I created LineEdit & Button to read the address in GUI.

    My code:

    void MainWindow::on_pushButton_clicked()
    {

    QProcess proc;
    proc.start("setpci -s 00:1c.0 10.L");	//command to read the address of 00:0c.0 at location 10
    proc.waitForFinished();
    
    QString output = proc.readAllStandardOutput();
    ui->lineEdit->setText(output);
    

    }

    Here I am able to get the data from the address location 10.

    In this same way I want to write at the same address location using another Linux Command setpci -s 00:1c.0 10.L=”1210ffff”, here my data in 1210ffff which I will write in LineEdit and this has to be store in address location also. let me know how to execute this function..!

    Thanks in advance.

    J 1 Reply Last reply 5 Mar 2020, 07:07
    0
    • P PraviN3738
      5 Mar 2020, 06:35

      Hi everyone,

      I want to communicate with my PCI device using Linux commands in GUI.
      In Linux Terminal, I can able to Read & Write the PCI address.
      I created LineEdit & Button to read the address in GUI.

      My code:

      void MainWindow::on_pushButton_clicked()
      {

      QProcess proc;
      proc.start("setpci -s 00:1c.0 10.L");	//command to read the address of 00:0c.0 at location 10
      proc.waitForFinished();
      
      QString output = proc.readAllStandardOutput();
      ui->lineEdit->setText(output);
      

      }

      Here I am able to get the data from the address location 10.

      In this same way I want to write at the same address location using another Linux Command setpci -s 00:1c.0 10.L=”1210ffff”, here my data in 1210ffff which I will write in LineEdit and this has to be store in address location also. let me know how to execute this function..!

      Thanks in advance.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 5 Mar 2020, 07:07 last edited by
      #2

      @PraviN3738 said in How to Write data to PCI Device Address from GUI?:

      let me know how to execute this function

      Can you please explain what the problem is? If you can execute the first command then you should be able to execute the second one.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • P Offline
        P Offline
        PraviN3738
        wrote on 5 Mar 2020, 07:26 last edited by
        #3

        Can you please explain what the problem is? If you can execute the first command then you should be able to execute the second one.

        In first function i am doing Read operation & that was working fine, In second function when i was writing to the same address location, it is not working.

        J 1 Reply Last reply 5 Mar 2020, 07:56
        0
        • P PraviN3738
          5 Mar 2020, 07:26

          Can you please explain what the problem is? If you can execute the first command then you should be able to execute the second one.

          In first function i am doing Read operation & that was working fine, In second function when i was writing to the same address location, it is not working.

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 5 Mar 2020, 07:56 last edited by
          #4

          @PraviN3738 said in How to Write data to PCI Device Address from GUI?:

          it is not working

          Does it work if you try it in a terminal directly?

          Please show your code where you're writing.
          Also the way you're calling the command is not good: you should pass the parameters for setpci as a string list as shown in the documentation.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          P 1 Reply Last reply 5 Mar 2020, 09:20
          2
          • M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 5 Mar 2020, 07:59 last edited by mrjj 3 May 2020, 07:59
            #5

            Hi

            if it works from commandline directly then try the correct way with parameters.

            QString program = "setpci";
            QStringList arguments;
            arguments << "-s" << "00:1c.0" << "10.l=" << "1210ffff"; 
            proc->start(command,arguments );
            
            P 1 Reply Last reply 5 Mar 2020, 09:21
            3
            • J jsulm
              5 Mar 2020, 07:56

              @PraviN3738 said in How to Write data to PCI Device Address from GUI?:

              it is not working

              Does it work if you try it in a terminal directly?

              Please show your code where you're writing.
              Also the way you're calling the command is not good: you should pass the parameters for setpci as a string list as shown in the documentation.

              P Offline
              P Offline
              PraviN3738
              wrote on 5 Mar 2020, 09:20 last edited by
              #6

              @jsulm said in How to Write data to PCI Device Address from GUI?:

              @PraviN3738 said in How to Write data to PCI Device Address from GUI?:

              Does it work if you try it in a terminal directly?
              yes, in Linux terminal it is working fine

              1 Reply Last reply
              0
              • M mrjj
                5 Mar 2020, 07:59

                Hi

                if it works from commandline directly then try the correct way with parameters.

                QString program = "setpci";
                QStringList arguments;
                arguments << "-s" << "00:1c.0" << "10.l=" << "1210ffff"; 
                proc->start(command,arguments );
                
                P Offline
                P Offline
                PraviN3738
                wrote on 5 Mar 2020, 09:21 last edited by
                #7

                @mrjj sure

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  PraviN3738
                  wrote on 5 Mar 2020, 13:29 last edited by
                  #8

                  @jsulm & @mrjj
                  I solved the problem by moving the QProcess outside the function.
                  Thanks for your support here..

                  1 Reply Last reply
                  0

                  6/8

                  5 Mar 2020, 09:20

                  • Login

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