From 298d72c54f6e9bae9d22e309c5687052702c7453 Mon Sep 17 00:00:00 2001 From: Andy Hu Date: Tue, 10 Oct 2023 16:56:59 +0800 Subject: [PATCH 1/2] v4l2test: add option to specify the frame number Signed-off-by: Andy Hu --- package/starfive/v4l2_test/v4l2_test.c | 42 +++++++++++++++----------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/package/starfive/v4l2_test/v4l2_test.c b/package/starfive/v4l2_test/v4l2_test.c index 759c6adb..816c007e 100644 --- a/package/starfive/v4l2_test/v4l2_test.c +++ b/package/starfive/v4l2_test/v4l2_test.c @@ -61,6 +61,7 @@ typedef struct { enum STF_DISP_TYPE disp_type; enum IOMethod io_mthd; int continuous; + uint32_t frm_num; uint8_t jpegQuality; char* jpegFilename; @@ -84,6 +85,7 @@ static void alloc_default_config(ConfigParam_t **pp_data) cfg_param->disp_type = STF_DISP_NONE; cfg_param->continuous = 0; + cfg_param->frm_num = 3; cfg_param->jpegQuality = 70; cfg_param->io_mthd = IO_METHOD_MMAP; @@ -514,12 +516,10 @@ static int frameRead(void) static void mainloop_select(void) { int count, i; - uint32_t numberOfTimeouts; - numberOfTimeouts = 0; - count = 3; + count = gp_cfg_param->frm_num; - while (count-- > 0) { + while (count > 0) { for (i = 0; i < 1; i++) { fd_set fds; struct timeval tv; @@ -538,20 +538,18 @@ static void mainloop_select(void) } errno_exit("select"); } else if (0 == r) { - if (numberOfTimeouts <= 0) { - // count++; - } else { - LOG(STF_LEVEL_ERR, "select timeout\n"); - exit(EXIT_FAILURE); - } + LOG(STF_LEVEL_ERR, "select timeout\n"); + continue; } + + if (frameRead()) { + break; + } + count--; + if (gp_cfg_param->continuous == 1) { count = 3; } - - if (frameRead()) - break; - /* EAGAIN - continue select loop. */ } } @@ -599,7 +597,7 @@ static void mainloop() { struct v4l2_buffer buf; int r; - int count = 3; + int count = gp_cfg_param->frm_num; drmEventContext ev; struct pollfd* fds = NULL; uint32_t nfds = 0; @@ -661,7 +659,7 @@ static void mainloop() } } - while (count-- > 0) { + while (count > 0) { r = poll(fds, nfds, 3000); if (-1 == r) { if (EINTR == errno) { @@ -681,6 +679,7 @@ static void mainloop() if (fds[0].revents & POLLIN) { frameRead(); calc_frame_fps(); + count--; } } else if (STF_DISP_DRM == gp_cfg_param->disp_type && IO_METHOD_MMAP == gp_cfg_param->io_mthd) { @@ -688,6 +687,7 @@ static void mainloop() if (fds[0].revents & POLLIN) { frameRead(); calc_frame_fps(); + count--; } if (fds[1].revents & POLLIN) { @@ -719,6 +719,7 @@ static void mainloop() } frameRead(); // TODO: add support for save file later calc_frame_fps(); + count--; } } if (fds[1].revents & POLLIN) { @@ -772,6 +773,7 @@ static void usage(FILE* fp, int argc, char** argv) "-D | --down Set v4l2 image crop y height\n" "-I | --interval Set frame interval (fps) (-1 to skip)\n" "-c | --continuous Do continous capture, stop with SIGINT.\n" + "-n | --frame_num capure frame number, default 30\n" "-C | --connector Display Connector.\n" " 0: INNO HDMI\n" " 1: MIPI/RGB HDMI\n" @@ -808,7 +810,7 @@ static void usage(FILE* fp, int argc, char** argv) argv[0]); } -static const char short_options [] = "d:ho:q:m:W:H:I:vcf:t:X:Y:R:D:l:C:s"; +static const char short_options [] = "d:ho:q:m:W:H:I:vcn:f:t:X:Y:R:D:l:C:s"; static const struct option long_options [] = { { "device", required_argument, NULL, 'd' }, @@ -825,6 +827,7 @@ static const struct option long_options [] = { { "interval", required_argument, NULL, 'I' }, { "version", no_argument, NULL, 'v' }, { "continuous", no_argument, NULL, 'c' }, + { "frame_num", required_argument, NULL, 'n' }, { "format", required_argument, NULL, 'f' }, { "distype", required_argument, NULL, 't' }, { "loadfw", required_argument, NULL, 'l' }, @@ -918,6 +921,11 @@ void parse_options(int argc, char **argv, ConfigParam_t *cfg_param) InstallSIGINTHandler(); break; + case 'n': + // set capture frame number. effective when cfg_param->continuous is 0 + cfg_param->frm_num = (uint32_t)strtoul(optarg, NULL, 0); + break; + case 'v': printf("Version: %s\n", TEST_VERSION); exit(EXIT_SUCCESS); From f78ad160c973480df2a7a7cbb4218a46f63fffb3 Mon Sep 17 00:00:00 2001 From: Andy Hu Date: Wed, 11 Oct 2023 09:16:00 +0800 Subject: [PATCH 2/2] busybox: add some command for ltp-ddt add command: stat, comm, timeout Signed-off-by: Andy Hu --- package/busybox/busybox.config | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) mode change 100644 => 100755 package/busybox/busybox.config diff --git a/package/busybox/busybox.config b/package/busybox/busybox.config old mode 100644 new mode 100755 index 6ac25d22..abb5359e --- a/package/busybox/busybox.config +++ b/package/busybox/busybox.config @@ -208,7 +208,7 @@ CONFIG_CHOWN=y CONFIG_CHROOT=y CONFIG_CKSUM=y CONFIG_CRC32=y -# CONFIG_COMM is not set +CONFIG_COMM=y CONFIG_CP=y # CONFIG_FEATURE_CP_LONG_OPTIONS is not set # CONFIG_FEATURE_CP_REFLINK is not set @@ -299,9 +299,9 @@ CONFIG_FEATURE_SORT_BIG=y # CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set # CONFIG_SPLIT is not set # CONFIG_FEATURE_SPLIT_FANCY is not set -# CONFIG_STAT is not set -# CONFIG_FEATURE_STAT_FORMAT is not set -# CONFIG_FEATURE_STAT_FILESYSTEM is not set +CONFIG_STAT=y +CONFIG_FEATURE_STAT_FORMAT=y +CONFIG_FEATURE_STAT_FILESYSTEM=y CONFIG_STTY=y # CONFIG_SUM is not set CONFIG_SYNC=y @@ -316,7 +316,7 @@ CONFIG_TEST=y CONFIG_TEST1=y CONFIG_TEST2=y CONFIG_FEATURE_TEST_64=y -# CONFIG_TIMEOUT is not set +CONFIG_TIMEOUT=y CONFIG_TOUCH=y CONFIG_FEATURE_TOUCH_SUSV3=y CONFIG_TR=y