From: Peter S. <pe...@st...> - 2011-04-15 16:55:13
|
From: Cristi Posoiu <cri...@gm...> This patch was taken from http://sourceforge.net/tracker/?func=detail&aid=3201636&group_id=178178&atid=884193 Signed-off-by: Peter Stuge <pe...@st...> --- stk11xx-usb.c | 5 +++++ stk11xx-v4l.c | 16 ++++++++++++++++ stk11xx.h | 6 ++++++ 3 files changed, 27 insertions(+), 0 deletions(-) diff --git a/stk11xx-usb.c b/stk11xx-usb.c index e952256..c065aab 100644 --- a/stk11xx-usb.c +++ b/stk11xx-usb.c @@ -691,6 +691,11 @@ static int usb_stk11xx_default_settings(struct usb_stk11xx *dev) return -1; } + dev->vsettings.default_brightness = dev->vsettings.brightness; + dev->vsettings.default_whiteness = dev->vsettings.whiteness; + dev->vsettings.default_contrast = dev->vsettings.contrast; + dev->vsettings.default_colour = dev->vsettings.colour; + return 0; } diff --git a/stk11xx-v4l.c b/stk11xx-v4l.c index aa23115..69b2e23 100644 --- a/stk11xx-v4l.c +++ b/stk11xx-v4l.c @@ -74,6 +74,7 @@ const struct stk11xx_coord stk11xx_image_sizes[STK11XX_NBR_SIZES] = { /** * @var stk11xx_controls * List of all V4Lv2 controls supported by the driver + * default_value field will be overridden at runtime */ static struct v4l2_queryctrl stk11xx_controls[] = { { @@ -1100,6 +1101,21 @@ static long v4l_stk11xx_do_ioctl(struct file *fp, if (stk11xx_controls[i].id == c->id) { STK_DEBUG("VIDIOC_QUERYCTRL found\n"); memcpy(c, &stk11xx_controls[i], sizeof(struct v4l2_queryctrl)); + switch(c->id) + { + case V4L2_CID_BRIGHTNESS: + c->default_value = dev->vsettings.default_brightness; + break; + case V4L2_CID_WHITENESS: + c->default_value = dev->vsettings.default_whiteness; + break; + case V4L2_CID_SATURATION: + c->default_value = dev->vsettings.default_colour; + break; + case V4L2_CID_CONTRAST: + c->default_value = dev->vsettings.default_contrast; + break; + } break; } } diff --git a/stk11xx.h b/stk11xx.h index a633b32..719d2fb 100644 --- a/stk11xx.h +++ b/stk11xx.h @@ -299,6 +299,12 @@ struct stk11xx_video { int vflip; /**< Vertical flip */ int input; /**< Input for multiinput cards */ int norm; /**< Norm, NTSC or PAL */ + + /* Default values for the device. Above are values currently in use. */ + int default_brightness; + int default_contrast; + int default_colour; + int default_whiteness; }; -- 1.7.0.4 |