⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 set.c

📁 足球机器人自动程序
💻 C
字号:
#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <sys/ioctl.h>#include <linux/videodev.h>#include "pwc-ioctl.h"int main() {	const char *dev = "/dev/video0";	int fd = open(dev, O_RDONLY);	if (fd < 0) {		perror("open");		return -1;	}#if 0	int compression = 3;	// 0: no	// 1-3: less-high	if (ioctl(fd, VIDIOCPWCSCQUAL, &compression) < 0) {		perror("ioctl VIDIOCPWCSCQUAL");		return -1;	}#endif#if 1	// auto on reset	//int agc = -1;	int agc = 1275;	//-1: auto	// 0-65535: fixed (not equal)	if (ioctl(fd, VIDIOCPWCSAGC, &agc) < 0) {		perror("ioctl  VIDIOCPWCSAGC");		return -1;	}#endif	#if 0	int shutter= 200;	//-1: auto	// 0-65535: fixed	if (ioctl(fd, VIDIOCPWCSSHUTTER, &shutter) < 0) {		perror("ioctl VIDIOCPWCSSHUTTER");		return -1;	}#endif#if 0	// auto on reset	struct pwc_whitebalance wb;	// mode: PWC_WB_AUTO / PWC_WB_MANUAL	// manual_red / manual_blue: 0:65535 (not equal)	//wb.mode =  PWC_WB_AUTO;	wb.mode =  PWC_WB_MANUAL;	wb.manual_red = 36864;	wb.manual_blue = 17920;	if (ioctl(fd, VIDIOCPWCSAWB, &wb) < 0) {		perror("ioctl VIDIOCPWCSAWB");		return -1;	}#endif#if 0	// 2032, 0 on reset?	struct pwc_wb_speed wbs;	// control_speed / control_delay: 0 (unchange) 1-65536 (not equal)	wbs.control_speed = 30000;	wbs.control_delay = 30000;	if (ioctl(fd, VIDIOCPWCSAWBSPEED, &wbs) < 0) {		perror("ioctl VIDIOCPWCSAWB");		return -1;	}#endif#if 0	struct pwc_leds led;	led.led_on = 0;	led.led_off = 0;	if (ioctl(fd, VIDIOCPWCSLED, &led) < 0) {		perror("ioctl VIDIOCPWCSLED");		return -1;	}#endif#if 0	// -1 (auto) on reset	int contour=30000;	// 0: blur	// 65535: sharp	if (ioctl(fd, VIDIOCPWCSCONTOUR, &contour) < 0) {		perror("ioctl VIDIOCPWCSCONTOUR");		return -1;	}#endif#if 0	// off on reset	int bl = 1;	// 0: off	// other: on	if (ioctl(fd, VIDIOCPWCSBACKLIGHT, &bl) < 0) {		perror("ioctl VIDIOCPWCSBACKLIGHT");		return -1;	}#endif#if 0	// off on reset	int af = 1;	// 0: off	// other: on	if (ioctl(fd, VIDIOCPWCSFLICKER, &af) < 0) {		perror("ioctl VIDIOCPWCSFLICKER");		return -1;	}#endif#if 0	// (read) 1 on reset	int noise = 1;	// 0: off	// 1-3: less-high (reverse?)	if (ioctl(fd, VIDIOCPWCSDYNNOISE, &noise) < 0) {		perror("ioctl VIDIOCPWCSDYNNOISE");		return -1;	}#endif	close(fd);	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -