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. QT App error after device sleep.

QT App error after device sleep.

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 5 Posters 1.1k 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.
  • S Offline
    S Offline
    Sontichai
    wrote on last edited by
    #1

    Hi,
    I develop qt desktop application on OS linux run on raspberry pi 3.
    My application connect finger scan by USB port. Concept use timer loop receive image data from finger scan.
    I got problem some time when raspberry pi sleep after wake up when i scan finger print then application terminate and auto
    close windows.
    I try to debug to log file follow this link [https://evileg.com/en/post/154/](link url) but not write when app error to file.

    Problem not every time . just some time after device sleep. I can not find this bug.
    Please help . How to debug while application error .

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Might be something with the usb driver.
      Do you have some other app or cmdline to to interface with scanner?
      I would make it sleep for some time and and test if its still happy.
      Else it could also be a bug in app code so when driver is not 100%
      ready something goes wrong.
      Did you add checks and use any return code scanner api can give ?
      So in case it does report error, you stop the flow of app ?

      1 Reply Last reply
      1
      • S Offline
        S Offline
        Sontichai
        wrote on last edited by
        #3

        Hi mrjj,

           Thanks for reply. no other app or cmdline. I use sdk C++  for scanner.
           Before app close i can get image from scanner. How to see qt log error ?
        
           void FVerify::onTimer(){
        

        if(GetImageAndData(1,m_fpimage,m_fpdata)) {

            char datetime_buff[100];
            time_t now = time (0);
            strftime (datetime_buff, 100, "%Y%m%d%H%M%S", localtime (&now));
        
            QString img_name = datetime_buff + ip_address.replace(".","");
        
            QByteArray save_part = "/mnt/fpTemp/";
            QByteArray full_path =  save_part.append(img_name.toLatin1());
        
            const char * c_savepath;
            c_savepath = full_path.data();
        
            img_verify = img_name;
        
            FILE *fh;
            FPImgToBmpImage(m_fpimage,m_bmpimage);
            fh  = fopen(c_savepath, "wb" );
            fwrite(m_bmpimage,1,sizeof(m_bmpimage),fh);
            fclose(fh);
        
            QPixmap pm(c_savepath);
            QPixmap newPixmap = pm.scaled(QSize(350,350),Qt::KeepAspectRatio);
        
            gs_finger->clear();
            gs_finger->addPixmap(newPixmap);
            ui->img_finger->setScene(gs_finger);
            ui->lb_msgScan->setText("Lift finger");
        
            GetDataWeb();
        

        }
        }

        mrjjM 1 Reply Last reply
        0
        • S Sontichai

          Hi mrjj,

             Thanks for reply. no other app or cmdline. I use sdk C++  for scanner.
             Before app close i can get image from scanner. How to see qt log error ?
          
             void FVerify::onTimer(){
          

          if(GetImageAndData(1,m_fpimage,m_fpdata)) {

              char datetime_buff[100];
              time_t now = time (0);
              strftime (datetime_buff, 100, "%Y%m%d%H%M%S", localtime (&now));
          
              QString img_name = datetime_buff + ip_address.replace(".","");
          
              QByteArray save_part = "/mnt/fpTemp/";
              QByteArray full_path =  save_part.append(img_name.toLatin1());
          
              const char * c_savepath;
              c_savepath = full_path.data();
          
              img_verify = img_name;
          
              FILE *fh;
              FPImgToBmpImage(m_fpimage,m_bmpimage);
              fh  = fopen(c_savepath, "wb" );
              fwrite(m_bmpimage,1,sizeof(m_bmpimage),fh);
              fclose(fh);
          
              QPixmap pm(c_savepath);
              QPixmap newPixmap = pm.scaled(QSize(350,350),Qt::KeepAspectRatio);
          
              gs_finger->clear();
              gs_finger->addPixmap(newPixmap);
              ui->img_finger->setScene(gs_finger);
              ui->lb_msgScan->setText("Lift finger");
          
              GetDataWeb();
          

          }
          }

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          So app does take image and then crash ?

          How to see qt log error ?

          Im not sure what log you think about ?
          Qt dont write a log as such.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            aronsalsa
            Banned
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            -1
            • S Offline
              S Offline
              Sontichai
              wrote on last edited by
              #6

              Hi mrjj,

                   Some time after device sleep while capture image app catch got error.
              

              The inferior stopped because it received a signal from the operating system.
              Signal name :
              SIGSEGV
              Signal meaning :
              Segmentation fault

                   I think may be the problem with driver library  scanner.
                   Can i skip this error and do program loop again ? with out app closing.
                   Do not want app windows close. or you have solution for check this error ?
              
              aha_1980A 1 Reply Last reply
              0
              • S Sontichai

                Hi mrjj,

                     Some time after device sleep while capture image app catch got error.
                

                The inferior stopped because it received a signal from the operating system.
                Signal name :
                SIGSEGV
                Signal meaning :
                Segmentation fault

                     I think may be the problem with driver library  scanner.
                     Can i skip this error and do program loop again ? with out app closing.
                     Do not want app windows close. or you have solution for check this error ?
                
                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Sontichai

                if you have SIGSEGV, you app has crashed. no way to recover. you have to find the origin of the crash (be it the library or your app) and to fix it.

                can you start your app from a command line? then I'd start adding qDebugs to see the program flow and find where things go wrong. esp. check all pointers before using them!

                regards

                Qt has to stay free or it will die.

                1 Reply Last reply
                0
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Or enable coredumps on your system and debug the generated coredump later on - google is your friend when you don't know how to enable coredumps :)

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  1 Reply Last reply
                  1
                  • S Offline
                    S Offline
                    Sontichai
                    wrote on last edited by
                    #9

                    Re: QT App error after device sleep.

                    Hi,

                    Thanks for all reply. 
                     I can not check origin the crash because of library from finger print vendor was complied.
                     can't edit or see source code in file. But i solving problem by use shell script loop check when QT process closed then re open 
                    program again.
                    
                    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