/* shflip.c */ #include #include #include #include #include #include #include #include main(int argc, char *argv[]) { int fd = open("/dev/video0", O_RDWR); int ret; struct v4l2_queryctrl queryctrl; struct v4l2_control ctrl; memset(&queryctrl, 0, sizeof(queryctrl)); for (queryctrl.id = V4L2_CID_BASE; queryctrl.id < V4L2_CID_LASTP1; queryctrl.id++) { if (0 == ioctl (fd, VIDIOC_QUERYCTRL, &queryctrl)) { if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) continue; printf ("Control %s\n", queryctrl.name); } else { if (errno == EINVAL) continue; perror ("VIDIOC_QUERYCTRL"); return (1); } } memset(&ctrl, 0, sizeof(ctrl)); ctrl.id = V4L2_CID_HFLIP; ret = ioctl(fd, VIDIOC_G_CTRL, &ctrl); printf("Get H flip, ret %d value %d\n", ret, ctrl.value); if (argc > 1) { ctrl.value = atoi(argv[1]); ret = ioctl(fd, VIDIOC_S_CTRL, &ctrl); printf("Set to %d, ret %d\n", ctrl.value, ret); } }