Want to query the type of Dev/video, can not find the command, idle egg pain to leave a template
When using, write the video list into the dev_list before solve
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include < fcntl.h>/* Low-level I/o */#include <unistd.h> #include <errno.h> #include <sys/stat.h> #i Nclude <sys/types.h> #include <sys/time.h> #include <sys/mman.h> #include <sys/ioctl.h># Include <asm/types.h> #include <linux/videodev2.h>int device_open (char *dev_name) {struct STAT st; if ( -1 = = Stat (dev_name, &st)) {fprintf (stderr, "cannot identify '%s ':%d,%s\n", Dev_name, errno, Strerro R (errno)); Exit (Exit_failure); } if (! S_ISCHR (St.st_mode)) {fprintf (stderr, "%s is no device\n", dev_name); Exit (Exit_failure); } int fd = open (Dev_name, O_RDWR/* required */| | O_nonblock, 0); if ( -1 = = FD) {fprintf (stderr, "Cannot open '%s ':%d,%s\n", Dev_name, errno, Strerror (errno)); Exit (Exit_failure); } printf ("%s%d:open%s SUCCESSFUlly. FD =%d\n ", __func__, __line__, Dev_name, FD); return FD;} int device_close (int fd) {if ( -1 = = Close (FD)) {printf ("\tdevice close failed.\n"); Exit (Exit_failure); } else {printf ("%s%d:devices close successfully\n", __func__, __line__); }return 0;} int Device_query (char *dev_name, int fd) {struct v4l2_capability cap;memset (&cap, 0, sizeof (CAP)); if ( -1 = = IOCTL (FD, Vidioc_querycap, &cap))//query V4l2-devices ' s capability {if (EINVAL = = errno) {fprintf (stderr, "%s is no v4l2 device\n", dev_name); Exit (Exit_failure); } else {return 0; printf ("\tvideo ioctl_querycap failed.\n"); Exit (Exit_failure); }}else//\tdevice Name:%s\n dev_name, {printf ("\n\tdriver Name:%s\n\tcard Name:%s\n\tbus info:%s\n\tdriver versi On:%u.%u.%u\n\n ", Cap.driver, Cap.card, Cap.bus_info, (cap.version >>) & 0XFF, (cap.version >> 8) &Amp 0XFF, Cap.version & 0XFF);} return 0;} int dev_num = 27;char Dev_list[100][20] = {"/dev/video6", "/dev/video7", "/dev/video11", "/dev/video12", "/dev/video13", 00-04 "/dev/video14", "/dev/video15", "/dev/video16", "/dev/video17", "/dev/video18",//05-09 "/dev/video19", "/dev/ Video23 ","/dev/video24 ","/dev/video25 ","/dev/video26 ",//10-14"/dev/video27 ","/dev/video28 ","/dev/video29 ","/ Dev/video30 ","/dev/video31 ",//15-19"/dev/video32 ","/dev/video33 ","/dev/video34 ","/dev/video36 ","/dev/video37 ", 20-24 "/dev/video38", "/dev/video50"};int Solve () {int i = 0;int Dev_start = 0;int Dev_end = dev_num;for (i = Dev_start; i < dev_end; ++i) {int fd = Device_open (Dev_list[i]);d evice_query (Dev_list[i], FD);d evice_close (FD); return 0;} int main () {printf ("\nstart game\n"), Solve ();p rintf ("\nquit game\n"); return 0;}
Attached rp5410 Video Info
/*start gamedevice name:video6 driver name:mfccard name:decoderbus info:driver Version:1.0.0device Name:video7 D River Name:mfccard Name:encoderbus info:driver version:1.0.0device name:video11 driver Name:s5p-jpegcard Name: S5p-jpegbus info:driver version:1.0.0device name:video12 driver Name:s5p-jpegcard name:s5p-jpegbus info:driver Version:1.0.0device name:video13 driver Name:exynos5-jpeg-hxcard name:exynos5-jpeg-hxbus info:driver version:1 .0.0device name:video14 driver Name:exynos5-jpeg-hxcard name:exynos5-jpeg-hxbus info:driver version:1.0.0device N AME:VIDEO16 driver Name:s5p-mixercard name:mxr0_graph0bus info:0driver version:0.1.0device name:video17 driver n Ame:s5p-mixercard name:mxr0_graph1bus info:1driver version:0.1.0device name:video18 driver Name:s5p-mixercard N Ame:mxr1_graph2bus info:2driver version:0.1.0device name:video19 driver Name:s5p-mixercard Name:mxr1_graph3bus Info:3driver version: 0.1.0device name:video23 driver Name:exynos-gsccard name:exynos-gscbus info:driver version:3.4.5device name:vid Eo24 driver Name:exynos-gsccard name:exynos-gscbus info:driver version:3.4.5device name:video26 driver name:exy Nos-gsccard name:exynos-gscbus info:driver version:3.4.5device name:video27 driver Name:exynos-gsccard name:exy Nos-gscbus info:driver version:3.4.5device name:video29 driver Name:exynos-gsccard name:exynos-gscbus info:driv Er version:3.4.5device name:video30 driver name:exynos-gsccard name:exynos-gscbus info:driver Version:3.4.5devi Ce name:video32 driver name:exynos-gsccard name:exynos-gscbus info:driver version:3.4.5device name:video33 Drive R name:exynos-gsccard Name:exynos-gscbus info:driver version:3.4.5device name:video50 driver Name:exynos5-scale Rcard Name:exynos5-scalerbus info:driver version:3.4.5quit game*/
Linux Query Video Device type