On Mon, Apr 10, 2017 at 01:45:02PM +0300, Edgar Kaziahmedov wrote: > * tests/ioctl_v4l2.c (main) [VIDIOC_S_FMT]: Add check for all V4L2_BUF_TYPEs. > (main) [VIDIOC_G_FMT]: Likewise. > (main) [VIDIOC_TRY_FMT]: Likewise. > (init_v4l2_format): New function to avoid the 'copy-paste' in > tests of VIDIOC_S_FMT and VIDIOC_TRY_FMT. > (print_ioctl_v4l2): Likewise.
* tests/ioctl_v4l2.c (init_v4l2_format, print_ioctl_v4l2): New functions
to avoid cut and paste between VIDIOC_S_FMT and VIDIOC_TRY_FMT tests.
(main) <VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT>: Use them. Add
checks for remaining V4L2_BUF_TYPE_* types.
[...]
> + case V4L2_BUF_TYPE_VIDEO_OVERLAY: {
> + f->fmt.win.w.left = 0xfeedface;
> + f->fmt.win.w.top = 0xfeedbacc;
> + f->fmt.win.w.width = 0xfeedbacc;
> + f->fmt.win.w.height = 0xfeedbacc;
Here and in other similar cases, try to use different magic for different
fields, this helps catching cut and paste errors in parsers.
[...]
> + case V4L2_BUF_TYPE_VBI_CAPTURE:
> + case V4L2_BUF_TYPE_VBI_OUTPUT:
> + f->fmt.vbi.sampling_rate = 0xfaceb01d;
> + f->fmt.vbi.offset = 0x12345678;
> + f->fmt.vbi.samples_per_line = 0xf001ba11;
> + f->fmt.vbi.sample_format = magic;
> + f->fmt.vbi.start[0] = 0xba11ba11;
> + f->fmt.vbi.start[1] = 0xba22ba22;
> + f->fmt.vbi.count[0] = 0xba33ba33;
> + f->fmt.vbi.count[1] = 0xba44ba44;
This is not a very strong magic as higher and lower parts are the same.
--
ldv
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
