Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. error : QProcessPrivate::createPipe: Cannot create pipe 0x2ed031ac: Too many open files
Forum Updated to NodeBB v4.3 + New Features

error : QProcessPrivate::createPipe: Cannot create pipe 0x2ed031ac: Too many open files

Scheduled Pinned Locked Moved Solved Mobile and Embedded
qtcreator
27 Posts 2 Posters 10.3k 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.
  • S Offline
    S Offline
    sachin786
    wrote on last edited by
    #13
    [root@Atishay build-QT_FP_RFID-QT_4_8_6-Debug]# lsof
    1	/bin/busybox	/dev/console
    1	/bin/busybox	/dev/console
    1	/bin/busybox	/dev/console
    1512	/sbin/udevd	/dev/null
    1512	/sbin/udevd	/dev/null
    1512	/sbin/udevd	/dev/null
    1512	/sbin/udevd	anon_inode:inotify
    1512	/sbin/udevd	socket:[1031]
    1512	/sbin/udevd	socket:[1032]
    1512	/sbin/udevd	pipe:[1033]
    1512	/sbin/udevd	pipe:[1033]
    3246	/usr/sbin/inetd	/dev/null
    3246	/usr/sbin/inetd	/dev/null
    3246	/usr/sbin/inetd	/dev/null
    3246	/usr/sbin/inetd	socket:[306]
    3246	/usr/sbin/inetd	socket:[307]
    3246	/usr/sbin/inetd	socket:[308]
    3246	/usr/sbin/inetd	socket:[309]
    3246	/usr/sbin/inetd	socket:[310]
    3246	/usr/sbin/inetd	socket:[311]
    3246	/usr/sbin/inetd	socket:[312]
    3249	/usr/sbin/boa	/dev/null
    3249	/usr/sbin/boa	/var/log/boa/access_log
    3249	/usr/sbin/boa	/var/log/boa/error_log
    3249	/usr/sbin/boa	socket:[1246]
    3344	/bin/bash	/dev/console
    3344	/bin/bash	/dev/console
    3344	/bin/bash	/dev/console
    3344	/bin/bash	/etc/rc.d/rc_mxc.S
    3348	/bin/bash	/dev/ttymxc0
    3348	/bin/bash	/dev/ttymxc0
    3348	/bin/bash	/dev/ttymxc0
    3348	/bin/bash	/dev/ttymxc0
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc0
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc0
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc0
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[9936]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[9936]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[9938]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[9938]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	socket:[9939]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/fb0
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/tty0
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/input/mouse0
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/input/event1
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/tty0
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	socket:[9941]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/tmp/qtembedded-0/fonts/dejavu_sans_20_50.qsf
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/tmp/qtembedded-0/fonts/dejavu_sans_40_50.qsf
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[13498]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[13498]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[15454]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[15454]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[14820]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[14820]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/spidev0.0
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[13499]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[13499]
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
    8343	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
    

    above is the log for lsof command when my application running...

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sachin786
      wrote on last edited by sachin786
      #14
      **before application running output=>**
      [root@Atishay root]# lsof
      1	/bin/busybox	/dev/console
      1	/bin/busybox	/dev/console
      1	/bin/busybox	/dev/console
      1498	/sbin/udevd	/dev/null
      1498	/sbin/udevd	/dev/null
      1498	/sbin/udevd	/dev/null
      1498	/sbin/udevd	anon_inode:inotify
      1498	/sbin/udevd	socket:[1525]
      1498	/sbin/udevd	socket:[1526]
      1498	/sbin/udevd	pipe:[1527]
      1498	/sbin/udevd	pipe:[1527]
      2653	/usr/sbin/inetd	/dev/null
      2653	/usr/sbin/inetd	/dev/null
      2653	/usr/sbin/inetd	/dev/null
      2653	/usr/sbin/inetd	socket:[2860]
      2653	/usr/sbin/inetd	socket:[2861]
      2653	/usr/sbin/inetd	socket:[2862]
      2653	/usr/sbin/inetd	socket:[2863]
      2653	/usr/sbin/inetd	socket:[2864]
      2653	/usr/sbin/inetd	socket:[2865]
      2653	/usr/sbin/inetd	socket:[2866]
      2656	/usr/sbin/boa	/dev/null
      2656	/usr/sbin/boa	/var/log/boa/access_log
      2656	/usr/sbin/boa	/var/log/boa/error_log
      2656	/usr/sbin/boa	socket:[3527]
      2750	/bin/bash	/dev/console
      2750	/bin/bash	/dev/console
      2750	/bin/bash	/dev/console
      2750	/bin/bash	/etc/rc.d/rc_mxc.S
      2753	/bin/bash	/dev/ttymxc0
      2753	/bin/bash	/dev/ttymxc0
      2753	/bin/bash	/dev/ttymxc0
      2753	/bin/bash	/dev/ttymxc0
      
      
      **after application running output=>**
      
      1	/bin/busybox	/dev/console
      1	/bin/busybox	/dev/console
      1	/bin/busybox	/dev/console
      1498	/sbin/udevd	/dev/null
      1498	/sbin/udevd	/dev/null
      1498	/sbin/udevd	/dev/null
      1498	/sbin/udevd	anon_inode:inotify
      1498	/sbin/udevd	socket:[1525]
      1498	/sbin/udevd	socket:[1526]
      1498	/sbin/udevd	pipe:[1527]
      1498	/sbin/udevd	pipe:[1527]
      2653	/usr/sbin/inetd	/dev/null
      2653	/usr/sbin/inetd	/dev/null
      2653	/usr/sbin/inetd	/dev/null
      2653	/usr/sbin/inetd	socket:[2860]
      2653	/usr/sbin/inetd	socket:[2861]
      2653	/usr/sbin/inetd	socket:[2862]
      2653	/usr/sbin/inetd	socket:[2863]
      2653	/usr/sbin/inetd	socket:[2864]
      2653	/usr/sbin/inetd	socket:[2865]
      2653	/usr/sbin/inetd	socket:[2866]
      2656	/usr/sbin/boa	/dev/null
      2656	/usr/sbin/boa	/var/log/boa/access_log
      2656	/usr/sbin/boa	/var/log/boa/error_log
      2656	/usr/sbin/boa	socket:[3527]
      2750	/bin/bash	/dev/console
      2750	/bin/bash	/dev/console
      2750	/bin/bash	/dev/console
      2750	/bin/bash	/etc/rc.d/rc_mxc.S
      2753	/bin/bash	/dev/ttymxc0
      2753	/bin/bash	/dev/ttymxc0
      2753	/bin/bash	/dev/ttymxc0
      2753	/bin/bash	/dev/ttymxc0
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc0
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc0
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc0
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[9913]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[9913]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[9915]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[9915]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	socket:[9916]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/fb0
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/tty0
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/input/mouse0
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/input/event1
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/tty0
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	socket:[9918]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/tmp/qtembedded-0/fonts/dejavu_sans_20_50.qsf
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/tmp/qtembedded-0/fonts/dejavu_sans_40_50.qsf
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[12299]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[12299]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[11299]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[11299]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[10579]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[10579]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/spidev0.0
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[12300]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	pipe:[12300]
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/tmp/qtembedded-0/fonts/dejavu_sans_14_50.qsf
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/tmp/qtembedded-0/fonts/dejavu_sans_15_75.qsf
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
      5604	/usr/test/build-QT_FP_RFID-QT_4_8_6-Debug/QT_FP_RFID	/dev/ttymxc2
      
      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #15

        Is it me or does your application open /dev/ttymxc2 very often ?

        How do you open that device file ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        S 1 Reply Last reply
        1
        • SGaistS SGaist

          Is it me or does your application open /dev/ttymxc2 very often ?

          How do you open that device file ?

          S Offline
          S Offline
          sachin786
          wrote on last edited by
          #16
          No, in my application i called following function multiple time.
          fpSetup();//  /dev/ttymxc2 open oftenly
          
          /******************************************** fpSetup Starts***************************************************
          //Description     : Setting Up UART peripheral
          //Input Parameter : void
          //Return Type     : void
          ************************************************************************************************************/
          void fpSetup(void)
          {
              //printf("\nSetting Up Fingerprint module...\n");
              N=12;
              SERIAL_ATTR_ST serial_attr;
              int ret;
              int channel;
              channel=2;				// UART channel select as per need.. anas
              fp=UART4_Port_RDWR(channel);		// open UART port.
              ret=UART4_Attr_set(fp,serial_attr);
              if (RET_SUCCESS == ret)
              {
                  //printf("\nBaud Rate Set Successful.\n");
              }
          
          }
          
          
          
          /************************************************************************************************************
          File: serial_test.h (contains all function declaration and definations for interfacing and enabling serial interface )
          Author   : RnD Team @ Atishay Infotech
          Date     : 18th Jan 2016,Monday,10:57AM
          Platform : IMX6 board(Cortex A9) + Linux-3.0.35
          Toolchain: arm-fsl-linux-gnueabi-gcc-4.6.2
          *************************************************************************************************************/
          #include <stdio.h>
          #include <sys/types.h>
          #include <sys/stat.h>
          #include <fcntl.h>
          #include <unistd.h>
          #include <string.h>
          #include <termios.h>
          #include <errno.h>
          #include <sys/ioctl.h>
          #include <pthread.h>
          #define BUF_SIZE		512
          /* *************************** variables ******************************/
          	char read_buf[BUF_SIZE];
          	unsigned char N;
          	//char confirmation_data[BUFFER];
          /* *************************** Structures ******************************/
          
          typedef struct {
              char parity;
          	unsigned int baud;
              unsigned int databits;
              unsigned int stopbits;
          } SERIAL_ATTR_ST;
          
          /************ Functions **********************/
          static int attr_baud_set(int,unsigned int);
          static void *datas_read(void*);
          //char rs232_read();
          int rs232_transfer(int fd, unsigned char data[], int buf_size);
          //static int RS232_test(int);
          void thread_DataRead(int);
          int UART4_Attr_set(int fd,SERIAL_ATTR_ST serial_attr);
          int UART4_Port_RDWR(int);
          //static int RS485_test(int)
          
          
          typedef struct {
              unsigned int lable;
              unsigned int baudrate;
          } SERIAL_BAUD_ST;
          
          typedef struct{
              unsigned int flags;
              unsigned int delay_rts_after_send;	/* delay after send (milliseconds) */
          }SERIAL_RS485_CONF_ST;
          
          
          
          #define DEBUG 1
          
          #ifdef DEBUG
            #define DEBUG_INFO(fmt, args...)  fprintf(stderr, fmt, ##args)
            #define DEBUG_ERROR(fmt, args...) fprintf(stderr, fmt"%s\t%s\t%d\n", ##args, __FILE__,__FUNCTION__,__LINE__)
          #else
            #define DEBUG_INFO(fmt, args...)
            #define DEBUG_ERROR(fmt, args...)
          #endif
          
          #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
          
          #define TIMEOUT                     1  /* read operation timeout 1s = TIMEOUT/10 */
          #define MIN_LEN                     128  /* the min len datas */
          #define DEV_NAME_LEN                32
          #define SERIAL_ATTR_BAUD            9600*N
          #define SERIAL_ATTR_DATABITS        8
          #define SERIAL_ATTR_STOPBITS        1
          #define SERIAL_ATTR_PARITY          'n'
          #define SERIAL_MODE_NORMAL          0
          #define SERIAL_MODE_485             1
          #define DELAY_RTS_AFTER_SEND        1   /* 1ms */
          #define SER_RS485_ENABLED		    1	/* 485 enable */
          #define RET_SUCCESS                 		0
          #define RET_FAILED                  		-1
          
          
          static SERIAL_BAUD_ST g_attr_baud[] = {
              {230400, B230400}, {115200, B115200},
              {57600, B57600}, {38400, B38400},
              {19200, B19200}, {9600, B9600},
              {4800, B4800},  {2400, B2400},
              {1800, B1800}, {1200, B1200},
          };
          
          static char g_dev_serial[][DEV_NAME_LEN] = {
                  "/dev/ttymxc0",
                  "/dev/ttymxc1",
                  "/dev/ttymxc2",
                  "/dev/ttymxc3",
                  "/dev/ttymxc4",
          };
          
          static int attr_baud_set(int fd, unsigned int baud)
          {
              unsigned int i=0;
              int ret = RET_SUCCESS;
              struct termios option;
          
              /* get old serial attribute */
              memset(&option, 0, sizeof(option));
              if (RET_SUCCESS != tcgetattr(fd, &option))
              {
                  DEBUG_ERROR("tcgetattr failed.\n");
                  return RET_FAILED;
              }
          
              for (i=0;i<ARRAY_SIZE(g_attr_baud);i++)
              {
                  if (baud == g_attr_baud[i].lable)
                  {
                      ret = tcflush(fd, TCIOFLUSH);
                      if (RET_SUCCESS != ret)
                      {
                       //   DEBUG_ERROR("tcflush failed.\n");
                          break;
                      }
          
                      ret = cfsetispeed(&option, g_attr_baud[i].baudrate);
                      if (RET_SUCCESS != ret)
                      {
                       //   DEBUG_ERROR("cfsetispeed failed.\n");
                          ret = RET_FAILED;
                          break;
                      }
          
                      ret = cfsetospeed(&option, g_attr_baud[i].baudrate);
                      if (RET_SUCCESS != ret)
                      {
                          //DEBUG_ERROR("cfsetospeed failed.\n");
                          ret = RET_FAILED;
                          break;
                      }
          
                      ret = tcsetattr(fd, TCSANOW, &option);
                      if  (RET_SUCCESS != ret)
                      {
                        //  DEBUG_ERROR("tcsetattr failed.\n");
                          ret = RET_FAILED;
                          break;
                      }
          
                      ret = tcflush(fd, TCIOFLUSH);
                      if (RET_SUCCESS != ret)
                      {
                      //    DEBUG_ERROR("tcflush failed.\n");
                          break;
                      }
                  }
              }
          
              return ret;
          }
          
          static int attr_other_set(int fd, SERIAL_ATTR_ST *serial_attr)
          {
              struct termios option;
          
              /* get old serial attribute */
              memset(&option, 0, sizeof(option));
              if (RET_SUCCESS != tcgetattr(fd, &option))
              {
                  DEBUG_ERROR("tcgetattr failed.\n");
                  return RET_FAILED;
              }
          
              option.c_iflag = CLOCAL | CREAD;
          
              /* set datas size */
              option.c_cflag &= ~CSIZE;
              option.c_iflag = 0;
          
              switch (serial_attr->databits)
              {
                  case 7:
                      option.c_cflag |= CS7;
                      break;
          
                  case 8:
                      option.c_cflag |= CS8;
                      break;
          
                  default:
                      DEBUG_ERROR("invalid argument, unsupport datas size.\n");
                      return RET_FAILED;
              }
          
              /* set parity */
              switch (serial_attr->parity)
              {
                  case 'n':
                  case 'N':
                      option.c_cflag &= ~PARENB;
                      option.c_iflag &= ~INPCK;
                      break;
          
                  case 'o':
                  case 'O':
                      option.c_cflag |= (PARODD | PARENB);
                      option.c_iflag |= INPCK;
                      break;
          
                  case 'e':
                  case 'E':
                      option.c_cflag |= PARENB;
                      option.c_cflag &= ~PARODD;
                      option.c_iflag |= INPCK;
                      break;
          
                  case 's':
                  case 'S':
                      option.c_cflag &= ~PARENB;
                      option.c_cflag &= ~CSTOPB;
                      break;
          
                  default:
                      DEBUG_ERROR("invalid argument, unsupport parity type.\n");
                      return RET_FAILED;
              }
          
              /* set stop bits  */
              switch (serial_attr->stopbits)
              {
                  case 1:
                      option.c_cflag &= ~CSTOPB;
                      break;
          
                  case 2:
                      option.c_cflag |= CSTOPB;
                      break;
          
                  default:
                      DEBUG_ERROR("invalid argument, unsupport stop bits.\n");
                      return RET_FAILED;
              }
          
              option.c_oflag = 0;
              option.c_lflag = 0;
              option.c_cc[VTIME] = TIMEOUT;
              option.c_cc[VMIN] = MIN_LEN;
          
              if (RET_SUCCESS != tcflush(fd,TCIFLUSH))
              {
                  DEBUG_ERROR("tcflush failed.\n");
                  return RET_FAILED;
              }
          
              if (RET_SUCCESS != tcsetattr(fd, TCSANOW, &option))
              {
                  DEBUG_ERROR("tcsetattr failed.\n");
                  return RET_FAILED;
              }
          
          #if 0
              tcgetattr(fd, &option);
              DEBUG_INFO("c_iflag: %x\rc_oflag: %x\n", option.c_iflag, option.c_oflag);
              DEBUG_INFO("c_cflag: %x\nc_lflag: %x\n", option.c_cflag, option.c_lflag);
              DEBUG_INFO("c_line: %x\nc_cc[VTIME]: %d\nc_cc[VMIN]: %d\n", option.c_line, option.c_cc[VTIME], option.c_cc[VMIN]);
          #endif
          
              return RET_SUCCESS;
          }
          
          static int attr_set(int fd, SERIAL_ATTR_ST *serial_attr)
          {
              int ret = RET_SUCCESS;
          
              if (NULL == serial_attr)
              {
                  DEBUG_ERROR("invalid argument.\n");
                  return RET_FAILED;
              }
          
              if (RET_SUCCESS == ret)
              {
                  ret = attr_baud_set(fd, serial_attr->baud);
                  if (RET_SUCCESS == ret)
                  {
                      ret = attr_other_set(fd, serial_attr);
                  }
              }
          
              return ret;
          }
          
          
          static void *datas_read(void *arg)
          {
              int ret=0,i=0,n_data=0;
              int fd = *(int *)arg;
               printf("Reading the data...\n");
          
                  memset(read_buf, 0, sizeof(read_buf));
              for(i=0;i<9;i++)
              {
                      ret= read(fd, (read_buf+i), sizeof(char));
                      if(ret){ n_data++; }
          
              }
          
              DEBUG_INFO("receive %d datas: %s\n", n_data, read_buf);
          
          }
          
          void thread_DataRead(int fd)
          {
              int ret = RET_SUCCESS;
              pthread_t pid;
              printf("Creating the Thread for Reading the Data.\n");
              ret = pthread_create(&pid, NULL, datas_read, (void *)&fd);
              if (RET_SUCCESS != ret)
              {
                  DEBUG_ERROR("can't create thread:%s\n",(char*) strerror);
              }
              else
              printf("Thread created for reading the data.\n");
          
              pthread_cancel(pid);
          }
          
          
          
          int rs232_transfer(int fd,unsigned char data[],int buf_size)
          {
              unsigned char i;
              int n_data=0;
              int ret = RET_SUCCESS;
              //printf("Writing the data to R305...\n");
          
              for(i=0;i<(buf_size+1);i++)
              {
                      ret = write(fd, (data+i) , sizeof(char));
                  //printf("Data Sent:%x\n",data[i]);
                  n_data++;
              }
          
                  if ((buf_size+1) != n_data)
                      {
                          printf("Data Write Failed\n");
                              ret = RET_FAILED;
          
                      }
                  else
                  //printf("Done.\n");
                      sleep(1);
          
              return ret;
          }
          
          
          int UART4_Attr_set(int fd,SERIAL_ATTR_ST serial_attr)
          {
               int ret;
              //SERIAL_ATTR_ST serial_attr;
              //printf("Setting Up the Attributes.\n");
          
              memset(&serial_attr, 0, sizeof(serial_attr));
              serial_attr.baud = SERIAL_ATTR_BAUD;
              serial_attr.databits = SERIAL_ATTR_DATABITS;
              serial_attr.stopbits = SERIAL_ATTR_STOPBITS;
              serial_attr.parity = SERIAL_ATTR_PARITY;
          
              ret = attr_set(fd, &serial_attr);
              return ret;
          }
          
          int UART4_Port_RDWR(int channel)
          {
              int fd;
              //int bufsize;
              //char write_buf[BUF_SIZE];
          
              //DEBUG_INFO("QY-IMX6S-V1.2 RS232 Com channe ss%d \n Start Testing ...\n", channel);
              fd = open(g_dev_serial[channel], O_RDWR);
              if (fd < 0)
              {
                  DEBUG_ERROR("open serial device %s error!\n", g_dev_serial[channel]);
                  return RET_FAILED;
              }
          
              /*memset(write_buf,0,sizeof(write_buf));
              snprintf(write_buf, sizeof(write_buf), "Com%d RS232 test string!\n", channel);
              bufsize = strlen(write_buf) + 1;
          
              serial_rs232_test(fd, write_buf, bufsize);*/
          
              return fd;
          }
          
          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #17

            Why not use QSerialPort ?

            In any case, I don't see any call to close the file descriptor after use.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            S 1 Reply Last reply
            0
            • SGaistS SGaist

              Why not use QSerialPort ?

              In any case, I don't see any call to close the file descriptor after use.

              S Offline
              S Offline
              sachin786
              wrote on last edited by
              #18

              @SGaist ok i will check that file and get back to u...and i am using QT creator 4.8.5 and in that there is no proper documentation for Qserialport thats why i am using normal serial port terminal available in ubuntu 12.04.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #19

                You'll have to build the module yourself (there's a Qt 4 dedicated branch) but otherwise. The documentation is the same.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                S 1 Reply Last reply
                0
                • SGaistS SGaist

                  You'll have to build the module yourself (there's a Qt 4 dedicated branch) but otherwise. The documentation is the same.

                  S Offline
                  S Offline
                  sachin786
                  wrote on last edited by
                  #20

                  @SGaist :: as far now problem is get fixed and my application running fine. as you help me to point out i am not closing file descriptor, i fix this by simply closing file descriptor and keeping track that no device peripheral left open more than once, at the moment i am using with regular serial port communication, thanx for all your suggestion it really help me alot.
                  once i finish this application surely i will try to work with QSerialPort :) Thank you once again and have great day ☺

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    sachin786
                    wrote on last edited by
                    #21

                    hello @SGaist ...following issue is occured while running the application and by this the finger print module get off

                    Unable to handle kernel NULL pointer dereference at virtual address 000000d4
                    pgd = 80004000
                    [000000d4] *pgd=00000000
                    Internal error: Oops: 17 [#1] PREEMPT SMP
                    Modules linked in:
                    CPU: 2    Not tainted  (3.0.35-2666-gbdde708 #26)
                    PC is at bus_freq_update+0x80/0x1d0
                    LR is at bus_freq_update+0x14/0x1d0
                    pc : [<8007129c>]    lr : [<80071230>]    psr: 60000013
                    sp : bfd43e80  ip : 00000001  fp : 0011edd8
                    r10: 00000000  r9 : 0011edd8  r8 : 80af7a54
                    r7 : 000e7ef0  r6 : 000000bc  r5 : 00000000  r4 : 80aaf958
                    r3 : ba1e0ae0  r2 : bfd43e78  r1 : 00000000  r0 : 80aabbfc
                    Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
                    Control: 10c53c7d  Table: 4faf404a  DAC: 00000015
                    Process kworker/2:1 (pid: 1386, stack limit = 0xbfd422f0)
                    Stack: (0xbfd43e80 to 0xbfd44000)
                    3e80: 80af778c 3b5dc100 001312d0 8008657c 001312d0 001312d0 80af7788 80af77783ea0: 80af7a54 bf9ff240 80af7a54 00000004 00000004 80aa7ac4 179a7b00 bfd43ee4
                    3ec0: 80537fdc 800868bc bfd43f04 800b4dc4 8c018f40 00000000 bfd43f8c 80533958
                    3ee0: 00000000 00000003 000f32a0 00060ae0 ffffff01 00000000 00000000 00000000
                    3f00: 00000000 00000002 8005af40 80aa7abc 80aa7abc 00000000 80aa7b00 80aa7cc0
                    3f20: 8005ad90 8c008d90 8005ad90 8039e698 00060ae0 803a2eac 00000001 bfa03e00
                    3f40: 8c0182e0 8c01e800 bfd42000 00000000 8c01e805 803a2d90 80b18474 800aab34
                    3f60: bfa03e10 00000001 bfa03e10 bfa03e00 8c0182e0 8c0182e8 bfa03e10 bfd42000
                    3f80: 8005b400 8005b400 00000009 800ab36c 00000013 00000000 8005b400 8005b400
                    3fa0: bfd43fc4 bffb1f00 bfa03e00 800ab1fc 00000013 00000000 00000000 00000000
                    3fc0: 00000000 800af80c 80062aa4 00000000 bfa03e00 00000000 00000000 00000000
                    3fe0: bfd43fe0 bfd43fe0 bffb1f00 800af78c 80062aa4 80062aa4 00000000 00000000
                    [<8007129c>] (bus_freq_update+0x80/0x1d0) from [<8008657c>] (set_cpu_freq+0x1b8/0x3a0)
                    [<8008657c>] (set_cpu_freq+0x1b8/0x3a0) from [<800868bc>] (mxc_set_target+0x10c/0x2bc)
                    [<800868bc>] (mxc_set_target+0x10c/0x2bc) from [<8039e698>] (__cpufreq_driver_target+0x50/0x64)
                    [<8039e698>] (__cpufreq_driver_target+0x50/0x64) from [<803a2eac>] (cpufreq_interactive_freq_down+0x11c/0x14c)
                    [<803a2eac>] (cpufreq_interactive_freq_down+0x11c/0x14c) from [<800aab34>] (process_one_work+0x10c/0x38c)
                    [<800aab34>] (process_one_work+0x10c/0x38c) from [<800ab36c>] (worker_thread+0x170/0x37c)
                    [<800ab36c>] (worker_thread+0x170/0x37c) from [<800af80c>] (kthread+0x80/0x88)
                    [<800af80c>] (kthread+0x80/0x88) from [<80062aa4>] (kernel_thread_exit+0x0/0x8)
                    Code: 0a00000d ebfffea0 ea00000b e5df6148 (e5963018) 
                    ---[ end trace 8c5e7d506d5614d2 ]---
                    Unable to handle kernel paging request at virtual address fffffffc
                    pgd = 80004000
                    [fffffffc] *pgd=4fffe821, *pte=00000000, *ppte=00000000
                    Internal error: Oops: 17 [#2] PREEMPT SMP
                    Modules linked in:
                    CPU: 2    Tainted: G      D      (3.0.35-2666-gbdde708 #26)
                    PC is at kthread_data+0x4/0xc
                    LR is at wq_worker_sleeping+0xc/0xec
                    pc : [<800af9cc>]    lr : [<800abeec>]    psr: 00000193
                    sp : bfd43b98  ip : 8c018f90  fp : bfd43c4c
                    r10: ba1e0bfc  r9 : ba1e0bfc  r8 : ba1e0c78
                    r7 : 00000002  r6 : bfd42000  r5 : ba1e0ae0  r4 : 00000002
                    r3 : 00000000  r2 : 00000000  r1 : 00000002  r0 : ba1e0ae0
                    Flags: nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
                    Control: 10c53c7d  Table: 4faf404a  DAC: 00000015
                    Process kworker/2:1 (pid: 1386, stack limit = 0xbfd422f0)
                    Stack: (0xbfd43b98 to 0xbfd44000)
                    3b80:                                                       8c018f40 80533a6c
                    3ba0: 809d8c68 80126fe4 bfd43bcf 00000001 bfa03ed0 bffc31e0 0000056a 8015754c
                    3bc0: 00000000 00000000 8005af40 8005af40 8005a1b4 8005af40 c01dfaab 00000000
                    3be0: c01dfaab 800980f8 ba230000 ba1e0ae0 bfc08000 ba230504 80af8298 ba230000
                    3c00: 00000000 8005a260 ba1e0ae0 8009810c ba1e0ae0 8005a260 8007129e 800da9d4
                    3c20: 00000000 00000000 bfd43c28 ba1e0ae0 ffffffff ba1e0ad8 bff8c000 ba1e0bfc
                    3c40: ba1e0bfc ba1e0bfc 809d1bc8 80099390 00000000 bfd43c64 bfd42000 00000001
                    3c60: 80abd4bc bfd43c64 bfd43c64 ba1e0c44 8007129e bfd42000 00000000 00000001
                    3c80: 8007129e 00000000 800712a0 bfd43cda 809d1bc8 80065740 bfd422f0 0000000b
                    3ca0: 00000008 00000000 30000001 30303061 20643030 66666265 30616566 30616520
                    3cc0: 30303030 35652062 31366664 28203834 36393565 38313033 00002029 00000000
                    3ce0: 0011edd8 00000000 000000d4 00000017 bfd43e38 ba1e0ae0 00000017 00000000
                    3d00: 0011edd8 8052f84c bfd43e38 8006c488 00000000 00000001 00000200 bfd43de4
                    3d20: 00591ec2 00000001 00000000 00000000 80a94080 80aa7aa0 bfd43dc4 80090764
                    3d40: 8c01825c bfd43de4 00000001 00000000 00000002 bfd42000 bfd43de4 8005af40
                    3d60: 00000000 8005af40 00000000 8008fe20 00000000 00000017 80aab428 000000d4
                    3d80: bfd43e38 80af7a54 20000113 00000000 0011edd8 8005c384 bffd1780 ffffffff
                    3da0: 8005af40 00000000 00000000 bffc1900 00000000 8005af40 00000000 00000000
                    3dc0: 001cbcc5 00000000 bffc1900 00000000 00000fff 00000000 00000000 00000000
                    3de0: 00000000 00000001 00000000 00000000 00000000 00000000 00000000 00000000
                    3e00: 00000000 00000000 00000000 bfe4fe00 00000000 bfe4fe00 00000040 800b4ef0
                    3e20: 00000000 0000040f 00000007 000000bc 000e7ef0 80061990 80aabbfc 00000000
                    3e40: bfd43e78 ba1e0ae0 80aaf958 00000000 000000bc 000e7ef0 80af7a54 0011edd8
                    3e60: 00000000 0011edd8 00000001 bfd43e80 80071230 8007129c 60000013 ffffffff
                    3e80: 80af778c 3b5dc100 001312d0 8008657c 001312d0 001312d0 80af7788 80af7778
                    3ea0: 80af7a54 bf9ff240 80af7a54 00000004 00000004 80aa7ac4 179a7b00 bfd43ee4
                    3ec0: 80537fdc 800868bc bfd43f04 800b4dc4 8c018f40 00000000 bfd43f8c 80533958
                    3ee0: 00000000 00000003 000f32a0 00060ae0 ffffff01 00000000 00000000 00000000
                    3f00: 00000000 00000002 8005af40 80aa7abc 80aa7abc 00000000 80aa7b00 80aa7cc0
                    3f20: 8005ad90 8c008d90 8005ad90 8039e698 00060ae0 803a2eac 00000001 bfa03e00
                    3f40: 8c0182e0 8c01e800 bfd42000 00000000 8c01e805 803a2d90 80b18474 800aab34
                    3f60: bfa03e10 00000001 bfa03e10 bfa03e00 8c0182e0 8c0182e8 bfa03e10 bfd42000
                    3f80: 8005b400 8005b400 00000009 800ab36c 00000013 00000000 8005b400 8005b400
                    3fa0: bfd43fc4 bffb1f00 bfa03e00 800ab1fc 00000013 00000000 00000000 00000000
                    3fc0: 00000000 800af80c 80062aa4 00000000 bfa03e00 00000001 00000000 00000000
                    3fe0: bfd43fe0 bfd43fe0 bffb1f00 800af78c 80062aa4 80062aa4 00000000 00000000
                    [<800af9cc>] (kthread_data+0x4/0xc) from [<800abeec>] (wq_worker_sleeping+0xc/0xec)
                    [<800abeec>] (wq_worker_sleeping+0xc/0xec) from [<80533a6c>] (__schedule+0x390/0x6c0)
                    [<80533a6c>] (__schedule+0x390/0x6c0) from [<80099390>] (do_exit+0x450/0x6e8)
                    [<80099390>] (do_exit+0x450/0x6e8) from [<80065740>] (die+0x228/0x284)
                    [<80065740>] (die+0x228/0x284) from [<8052f84c>] (__do_kernel_fault.part.4+0x54/0x74)
                    [<8052f84c>] (__do_kernel_fault.part.4+0x54/0x74) from [<8006c488>] (do_page_fault+0x2b4/0x31c)
                    [<8006c488>] (do_page_fault+0x2b4/0x31c) from [<8005c384>] (do_DataAbort+0x34/0x9c)
                    [<8005c384>] (do_DataAbort+0x34/0x9c) from [<80061990>] (__dabt_svc+0x70/0xa0)
                    Exception stack(0xbfd43e38 to 0xbfd43e80)
                    3e20:                                                       80aabbfc 00000000
                    3e40: bfd43e78 ba1e0ae0 80aaf958 00000000 000000bc 000e7ef0 80af7a54 0011edd8
                    3e60: 00000000 0011edd8 00000001 bfd43e80 80071230 8007129c 60000013 ffffffff
                    [<80061990>] (__dabt_svc+0x70/0xa0) from [<8007129c>] (bus_freq_update+0x80/0x1d0)
                    [<8007129c>] (bus_freq_update+0x80/0x1d0) from [<8008657c>] (set_cpu_freq+0x1b8/0x3a0)
                    [<8008657c>] (set_cpu_freq+0x1b8/0x3a0) from [<800868bc>] (mxc_set_target+0x10c/0x2bc)
                    [<800868bc>] (mxc_set_target+0x10c/0x2bc) from [<8039e698>] (__cpufreq_driver_target+0x50/0x64)
                    [<8039e698>] (__cpufreq_driver_target+0x50/0x64) from [<803a2eac>] (cpufreq_interactive_freq_down+0x11c/0x14c)
                    [<803a2eac>] (cpufreq_interactive_freq_down+0x11c/0x14c) from [<800aab34>] (process_one_work+0x10c/0x38c)
                    [<800aab34>] (process_one_work+0x10c/0x38c) from [<800ab36c>] (worker_thread+0x170/0x37c)
                    [<800ab36c>] (worker_thread+0x170/0x37c) from [<800af80c>] (kthread+0x80/0x88)
                    [<800af80c>] (kthread+0x80/0x88) from [<80062aa4>] (kernel_thread_exit+0x0/0x8)
                    Code: eaff9868 80537f4c 809db0fc e590316c (e5130004) 
                    \00\F0
                    

                    after some time(2 to 3 hour) it shoots this error...

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #22

                      There's a faulty module doing something wrong.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        sachin786
                        wrote on last edited by
                        #23

                        the module is working properly for 4 hours or 5 hour then automatically turned off and in serial port terminal show above mention output...

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by SGaist
                          #24

                          That doesn't mean it doesn't do something wrong. For example, a small memory (one byte) leak can take days until it eats all the system's memory but it still will.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            sachin786
                            wrote on last edited by
                            #25

                            i can't figure out what is the issue related to it error...

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #26

                              The driver used to talk with the device might be faulty.

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              S 1 Reply Last reply
                              0
                              • SGaistS SGaist

                                The driver used to talk with the device might be faulty.

                                S Offline
                                S Offline
                                sachin786
                                wrote on last edited by
                                #27

                                @SGaist i am not sure about this...for temporary solution i have to reboot my device after 3 hour.. ..

                                1 Reply Last reply
                                0
                                • M Mark81 referenced this topic on

                                • Login

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