2
# (C) 2008 Hans de Goede <hdegoede@redhat.com>
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU Lesser General Public License as published by
6
# the Free Software Foundation; either version 2.1 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU Lesser General Public License for more details.
14
# You should have received a copy of the GNU Lesser General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
#include "../libv4lconvert/libv4lsyscall-priv.h"
22
#include <linux/videodev.h>
23
#include "libv4l1-priv.h"
25
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
27
FILE *v4l1_log_file = NULL;
29
static const char *v4l1_ioctls[] = {
30
[_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP",
31
[_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN",
32
[_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN",
33
[_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER",
34
[_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER",
35
[_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT",
36
[_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT",
37
[_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE",
38
[_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN",
39
[_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN",
40
[_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF",
41
[_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF",
42
[_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY",
43
[_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ",
44
[_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ",
45
[_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO",
46
[_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO",
47
[_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC",
48
[_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE",
49
[_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF",
50
[_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT",
51
[_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE",
52
[_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE",
53
[_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE",
54
[_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE",
55
[_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO",
56
[_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE",
57
[_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT",
58
[_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT",
61
void v4l1_log_ioctl(unsigned long int request, void *arg, int result)
63
const char *ioctl_str = "unknown";
69
/* Don't log v4l2 ioctl's as unknown we pass them to libv4l2 which will
71
if (_IOC_TYPE(request) == 'V')
74
if (_IOC_TYPE(request) == 'v' && _IOC_NR(request) < ARRAY_SIZE(v4l1_ioctls))
75
ioctl_str = v4l1_ioctls[_IOC_NR(request)];
77
snprintf(buf, sizeof(buf), "unknown request: %c %d\n",
78
(int)_IOC_TYPE(request), (int)_IOC_NR(request));
82
fprintf(v4l1_log_file, "request == %s\n", ioctl_str);
86
case VIDIOCGCAP:fprintf(v4l1_log_file,"name %s\n",( (struct video_capability*)arg)->name );
87
fprintf(v4l1_log_file,"type %d\n",( (struct video_capability*)arg)->type );
88
fprintf(v4l1_log_file,"channels %d\n",( (struct video_capability*)arg)->channels );
89
fprintf(v4l1_log_file,"audios %d\n",( (struct video_capability*)arg)->audios );
90
fprintf(v4l1_log_file,"maxwidth %d\n",( (struct video_capability*)arg)->maxwidth );
91
fprintf(v4l1_log_file,"maxheight %d\n",( (struct video_capability*)arg)->maxheight );
92
fprintf(v4l1_log_file,"minwidth %d\n",( (struct video_capability*)arg)->minwidth );
93
fprintf(v4l1_log_file,"minheight %d\n",( (struct video_capability*)arg)->minheight );
97
fprintf(v4l1_log_file,"width\t%u\n",
98
((struct video_window *)arg)->width);
99
fprintf(v4l1_log_file,"height\t%u\n",
100
((struct video_window *)arg)->height);
105
fprintf(v4l1_log_file,"channel %d\n",( (struct video_channel*)arg)->channel );
106
fprintf(v4l1_log_file,"name %s\n",( (struct video_channel*)arg)->name );
111
fprintf(v4l1_log_file,"brightness %d\n",( (int)((struct video_picture*)arg)->brightness) );
112
fprintf(v4l1_log_file,"hue %d\n",( (int)((struct video_picture*)arg)->hue) );
113
fprintf(v4l1_log_file,"colour %d\n",( (int)((struct video_picture*)arg)->colour) );
114
fprintf(v4l1_log_file,"contrast %d\n",( (int)((struct video_picture*)arg)->contrast) );
115
fprintf(v4l1_log_file,"whiteness %d\n",( (int)((struct video_picture*)arg)->whiteness) );
116
fprintf(v4l1_log_file,"depth %d\n",( (int)((struct video_picture*)arg)->depth) );
117
fprintf(v4l1_log_file,"palette %d\n",( (int)((struct video_picture*)arg)->palette) );
120
case VIDIOCCAPTURE: fprintf(v4l1_log_file,"on/off? %d\n", *((int *)arg) );
123
case VIDIOCSYNC: fprintf(v4l1_log_file,"sync %d\n", *((int *)arg) );
127
fprintf(v4l1_log_file,"frame %u\n",( (struct video_mmap*)arg)->frame );
128
fprintf(v4l1_log_file,"width %d\n",( (struct video_mmap*)arg)->width );
129
fprintf(v4l1_log_file,"height %d\n",( (struct video_mmap*)arg)->height );
130
fprintf(v4l1_log_file,"format %u\n",( (struct video_mmap*)arg)->format );
134
fprintf(v4l1_log_file,"size %d\n",( (struct video_mbuf*)arg)->size );
135
fprintf(v4l1_log_file,"frames %d\n",( (struct video_mbuf*)arg)->frames );
138
fprintf(v4l1_log_file, "result == %d\n", result);
139
fflush(v4l1_log_file);