staging/easycap: add first level indentation to easycap_ioctl.c
Add the first level indentation to easycap_testcard.c with astyle -t8. About 100 of 80 columns warnings were left out for further fix Cc: Mike Thomas <rmthomas@sciolus.org> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
abb46c8cc0
commit
50e1fbdc1c
@@ -77,12 +77,11 @@ if (0xFFFF == peasycap_standard->mask) {
|
||||
}
|
||||
SAM("selected standard: %s\n",
|
||||
&(peasycap_standard->v4l2_standard.name[0]));
|
||||
if (peasycap->standard_offset ==
|
||||
(int)(peasycap_standard - &easycap_standard[0])) {
|
||||
if (peasycap->standard_offset == peasycap_standard - easycap_standard) {
|
||||
SAM("requested standard already in effect\n");
|
||||
return 0;
|
||||
}
|
||||
peasycap->standard_offset = (int)(peasycap_standard - &easycap_standard[0]);
|
||||
peasycap->standard_offset = peasycap_standard - easycap_standard;
|
||||
for (k = 0; k < INPUT_MANY; k++) {
|
||||
if (!peasycap->inputset[k].standard_offset_ok) {
|
||||
peasycap->inputset[k].standard_offset =
|
||||
@@ -95,6 +94,7 @@ if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
|
||||
peasycap->inputset[peasycap->input].standard_offset_ok = 1;
|
||||
} else
|
||||
JOM(8, "%i=peasycap->input\n", peasycap->input);
|
||||
|
||||
peasycap->fps = peasycap_standard->v4l2_standard.frameperiod.denominator /
|
||||
peasycap_standard->v4l2_standard.frameperiod.numerator;
|
||||
switch (peasycap->fps) {
|
||||
@@ -133,10 +133,14 @@ if (peasycap->video_isoc_streaming) {
|
||||
* SAA7113H DATASHEET PAGE 44, TABLE 42
|
||||
*/
|
||||
/*--------------------------------------------------------------------------*/
|
||||
need = 0; itwas = 0; reg = 0x00; set = 0x00;
|
||||
need = 0;
|
||||
itwas = 0;
|
||||
reg = 0x00;
|
||||
set = 0x00;
|
||||
switch (peasycap_standard->mask & 0x000F) {
|
||||
case NTSC_M_JP: {
|
||||
reg = 0x0A; set = 0x95;
|
||||
reg = 0x0A;
|
||||
set = 0x95;
|
||||
ir = read_saa(peasycap->pusb_device, reg);
|
||||
if (0 > ir)
|
||||
SAM("ERROR: cannot read SAA register 0x%02X\n", reg);
|
||||
@@ -156,7 +160,8 @@ case NTSC_M_JP: {
|
||||
"from 0x%02X to 0x%02X\n", reg, itwas, isnow);
|
||||
}
|
||||
|
||||
reg = 0x0B; set = 0x48;
|
||||
reg = 0x0B;
|
||||
set = 0x48;
|
||||
ir = read_saa(peasycap->pusb_device, reg);
|
||||
if (0 > ir)
|
||||
SAM("ERROR: cannot read SAA register 0x%02X\n", reg);
|
||||
@@ -183,22 +188,37 @@ case NTSC_M_JP: {
|
||||
}
|
||||
case NTSC_M:
|
||||
case PAL_BGHIN: {
|
||||
reg = 0x0E; set = 0x01; need = 1; break;
|
||||
reg = 0x0E;
|
||||
set = 0x01;
|
||||
need = 1;
|
||||
break;
|
||||
}
|
||||
case NTSC_N_443:
|
||||
case PAL_60: {
|
||||
reg = 0x0E; set = 0x11; need = 1; break;
|
||||
reg = 0x0E;
|
||||
set = 0x11;
|
||||
need = 1;
|
||||
break;
|
||||
}
|
||||
case NTSC_443:
|
||||
case PAL_Nc: {
|
||||
reg = 0x0E; set = 0x21; need = 1; break;
|
||||
reg = 0x0E;
|
||||
set = 0x21;
|
||||
need = 1;
|
||||
break;
|
||||
}
|
||||
case NTSC_N:
|
||||
case PAL_M: {
|
||||
reg = 0x0E; set = 0x31; need = 1; break;
|
||||
reg = 0x0E;
|
||||
set = 0x31;
|
||||
need = 1;
|
||||
break;
|
||||
}
|
||||
case SECAM: {
|
||||
reg = 0x0E; set = 0x51; need = 1; break;
|
||||
reg = 0x0E;
|
||||
set = 0x51;
|
||||
need = 1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
@@ -433,10 +453,10 @@ while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
|
||||
|
||||
if (((peasycap_format->mask & 0x1F) == (mask & 0x1F)) &&
|
||||
(peasycap_format->v4l2_format.fmt.pix.field == field) &&
|
||||
(peasycap_format->v4l2_format.fmt.pix.pixelformat ==
|
||||
pixelformat) &&
|
||||
(peasycap_format->v4l2_format.fmt.pix.pixelformat == pixelformat) &&
|
||||
(peasycap_format->v4l2_format.fmt.pix.width == width) &&
|
||||
(peasycap_format->v4l2_format.fmt.pix.height == height)) {
|
||||
|
||||
peasycap_best_format = peasycap_format;
|
||||
break;
|
||||
}
|
||||
@@ -445,15 +465,14 @@ while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
|
||||
if (0 == peasycap_format->v4l2_format.fmt.pix.width) {
|
||||
SAM("cannot do: %ix%i with standard mask 0x%02X\n",
|
||||
width, height, mask);
|
||||
peasycap_format = &easycap_format[0]; best = -1;
|
||||
peasycap_format = &easycap_format[0];
|
||||
best = -1;
|
||||
while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
|
||||
if (((peasycap_format->mask & 0x1F) == (mask & 0x1F)) &&
|
||||
(peasycap_format->v4l2_format.fmt.pix
|
||||
.field == field) &&
|
||||
(peasycap_format->v4l2_format.fmt.pix
|
||||
.pixelformat == pixelformat)) {
|
||||
miss = abs(peasycap_format->
|
||||
v4l2_format.fmt.pix.width - width);
|
||||
(peasycap_format->v4l2_format.fmt.pix.field == field) &&
|
||||
(peasycap_format->v4l2_format.fmt.pix.pixelformat == pixelformat)) {
|
||||
|
||||
miss = abs(peasycap_format->v4l2_format.fmt.pix.width - width);
|
||||
if ((best > miss) || (best < 0)) {
|
||||
best = miss;
|
||||
peasycap_best_format = peasycap_format;
|
||||
@@ -479,8 +498,8 @@ if (NULL == peasycap_best_format) {
|
||||
peasycap_format = peasycap_best_format;
|
||||
|
||||
/*...........................................................................*/
|
||||
if (true == try)
|
||||
return (int)(peasycap_best_format - &easycap_format[0]);
|
||||
if (try)
|
||||
return peasycap_best_format - easycap_format;
|
||||
/*...........................................................................*/
|
||||
|
||||
if (false != try) {
|
||||
@@ -494,7 +513,7 @@ SAM("actioning: %ix%i %s\n",
|
||||
peasycap->height = peasycap_format->v4l2_format.fmt.pix.height;
|
||||
peasycap->width = peasycap_format->v4l2_format.fmt.pix.width;
|
||||
peasycap->pixelformat = peasycap_format->v4l2_format.fmt.pix.pixelformat;
|
||||
peasycap->format_offset = (int)(peasycap_format - &easycap_format[0]);
|
||||
peasycap->format_offset = peasycap_format - easycap_format;
|
||||
|
||||
|
||||
for (k = 0; k < INPUT_MANY; k++) {
|
||||
@@ -533,10 +552,10 @@ if (true == peasycap->decimatepixel)
|
||||
multiplier = 2;
|
||||
else
|
||||
multiplier = 1;
|
||||
peasycap->videofieldamount = multiplier * peasycap->width *
|
||||
multiplier * peasycap->height;
|
||||
peasycap->frame_buffer_used = peasycap->bytesperpixel *
|
||||
peasycap->width * peasycap->height;
|
||||
peasycap->videofieldamount =
|
||||
multiplier * peasycap->width * multiplier * peasycap->height;
|
||||
peasycap->frame_buffer_used =
|
||||
peasycap->bytesperpixel * peasycap->width * peasycap->height;
|
||||
if (peasycap->video_isoc_streaming) {
|
||||
resubmit = true;
|
||||
kill_video_urbs(peasycap);
|
||||
@@ -549,30 +568,24 @@ if (peasycap->video_isoc_streaming) {
|
||||
/*---------------------------------------------------------------------------*/
|
||||
if (0 == (0x01 & peasycap_format->mask)) {
|
||||
if (((720 == peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(576 ==
|
||||
peasycap_format->v4l2_format.fmt.pix.height)) ||
|
||||
((360 ==
|
||||
peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(288 ==
|
||||
peasycap_format->v4l2_format.fmt.pix.height))) {
|
||||
if (0 != set_resolution(p, 0x0000, 0x0001, 0x05A0, 0x0121)) {
|
||||
(576 == peasycap_format->v4l2_format.fmt.pix.height)) ||
|
||||
((360 == peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(288 == peasycap_format->v4l2_format.fmt.pix.height))) {
|
||||
if (set_resolution(p, 0x0000, 0x0001, 0x05A0, 0x0121)) {
|
||||
SAM("ERROR: set_resolution() failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
} else if ((704 == peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(576 == peasycap_format->v4l2_format.fmt.pix.height)) {
|
||||
if (0 != set_resolution(p, 0x0004, 0x0001, 0x0584, 0x0121)) {
|
||||
if (set_resolution(p, 0x0004, 0x0001, 0x0584, 0x0121)) {
|
||||
SAM("ERROR: set_resolution() failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
} else if (((640 == peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(480 ==
|
||||
peasycap_format->v4l2_format.fmt.pix.height)) ||
|
||||
((320 ==
|
||||
peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(240 ==
|
||||
peasycap_format->v4l2_format.fmt.pix.height))) {
|
||||
if (0 != set_resolution(p, 0x0014, 0x0020, 0x0514, 0x0110)) {
|
||||
(480 == peasycap_format->v4l2_format.fmt.pix.height)) ||
|
||||
((320 == peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(240 == peasycap_format->v4l2_format.fmt.pix.height))) {
|
||||
if (set_resolution(p, 0x0014, 0x0020, 0x0514, 0x0110)) {
|
||||
SAM("ERROR: set_resolution() failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -587,24 +600,18 @@ if (0 == (0x01 & peasycap_format->mask)) {
|
||||
/*---------------------------------------------------------------------------*/
|
||||
} else {
|
||||
if (((720 == peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(480 ==
|
||||
peasycap_format->v4l2_format.fmt.pix.height)) ||
|
||||
((360 ==
|
||||
peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(240 ==
|
||||
peasycap_format->v4l2_format.fmt.pix.height))) {
|
||||
if (0 != set_resolution(p, 0x0000, 0x0003, 0x05A0, 0x00F3)) {
|
||||
(480 == peasycap_format->v4l2_format.fmt.pix.height)) ||
|
||||
((360 == peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(240 == peasycap_format->v4l2_format.fmt.pix.height))) {
|
||||
if (set_resolution(p, 0x0000, 0x0003, 0x05A0, 0x00F3)) {
|
||||
SAM("ERROR: set_resolution() failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
} else if (((640 == peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(480 ==
|
||||
peasycap_format->v4l2_format.fmt.pix.height)) ||
|
||||
((320 ==
|
||||
peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(240 ==
|
||||
peasycap_format->v4l2_format.fmt.pix.height))) {
|
||||
if (0 != set_resolution(p, 0x0014, 0x0003, 0x0514, 0x00F3)) {
|
||||
(480 == peasycap_format->v4l2_format.fmt.pix.height)) ||
|
||||
((320 == peasycap_format->v4l2_format.fmt.pix.width) &&
|
||||
(240 == peasycap_format->v4l2_format.fmt.pix.height))) {
|
||||
if (set_resolution(p, 0x0014, 0x0003, 0x0514, 0x00F3)) {
|
||||
SAM("ERROR: set_resolution() failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -614,9 +621,10 @@ if (0 == (0x01 & peasycap_format->mask)) {
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
if (true == resubmit)
|
||||
if (resubmit)
|
||||
submit_video_urbs(peasycap);
|
||||
return (int)(peasycap_best_format - &easycap_format[0]);
|
||||
|
||||
return peasycap_best_format - easycap_format;
|
||||
}
|
||||
/*****************************************************************************/
|
||||
int adjust_brightness(struct easycap *peasycap, int value)
|
||||
@@ -640,8 +648,7 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
|
||||
value = easycap_control[i1].default_value;
|
||||
|
||||
if ((easycap_control[i1].minimum <= peasycap->brightness) &&
|
||||
(easycap_control[i1].maximum >=
|
||||
peasycap->brightness)) {
|
||||
(easycap_control[i1].maximum >= peasycap->brightness)) {
|
||||
if (peasycap->brightness == value) {
|
||||
SAM("unchanged brightness at 0x%02X\n",
|
||||
value);
|
||||
@@ -698,10 +705,8 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
|
||||
value = easycap_control[i1].default_value;
|
||||
|
||||
|
||||
|
||||
if ((easycap_control[i1].minimum <= peasycap->contrast) &&
|
||||
(easycap_control[i1].maximum >=
|
||||
peasycap->contrast)) {
|
||||
(easycap_control[i1].maximum >= peasycap->contrast)) {
|
||||
if (peasycap->contrast == value) {
|
||||
SAM("unchanged contrast at 0x%02X\n", value);
|
||||
return 0;
|
||||
@@ -709,17 +714,17 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
|
||||
}
|
||||
peasycap->contrast = value;
|
||||
for (k = 0; k < INPUT_MANY; k++) {
|
||||
if (!peasycap->inputset[k].contrast_ok) {
|
||||
peasycap->inputset[k].contrast =
|
||||
peasycap->contrast;
|
||||
}
|
||||
if (!peasycap->inputset[k].contrast_ok)
|
||||
peasycap->inputset[k].contrast = peasycap->contrast;
|
||||
}
|
||||
|
||||
if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
|
||||
peasycap->inputset[peasycap->input].contrast =
|
||||
peasycap->contrast;
|
||||
peasycap->inputset[peasycap->input].contrast_ok = 1;
|
||||
} else
|
||||
JOM(8, "%i=peasycap->input\n", peasycap->input);
|
||||
|
||||
mood = 0x00FF & (unsigned int) (peasycap->contrast - 128);
|
||||
if (!write_saa(peasycap->pusb_device, 0x0B, mood)) {
|
||||
SAM("adjusting contrast to 0x%02X\n", mood);
|
||||
@@ -759,8 +764,7 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
|
||||
|
||||
|
||||
if ((easycap_control[i1].minimum <= peasycap->saturation) &&
|
||||
(easycap_control[i1].maximum >=
|
||||
peasycap->saturation)) {
|
||||
(easycap_control[i1].maximum >= peasycap->saturation)) {
|
||||
if (peasycap->saturation == value) {
|
||||
SAM("unchanged saturation at 0x%02X\n",
|
||||
value);
|
||||
@@ -769,11 +773,10 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
|
||||
}
|
||||
peasycap->saturation = value;
|
||||
for (k = 0; k < INPUT_MANY; k++) {
|
||||
if (!peasycap->inputset[k].saturation_ok) {
|
||||
if (!peasycap->inputset[k].saturation_ok)
|
||||
peasycap->inputset[k].saturation =
|
||||
peasycap->saturation;
|
||||
}
|
||||
}
|
||||
if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
|
||||
peasycap->inputset[peasycap->input].saturation =
|
||||
peasycap->saturation;
|
||||
@@ -818,8 +821,7 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
|
||||
value = easycap_control[i1].default_value;
|
||||
|
||||
if ((easycap_control[i1].minimum <= peasycap->hue) &&
|
||||
(easycap_control[i1].maximum >=
|
||||
peasycap->hue)) {
|
||||
(easycap_control[i1].maximum >= peasycap->hue)) {
|
||||
if (peasycap->hue == value) {
|
||||
SAM("unchanged hue at 0x%02X\n", value);
|
||||
return 0;
|
||||
@@ -830,9 +832,8 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
|
||||
if (!peasycap->inputset[k].hue_ok)
|
||||
peasycap->inputset[k].hue = peasycap->hue;
|
||||
}
|
||||
if ((0 <= peasycap->input) && (INPUT_MANY > peasycap->input)) {
|
||||
peasycap->inputset[peasycap->input].hue =
|
||||
peasycap->hue;
|
||||
if (0 <= peasycap->input && INPUT_MANY > peasycap->input) {
|
||||
peasycap->inputset[peasycap->input].hue = peasycap->hue;
|
||||
peasycap->inputset[peasycap->input].hue_ok = 1;
|
||||
} else
|
||||
JOM(8, "%i=peasycap->input\n", peasycap->input);
|
||||
@@ -872,9 +873,9 @@ while (0xFFFFFFFF != easycap_control[i1].id) {
|
||||
if ((easycap_control[i1].minimum > value) ||
|
||||
(easycap_control[i1].maximum < value))
|
||||
value = easycap_control[i1].default_value;
|
||||
|
||||
if ((easycap_control[i1].minimum <= peasycap->volume) &&
|
||||
(easycap_control[i1].maximum >=
|
||||
peasycap->volume)) {
|
||||
(easycap_control[i1].maximum >= peasycap->volume)) {
|
||||
if (peasycap->volume == value) {
|
||||
SAM("unchanged volume at 0x%02X\n", value);
|
||||
return 0;
|
||||
@@ -1041,7 +1042,8 @@ case VIDIOC_QUERYCAP: {
|
||||
strcpy(&version[0], EASYCAP_DRIVER_VERSION);
|
||||
for (i = 0; i < 3; i++)
|
||||
k[i] = 0;
|
||||
p2 = &version[0]; i = 0;
|
||||
p2 = &version[0];
|
||||
i = 0;
|
||||
while (*p2) {
|
||||
p1 = p2;
|
||||
while (*p2 && ('.' != *p2))
|
||||
@@ -1053,8 +1055,7 @@ case VIDIOC_QUERYCAP: {
|
||||
if (rc) {
|
||||
SAM("ERROR: %i=strict_strtol(%s,.,,)\n",
|
||||
rc, p1);
|
||||
mutex_unlock(&easycapdc60_dongle[kd].
|
||||
mutex_video);
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EINVAL;
|
||||
}
|
||||
k[i] = (int)lng;
|
||||
@@ -1063,27 +1064,30 @@ case VIDIOC_QUERYCAP: {
|
||||
}
|
||||
|
||||
memset(&v4l2_capability, 0, sizeof(struct v4l2_capability));
|
||||
strlcpy(&v4l2_capability.driver[0], "easycap",
|
||||
sizeof(v4l2_capability.driver));
|
||||
strlcpy(&v4l2_capability.driver[0],
|
||||
"easycap", sizeof(v4l2_capability.driver));
|
||||
|
||||
v4l2_capability.capabilities =
|
||||
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
|
||||
V4L2_CAP_AUDIO | V4L2_CAP_READWRITE;
|
||||
v4l2_capability.capabilities = V4L2_CAP_VIDEO_CAPTURE |
|
||||
V4L2_CAP_STREAMING |
|
||||
V4L2_CAP_AUDIO |
|
||||
V4L2_CAP_READWRITE;
|
||||
|
||||
v4l2_capability.version = KERNEL_VERSION(k[0], k[1], k[2]);
|
||||
JOM(8, "v4l2_capability.version=(%i,%i,%i)\n", k[0], k[1], k[2]);
|
||||
|
||||
strlcpy(&v4l2_capability.card[0], "EasyCAP DC60",
|
||||
sizeof(v4l2_capability.card));
|
||||
strlcpy(&v4l2_capability.card[0],
|
||||
"EasyCAP DC60", sizeof(v4l2_capability.card));
|
||||
|
||||
if (usb_make_path(peasycap->pusb_device, &v4l2_capability.bus_info[0],
|
||||
if (usb_make_path(peasycap->pusb_device,
|
||||
&v4l2_capability.bus_info[0],
|
||||
sizeof(v4l2_capability.bus_info)) < 0) {
|
||||
|
||||
strlcpy(&v4l2_capability.bus_info[0], "EasyCAP bus_info",
|
||||
sizeof(v4l2_capability.bus_info));
|
||||
JOM(8, "%s=v4l2_capability.bus_info\n",
|
||||
&v4l2_capability.bus_info[0]);
|
||||
}
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_capability,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_capability,
|
||||
sizeof(struct v4l2_capability))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -1097,7 +1101,7 @@ case VIDIOC_ENUMINPUT: {
|
||||
|
||||
JOM(8, "VIDIOC_ENUMINPUT\n");
|
||||
|
||||
if (0 != copy_from_user(&v4l2_input, (void __user *)arg,
|
||||
if (copy_from_user(&v4l2_input, (void __user *)arg,
|
||||
sizeof(struct v4l2_input))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -1113,7 +1117,8 @@ case VIDIOC_ENUMINPUT: {
|
||||
v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
|
||||
v4l2_input.audioset = 0x01;
|
||||
v4l2_input.tuner = 0;
|
||||
v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
|
||||
v4l2_input.std = V4L2_STD_PAL |
|
||||
V4L2_STD_SECAM |
|
||||
V4L2_STD_NTSC ;
|
||||
v4l2_input.status = 0;
|
||||
JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
|
||||
@@ -1186,7 +1191,7 @@ case VIDIOC_ENUMINPUT: {
|
||||
}
|
||||
}
|
||||
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_input,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_input,
|
||||
sizeof(struct v4l2_input))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -1200,7 +1205,7 @@ case VIDIOC_G_INPUT: {
|
||||
JOM(8, "VIDIOC_G_INPUT\n");
|
||||
index = (u32)peasycap->input;
|
||||
JOM(8, "user is told: %i\n", index);
|
||||
if (0 != copy_to_user((void __user *)arg, &index, sizeof(u32))) {
|
||||
if (copy_to_user((void __user *)arg, &index, sizeof(u32))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
}
|
||||
@@ -1254,7 +1259,7 @@ case VIDIOC_ENUMAUDOUT: {
|
||||
|
||||
JOM(8, "VIDIOC_ENUMAUDOUT\n");
|
||||
|
||||
if (0 != copy_from_user(&v4l2_audioout, (void __user *)arg,
|
||||
if (copy_from_user(&v4l2_audioout, (void __user *)arg,
|
||||
sizeof(struct v4l2_audioout))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -1268,7 +1273,7 @@ case VIDIOC_ENUMAUDOUT: {
|
||||
v4l2_audioout.index = 0;
|
||||
strcpy(&v4l2_audioout.name[0], "Soundtrack");
|
||||
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_audioout,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_audioout,
|
||||
sizeof(struct v4l2_audioout))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -1304,7 +1309,7 @@ case VIDIOC_QUERYCTRL: {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_queryctrl,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_queryctrl,
|
||||
sizeof(struct v4l2_queryctrl))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -1377,7 +1382,7 @@ case VIDIOC_G_CTRL: {
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
if (0 != copy_to_user((void __user *)arg, pv4l2_control,
|
||||
if (copy_to_user((void __user *)arg, pv4l2_control,
|
||||
sizeof(struct v4l2_control))) {
|
||||
kfree(pv4l2_control);
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
@@ -1526,7 +1531,7 @@ case VIDIOC_ENUM_FMT: {
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_fmtdesc,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_fmtdesc,
|
||||
sizeof(struct v4l2_fmtdesc))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -1662,7 +1667,7 @@ case VIDIOC_ENUM_FRAMESIZES: {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_frmsizeenum,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_frmsizeenum,
|
||||
sizeof(struct v4l2_frmsizeenum))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -1724,7 +1729,7 @@ case VIDIOC_ENUM_FRAMEINTERVALS: {
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_frmivalenum,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_frmivalenum,
|
||||
sizeof(struct v4l2_frmivalenum))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -1773,7 +1778,7 @@ case VIDIOC_G_FMT: {
|
||||
JOM(8, "user is told: %s\n",
|
||||
&easycap_format[peasycap->format_offset].name[0]);
|
||||
|
||||
if (0 != copy_to_user((void __user *)arg, pv4l2_format,
|
||||
if (copy_to_user((void __user *)arg, pv4l2_format,
|
||||
sizeof(struct v4l2_format))) {
|
||||
kfree(pv4l2_format);
|
||||
kfree(pv4l2_pix_format);
|
||||
@@ -1825,11 +1830,12 @@ case VIDIOC_S_FMT: {
|
||||
memset(&v4l2_pix_format, 0, sizeof(struct v4l2_pix_format));
|
||||
v4l2_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
|
||||
memcpy(&(v4l2_format.fmt.pix), &(easycap_format[best_format]
|
||||
.v4l2_format.fmt.pix), sizeof(v4l2_pix_format));
|
||||
memcpy(&(v4l2_format.fmt.pix),
|
||||
&(easycap_format[best_format].v4l2_format.fmt.pix),
|
||||
sizeof(v4l2_pix_format));
|
||||
JOM(8, "user is told: %s\n", &easycap_format[best_format].name[0]);
|
||||
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_format,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_format,
|
||||
sizeof(struct v4l2_format))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -1866,7 +1872,7 @@ case VIDIOC_CROPCAP: {
|
||||
|
||||
JOM(8, "user is told: %ix%i\n", peasycap->width, peasycap->height);
|
||||
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_cropcap,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_cropcap,
|
||||
sizeof(struct v4l2_cropcap))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -1888,14 +1894,14 @@ case VIDIOC_QUERYSTD: {
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------------*/
|
||||
/*
|
||||
* THE MANIPULATIONS INVOLVING last0,last1,last2,last3 CONSTITUTE A WORKAROUND
|
||||
* FOR WHAT APPEARS TO BE A BUG IN 64-BIT mplayer.
|
||||
* THE MANIPULATIONS INVOLVING last0,last1,last2,last3
|
||||
* CONSTITUTE A WORKAROUND * FOR WHAT APPEARS TO BE
|
||||
* A BUG IN 64-BIT mplayer.
|
||||
* NOT NEEDED, BUT HOPEFULLY HARMLESS, FOR 32-BIT mplayer.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------*/
|
||||
case VIDIOC_ENUMSTD: {
|
||||
int last0 = -1, last1 = -1, last2 = -1, last3 = -1;
|
||||
struct v4l2_standard v4l2_standard;
|
||||
@@ -1911,11 +1917,17 @@ case VIDIOC_ENUMSTD: {
|
||||
}
|
||||
index = v4l2_standard.index;
|
||||
|
||||
last3 = last2; last2 = last1; last1 = last0; last0 = index;
|
||||
last3 = last2;
|
||||
last2 = last1;
|
||||
last1 = last0;
|
||||
last0 = index;
|
||||
if ((index == last3) && (index == last2) &&
|
||||
(index == last1) && (index == last0)) {
|
||||
index++;
|
||||
last3 = last2; last2 = last1; last1 = last0; last0 = index;
|
||||
last3 = last2;
|
||||
last2 = last1;
|
||||
last1 = last0;
|
||||
last0 = index;
|
||||
}
|
||||
|
||||
memset(&v4l2_standard, 0, sizeof(struct v4l2_standard));
|
||||
@@ -1938,7 +1950,7 @@ case VIDIOC_ENUMSTD: {
|
||||
|
||||
v4l2_standard.index = index;
|
||||
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_standard,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_standard,
|
||||
sizeof(struct v4l2_standard))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -1971,7 +1983,7 @@ case VIDIOC_G_STD: {
|
||||
JOM(8, "user is told: %s\n",
|
||||
&peasycap_standard->v4l2_standard.name[0]);
|
||||
|
||||
if (0 != copy_to_user((void __user *)arg, &std_id,
|
||||
if (copy_to_user((void __user *)arg, &std_id,
|
||||
sizeof(v4l2_std_id))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -2010,7 +2022,8 @@ case VIDIOC_REQBUFS: {
|
||||
|
||||
JOM(8, "VIDIOC_REQBUFS\n");
|
||||
|
||||
if (0 != copy_from_user(&v4l2_requestbuffers, (void __user *)arg,
|
||||
if (0 != copy_from_user(&v4l2_requestbuffers,
|
||||
(void __user *)arg,
|
||||
sizeof(struct v4l2_requestbuffers))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -2040,7 +2053,7 @@ case VIDIOC_REQBUFS: {
|
||||
}
|
||||
peasycap->frame_buffer_many = nbuffers;
|
||||
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_requestbuffers,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_requestbuffers,
|
||||
sizeof(struct v4l2_requestbuffers))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -2098,7 +2111,7 @@ case VIDIOC_QUERYBUF: {
|
||||
JOM(16, " %10i=m.offset\n", v4l2_buffer.m.offset);
|
||||
JOM(16, " %10i=length\n", v4l2_buffer.length);
|
||||
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_buffer,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_buffer,
|
||||
sizeof(struct v4l2_buffer))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -2126,7 +2139,7 @@ case VIDIOC_QBUF: {
|
||||
return -EINVAL;
|
||||
}
|
||||
if (v4l2_buffer.index < 0 ||
|
||||
(v4l2_buffer.index >= peasycap->frame_buffer_many)) {
|
||||
v4l2_buffer.index >= peasycap->frame_buffer_many) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -2135,7 +2148,7 @@ case VIDIOC_QBUF: {
|
||||
peasycap->done[v4l2_buffer.index] = 0;
|
||||
peasycap->queued[v4l2_buffer.index] = V4L2_BUF_FLAG_QUEUED;
|
||||
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_buffer,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_buffer,
|
||||
sizeof(struct v4l2_buffer))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -2167,7 +2180,7 @@ case VIDIOC_DQBUF:
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (0 != copy_from_user(&v4l2_buffer, (void __user *)arg,
|
||||
if (copy_from_user(&v4l2_buffer, (void __user *)arg,
|
||||
sizeof(struct v4l2_buffer))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -2178,13 +2191,13 @@ case VIDIOC_DQBUF:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (true == peasycap->offerfields) {
|
||||
/*-----------------------------------------------------------*/
|
||||
if (peasycap->offerfields) {
|
||||
/*---------------------------------------------------*/
|
||||
/*
|
||||
* IN ITS 50 "fps" MODE tvtime SEEMS ALWAYS TO REQUEST
|
||||
* V4L2_FIELD_BOTTOM
|
||||
*/
|
||||
/*-----------------------------------------------------------*/
|
||||
/*---------------------------------------------------*/
|
||||
if (V4L2_FIELD_TOP == v4l2_buffer.field)
|
||||
JOM(8, "user wants V4L2_FIELD_TOP\n");
|
||||
else if (V4L2_FIELD_BOTTOM == v4l2_buffer.field)
|
||||
@@ -2201,13 +2214,15 @@ case VIDIOC_DQBUF:
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EIO;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------------*/
|
||||
/*
|
||||
* IF THE USER HAS PREVIOUSLY CALLED easycap_poll(), AS DETERMINED BY FINDING
|
||||
* THE FLAG peasycap->polled SET, THERE MUST BE NO FURTHER WAIT HERE. IN THIS
|
||||
* IF THE USER HAS PREVIOUSLY CALLED easycap_poll(),
|
||||
* AS DETERMINED BY FINDING
|
||||
* THE FLAG peasycap->polled SET, THERE MUST BE
|
||||
* NO FURTHER WAIT HERE. IN THIS
|
||||
* CASE, JUST CHOOSE THE FRAME INDICATED BY peasycap->frame_read
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
if (!peasycap->polled) {
|
||||
do {
|
||||
@@ -2215,8 +2230,7 @@ case VIDIOC_DQBUF:
|
||||
if (-EIO == rcdq) {
|
||||
JOM(8, "returning -EIO because "
|
||||
"dqbuf() returned -EIO\n");
|
||||
mutex_unlock(&easycapdc60_dongle[kd].
|
||||
mutex_video);
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EIO;
|
||||
}
|
||||
} while (0 != rcdq);
|
||||
@@ -2242,7 +2256,8 @@ case VIDIOC_DQBUF:
|
||||
if (90 < j) {
|
||||
SAM("easycap driver shutting down "
|
||||
"on condition blue\n");
|
||||
peasycap->video_eof = 1; peasycap->audio_eof = 1;
|
||||
peasycap->video_eof = 1;
|
||||
peasycap->audio_eof = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2277,7 +2292,7 @@ case VIDIOC_DQBUF:
|
||||
JOM(16, " %10i=m.offset\n", v4l2_buffer.m.offset);
|
||||
JOM(16, " %10i=length\n", v4l2_buffer.length);
|
||||
|
||||
if (0 != copy_to_user((void __user *)arg, &v4l2_buffer,
|
||||
if (copy_to_user((void __user *)arg, &v4l2_buffer,
|
||||
sizeof(struct v4l2_buffer))) {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -2333,7 +2348,8 @@ case VIDIOC_STREAMOFF: {
|
||||
}
|
||||
|
||||
peasycap->video_idle = 1;
|
||||
peasycap->audio_idle = 1; peasycap->timeval0.tv_sec = 0;
|
||||
peasycap->audio_idle = 1;
|
||||
peasycap->timeval0.tv_sec = 0;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
* IF THE WAIT QUEUES ARE NOT CLEARED IN RESPONSE TO THE STREAMOFF COMMAND
|
||||
@@ -2363,8 +2379,8 @@ case VIDIOC_G_PARM: {
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -ENOMEM;
|
||||
}
|
||||
if (0 != copy_from_user(pv4l2_streamparm, (void __user *)arg,
|
||||
sizeof(struct v4l2_streamparm))) {
|
||||
if (copy_from_user(pv4l2_streamparm,
|
||||
(void __user *)arg, sizeof(struct v4l2_streamparm))) {
|
||||
kfree(pv4l2_streamparm);
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
return -EFAULT;
|
||||
@@ -2395,7 +2411,8 @@ case VIDIOC_G_PARM: {
|
||||
pv4l2_streamparm->parm.capture.readbuffers =
|
||||
peasycap->frame_buffer_many;
|
||||
pv4l2_streamparm->parm.capture.extendedmode = 0;
|
||||
if (0 != copy_to_user((void __user *)arg, pv4l2_streamparm,
|
||||
if (copy_to_user((void __user *)arg,
|
||||
pv4l2_streamparm,
|
||||
sizeof(struct v4l2_streamparm))) {
|
||||
kfree(pv4l2_streamparm);
|
||||
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
|
||||
|
Reference in New Issue
Block a user