diff --git a/v4l2/Makefile b/v4l2/Makefile index 4cdfa280..b536a994 100644 --- a/v4l2/Makefile +++ b/v4l2/Makefile @@ -26,7 +26,7 @@ video-infos: video-infos.c Makefile funcs.o v4l2_pr_structs.o gcc -Wall -g $< ${LOBJ} ../libfloatimg.a -o $@ nc-camcontrol: nc-camcontrol.c Makefile funcs.o v4l2_pr_structs.o - gcc -Wall -g $< ${LOBJ} ../libfloatimg.a -o $@ + gcc -Wall -g $< ${LOBJ} ../libfloatimg.a -lcurses -o $@ # --------------- # external things diff --git a/v4l2/nc-camcontrol.c b/v4l2/nc-camcontrol.c index fa2734dd..2a29af8d 100644 --- a/v4l2/nc-camcontrol.c +++ b/v4l2/nc-camcontrol.c @@ -6,10 +6,11 @@ #include #include #include -#include +// #include #include #include #include +#include #include #include "../floatimg.h" @@ -33,15 +34,35 @@ exit(0); /* --------------------------------------------------------------------- */ int init_screen(char *title) { +int foo; + +#if DEBUG_LEVEL fprintf(stderr, ">>> %s ( '%s' )\n", __func__, title); +#endif + +initscr(); + +standout(); mvaddstr(1, 5, title); standend(); refresh(); + + return -1; } /* --------------------------------------------------------------------- */ -int preparation(char *devname, int param) +int end_screen(void) +{ +endwin(); +return 0; +} +/* --------------------------------------------------------------------- */ +int preparation_v4l2(char *devname, int param) { int fd, foo; struct v4l2_capability cap; +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, devname, param); +#endif + fd = open_device(devname); if (fd < 0) { fprintf(stderr, "err %d on %s opening\n", errno, devname); @@ -62,13 +83,18 @@ if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) { return fd; } /* --------------------------------------------------------------------- */ -int interactive(int fd, int notused) +int interactive(int fd, char *text, int notused) { -init_screen("prototype"); - fprintf(stderr, "file descriptor = %d\n", fd); +init_screen("prototype"); + +sleep(2); + +end_screen(); + +return 0; } /* --------------------------------------------------------------------- */ int main(int argc, char *argv[]) @@ -91,13 +117,13 @@ while ((opt = getopt(argc, argv, "d:e:hK:lT:v")) != -1) { } } -devnum = preparation(device, K); +devnum = preparation_v4l2(device, K); if (devnum < 0) { fprintf(stderr, "%s : erreur init video device\n", argv[0]); exit(1); } -foo = interactive(devnum, 0); +foo = interactive(devnum, title, 0); return 0; }