Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236108
b: refs/heads/master
c: b4a5916
h: refs/heads/master
v: v3
  • Loading branch information
Tomas Winkler authored and Greg Kroah-Hartman committed Feb 23, 2011
1 parent c1a6254 commit 3c0b286
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 67 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e03da5e2b77dee7d0535c036a09e9f613dce7c48
refs/heads/master: b4a5916e6bdbd5585a961179799a59871d8722cc
105 changes: 39 additions & 66 deletions trunk/drivers/staging/easycap/easycap_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3177,6 +3177,8 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
u16 mask;
s32 value;
struct easycap_format *peasycap_format;
int fmtidx;
struct inputset *inputset;
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
#ifdef EASYCAP_IS_VIDEODEV_CLIENT
struct v4l2_device *pv4l2_device;
Expand Down Expand Up @@ -3345,116 +3347,87 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
* ... AND POPULATE easycap.inputset[]
*/
/*---------------------------------------------------------------------------*/
/* FIXME: maybe we just use memset 0 */
inputset = peasycap->inputset;
for (k = 0; k < INPUT_MANY; k++) {
peasycap->inputset[k].input_ok = 0;
peasycap->inputset[k].standard_offset_ok = 0;
peasycap->inputset[k].format_offset_ok = 0;
peasycap->inputset[k].brightness_ok = 0;
peasycap->inputset[k].contrast_ok = 0;
peasycap->inputset[k].saturation_ok = 0;
peasycap->inputset[k].hue_ok = 0;
inputset[k].input_ok = 0;
inputset[k].standard_offset_ok = 0;
inputset[k].format_offset_ok = 0;
inputset[k].brightness_ok = 0;
inputset[k].contrast_ok = 0;
inputset[k].saturation_ok = 0;
inputset[k].hue_ok = 0;
}
if (true == peasycap->ntsc) {
i = 0;
m = 0;
mask = 0;
while (0xFFFF != easycap_standard[i].mask) {
if (NTSC_M == easycap_standard[i].
v4l2_standard.index) {
m++;
for (k = 0; k < INPUT_MANY; k++) {
peasycap->inputset[k].
standard_offset = i;
}
mask = easycap_standard[i].mask;
}
i++;
}
} else {
i = 0;
m = 0;
mask = 0;
while (0xFFFF != easycap_standard[i].mask) {
if (PAL_BGHIN == easycap_standard[i].
v4l2_standard.index) {
m++;
for (k = 0; k < INPUT_MANY; k++) {
peasycap->inputset[k].
standard_offset = i;
}

fmtidx = peasycap->ntsc ? NTSC_M : PAL_BGHIN;
m = 0;
mask = 0;
for (i = 0; 0xFFFF != easycap_standard[i].mask; i++) {
if (fmtidx == easycap_standard[i].v4l2_standard.index) {
m++;
for (k = 0; k < INPUT_MANY; k++)
inputset[k].standard_offset = i;

mask = easycap_standard[i].mask;
}
i++;
}
}

if (1 != m) {
SAM("MISTAKE: easycap.inputset[].standard_offset "
"unpopulated, %i=m\n", m);
SAM("ERROR: "
"inputset->standard_offset unpopulated, %i=m\n", m);
return -ENOENT;
}

peasycap_format = &easycap_format[0];
i = 0;
m = 0;
while (0 != peasycap_format->v4l2_format.fmt.pix.width) {
for (i = 0; peasycap_format->v4l2_format.fmt.pix.width; i++) {
struct v4l2_pix_format *pix =
&peasycap_format->v4l2_format.fmt.pix;
if (((peasycap_format->mask & 0x0F) == (mask & 0x0F)) &&
(peasycap_format->
v4l2_format.fmt.pix.field ==
V4L2_FIELD_NONE) &&
(peasycap_format->
v4l2_format.fmt.pix.pixelformat ==
V4L2_PIX_FMT_UYVY) &&
(peasycap_format->
v4l2_format.fmt.pix.width ==
640) &&
(peasycap_format->
v4l2_format.fmt.pix.height == 480)) {
pix->field == V4L2_FIELD_NONE &&
pix->pixelformat == V4L2_PIX_FMT_UYVY &&
pix->width == 640 && pix->height == 480) {
m++;
for (k = 0; k < INPUT_MANY; k++)
peasycap->inputset[k].format_offset = i;
inputset[k].format_offset = i;
break;
}
peasycap_format++;
i++;
}
if (1 != m) {
SAM("MISTAKE: easycap.inputset[].format_offset unpopulated\n");
SAM("ERROR: inputset[]->format_offset unpopulated\n");
return -ENOENT;
}

i = 0;
m = 0;
while (0xFFFFFFFF != easycap_control[i].id) {
for (i = 0; 0xFFFFFFFF != easycap_control[i].id; i++) {
value = easycap_control[i].default_value;
if (V4L2_CID_BRIGHTNESS == easycap_control[i].id) {
m++;
for (k = 0; k < INPUT_MANY; k++)
peasycap->inputset[k].brightness = value;
inputset[k].brightness = value;
} else if (V4L2_CID_CONTRAST == easycap_control[i].id) {
m++;
for (k = 0; k < INPUT_MANY; k++)
peasycap->inputset[k].contrast = value;
inputset[k].contrast = value;
} else if (V4L2_CID_SATURATION == easycap_control[i].id) {
m++;
for (k = 0; k < INPUT_MANY; k++)
peasycap->inputset[k].saturation = value;
inputset[k].saturation = value;
} else if (V4L2_CID_HUE == easycap_control[i].id) {
m++;
for (k = 0; k < INPUT_MANY; k++)
peasycap->inputset[k].hue = value;
inputset[k].hue = value;
}
i++;
}

if (4 != m) {
SAM("MISTAKE: easycap.inputset[].brightness,... "
"underpopulated\n");
SAM("ERROR: inputset[]->brightness underpopulated\n");
return -ENOENT;
}
for (k = 0; k < INPUT_MANY; k++)
peasycap->inputset[k].input = k;
JOM(4, "populated easycap.inputset[]\n");
inputset[k].input = k;
JOM(4, "populated inputset[]\n");
JOM(4, "finished initialization\n");
} else {
/*---------------------------------------------------------------------------*/
Expand Down

0 comments on commit 3c0b286

Please sign in to comment.