Main Page
Classes
Files
File List
File Members
src
opt_nm33_uvc
init_xu_register.cpp
Go to the documentation of this file.
1
/* */
2
/* This code is based on luvcview_wr_100823 from Opt corp. */
3
/* */
4
/* 2010/09/15 k-okada@jsk.t.u-tokyo.ac.jp */
5
6
#include <unistd.h>
7
#include <sys/types.h>
8
#include <sys/stat.h>
9
#include <fcntl.h>
10
11
#include <opencv/cv.h>
12
#include <opencv/highgui.h>
13
14
#include "
opt_nm33_uvc.h
"
15
16
int
main
(
int
argc,
char
* argv[]) {
17
char
dev[256];
18
int
fd;
19
if
( getuid() != 0 ) {
20
fprintf(stderr,
"\033[31m### you must run this program as a root : sudo %s\033[0m\n"
, argv[0]);
21
exit(1);
22
}
23
for
(
int
i = 0; i < 16; i++ ) {
24
sprintf(dev,
"/dev/video%d"
, i);
25
if
( ( fd = open((
const
char
*)dev,O_RDWR)) > 0 ) {
26
fprintf(stderr,
";; video capabilities %s(%d)\n"
, dev, fd);
27
28
struct
v4l2_capability vd;
29
memset(&vd, 0,
sizeof
(
struct
v4l2_capability));
30
if
(ioctl(fd, VIDIOC_QUERYCAP, &vd) < 0) {
31
perror(
"ioctl(VIDIOC_QUERYCAP)"
);
32
return
false
;
33
}
34
fprintf(stderr,
";; vd.driver = %s\n"
, vd.driver);
35
fprintf(stderr,
";; vd.card = %s\n"
, vd.card);
36
fprintf(stderr,
";; vd.buf_info = %s\n"
, vd.bus_info);
37
fprintf(stderr,
";; vd.version = %d\n"
, vd.version);
38
39
if
(strcmp(
"NM30 Ultra Wideview Camera"
, (
const
char
*)vd.card) == 0 ) {
40
set_XU_control
(fd);
41
}
42
}
43
}
44
}
45
main
int main(int argc, char *argv[])
Definition:
init_xu_register.cpp:16
set_XU_control
int set_XU_control(int vd)
Definition:
opt_nm33_uvc.cpp:101
opt_nm33_uvc.h
opt_camera
Author(s): Kei Okada
autogenerated on Wed Jul 10 2019 03:47:11