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?
QtWS25 Last Chance

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
  • 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 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.

    jsulmJ 1 Reply Last reply
    0
    • P PraviN3738

      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.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on 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 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.

        jsulmJ 1 Reply Last reply
        0
        • P PraviN3738

          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.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on 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
          2
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #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
            3
            • jsulmJ jsulm

              @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 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
              • mrjjM mrjj

                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 last edited by
                #7

                @mrjj sure

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  PraviN3738
                  wrote on 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

                  • Login

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