diff -Naur pwc-v4l2-20051228-042701/pwc-ctrl.c pwc-mine/pwc-ctrl.c --- pwc-v4l2-20051228-042701/pwc-ctrl.c 2005-11-15 17:10:35.000000000 +0100 +++ pwc-mine/pwc-ctrl.c 2005-12-30 19:03:27.000000000 +0100 @@ -999,7 +999,7 @@ return 0; } -static inline int pwc_set_contour(struct pwc_device *pdev, int contour) +inline int pwc_set_contour(struct pwc_device *pdev, int contour) { unsigned char buf; int ret; @@ -1024,7 +1024,7 @@ return 0; } -static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) +inline int pwc_get_contour(struct pwc_device *pdev, int *contour) { unsigned char buf; int ret; @@ -1046,7 +1046,7 @@ } -static inline int pwc_set_backlight(struct pwc_device *pdev, int backlight) +inline int pwc_set_backlight(struct pwc_device *pdev, int backlight) { unsigned char buf; @@ -1057,7 +1057,7 @@ return SendControlMsg(SET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1); } -static inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight) +inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight) { int ret; unsigned char buf; @@ -1069,8 +1069,31 @@ return 0; } +int pwc_set_colour_mode(struct pwc_device *pdev, int colour) +{ + unsigned char buf; + + if (colour) + buf = 0xff; + else + buf = 0x0; + return SendControlMsg(SET_CHROM_CTL, COLOUR_MODE_FORMATTER, 1); +} + +int pwc_get_colour_mode(struct pwc_device *pdev, int *colour) +{ + int ret; + unsigned char buf; + + ret = RecvControlMsg(GET_CHROM_CTL, COLOUR_MODE_FORMATTER, 1); + if (ret < 0) + return ret; + *colour = buf; + return 0; +} -static inline int pwc_set_flicker(struct pwc_device *pdev, int flicker) + +inline int pwc_set_flicker(struct pwc_device *pdev, int flicker) { unsigned char buf; @@ -1081,7 +1104,7 @@ return SendControlMsg(SET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1); } -static inline int pwc_get_flicker(struct pwc_device *pdev, int *flicker) +inline int pwc_get_flicker(struct pwc_device *pdev, int *flicker) { int ret; unsigned char buf; @@ -1093,8 +1116,7 @@ return 0; } - -static inline int pwc_set_dynamic_noise(struct pwc_device *pdev, int noise) +inline int pwc_set_dynamic_noise(struct pwc_device *pdev, int noise) { unsigned char buf; @@ -1106,7 +1128,7 @@ return SendControlMsg(SET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1); } -static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) +inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) { int ret; unsigned char buf; diff -Naur pwc-v4l2-20051228-042701/pwc.h pwc-mine/pwc.h --- pwc-v4l2-20051228-042701/pwc.h 2005-11-15 17:10:35.000000000 +0100 +++ pwc-mine/pwc.h 2005-12-30 19:04:31.000000000 +0100 @@ -288,6 +288,17 @@ extern int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int value); extern int pwc_get_shutter_speed(struct pwc_device *pdev, int *value); +extern int pwc_set_colour_mode(struct pwc_device *pdev, int colour); +extern int pwc_get_colour_mode(struct pwc_device *pdev, int *colour); +extern int pwc_set_contour(struct pwc_device *pdev, int contour); +extern int pwc_get_contour(struct pwc_device *pdev, int *contour); +extern int pwc_set_backlight(struct pwc_device *pdev, int backlight); +extern int pwc_get_backlight(struct pwc_device *pdev, int *backlight); +extern int pwc_set_flicker(struct pwc_device *pdev, int flicker); +extern int pwc_get_flicker(struct pwc_device *pdev, int *flicker); +extern int pwc_set_dynamic_noise(struct pwc_device *pdev, int noise); +extern int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise); + /* Power down or up the camera; not supported by all models */ extern int pwc_camera_power(struct pwc_device *pdev, int power); diff -Naur pwc-v4l2-20051228-042701/pwc-ioctl.h pwc-mine/pwc-ioctl.h --- pwc-v4l2-20051228-042701/pwc-ioctl.h 2005-02-21 00:03:20.000000000 +0100 +++ pwc-mine/pwc-ioctl.h 2005-12-30 17:37:53.000000000 +0100 @@ -302,6 +302,12 @@ #define V4L2_CID_PRIVATE_SAVE_USER (V4L2_CID_PRIVATE_BASE + 0) #define V4L2_CID_PRIVATE_RESTORE_USER (V4L2_CID_PRIVATE_BASE + 1) #define V4L2_CID_PRIVATE_RESTORE_FACTORY (V4L2_CID_PRIVATE_BASE + 2) +#define V4L2_CID_PRIVATE_COLOUR_MODE (V4L2_CID_PRIVATE_BASE + 3) +#define V4L2_CID_PRIVATE_AUTOCONTOUR (V4L2_CID_PRIVATE_BASE + 4) +#define V4L2_CID_PRIVATE_CONTOUR (V4L2_CID_PRIVATE_BASE + 5) +#define V4L2_CID_PRIVATE_BACKLIGHT (V4L2_CID_PRIVATE_BASE + 6) +#define V4L2_CID_PRIVATE_FLICKERLESS (V4L2_CID_PRIVATE_BASE + 7) +#define V4L2_CID_PRIVATE_NOISE_REDUCTION (V4L2_CID_PRIVATE_BASE + 8) #endif diff -Naur pwc-v4l2-20051228-042701/pwc-v4l.c pwc-mine/pwc-v4l.c --- pwc-v4l2-20051228-042701/pwc-v4l.c 2005-11-15 17:10:35.000000000 +0100 +++ pwc-mine/pwc-v4l.c 2005-12-30 17:37:28.000000000 +0100 @@ -128,6 +128,7 @@ .step = 1, .default_value = 0, }, +#define XAWTV_HAS_BEEN_FIXED 1 #if XAWTV_HAS_BEEN_FIXED { .id = V4L2_CID_PRIVATE_SAVE_USER, @@ -155,7 +156,61 @@ .maximum = 0, .step = 0, .default_value = 0, - }, + }, + { + .id = V4L2_CID_PRIVATE_COLOUR_MODE, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Colour mode", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 0, + }, + { + .id = V4L2_CID_PRIVATE_AUTOCONTOUR, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Auto contour", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 0, + }, + { + .id = V4L2_CID_PRIVATE_CONTOUR, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Contour", + .minimum = 0, + .maximum = 63, + .step = 1, + .default_value = 0, + }, + { + .id = V4L2_CID_PRIVATE_BACKLIGHT, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Backlight compensation", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 0, + }, + { + .id = V4L2_CID_PRIVATE_FLICKERLESS, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Flickerless", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 0, + }, + { + .id = V4L2_CID_PRIVATE_NOISE_REDUCTION, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Noise reduction", + .minimum = 0, + .maximum = 3, + .step = 1, + .default_value = 0, + }, #endif }; @@ -657,7 +712,43 @@ return -EINVAL; c->value >>= 8; return 0; - case V4L2_CID_PRIVATE_SAVE_USER: + case V4L2_CID_PRIVATE_COLOUR_MODE: + ret = pwc_get_colour_mode(pdev, &c->value); + if (ret < 0) + return -EINVAL; + c->value=(c->value?1:0); + return 0; + + case V4L2_CID_PRIVATE_AUTOCONTOUR: + ret = pwc_get_contour(pdev, &c->value); + if (ret < 0) + return -EINVAL; + c->value=(c->value == -1?1:0); + return 0; + case V4L2_CID_PRIVATE_CONTOUR: + ret = pwc_get_contour(pdev, &c->value); + if (ret < 0) + return -EINVAL; + c->value >>= 10; + return 0; + case V4L2_CID_PRIVATE_BACKLIGHT: + ret = pwc_get_backlight(pdev, &c->value); + if (ret < 0) + return -EINVAL; + c->value=(c->value?1:0); + return 0; + case V4L2_CID_PRIVATE_FLICKERLESS: + ret = pwc_get_flicker(pdev, &c->value); + if (ret < 0) + return -EINVAL; + c->value=(c->value?1:0); + case V4L2_CID_PRIVATE_NOISE_REDUCTION: + ret = pwc_get_dynamic_noise(pdev, &c->value); + if (ret < 0) + return -EINVAL; + return 0; + + case V4L2_CID_PRIVATE_SAVE_USER: case V4L2_CID_PRIVATE_RESTORE_USER: case V4L2_CID_PRIVATE_RESTORE_FACTORY: return -EINVAL; @@ -672,19 +763,25 @@ switch (c->id) { case V4L2_CID_BRIGHTNESS: - c->value <<= 8; + c->value <<= 9; ret = pwc_set_brightness(pdev, c->value); if (ret<0) return -EINVAL; return 0; case V4L2_CID_CONTRAST: - c->value <<= 8; + c->value <<= 10; ret = pwc_set_contrast(pdev, c->value); if (ret<0) return -EINVAL; return 0; + case V4L2_CID_SATURATION: + c->value = 32768 + c->value * 327; + ret = pwc_set_saturation(pdev, c->value); + if (ret<0) + return -EINVAL; + return 0; case V4L2_CID_GAMMA: - c->value <<= 8; + c->value <<= 11; ret = pwc_set_gamma(pdev, c->value); if (ret<0) return -EINVAL; @@ -739,6 +836,38 @@ if (pwc_restore_factory(pdev)) return -EINVAL; return 0; + case V4L2_CID_PRIVATE_COLOUR_MODE: + ret = pwc_set_colour_mode(pdev, c->value); + if (ret < 0) + return -EINVAL; + return 0; + case V4L2_CID_PRIVATE_AUTOCONTOUR: + c->value=(c->value == 1)?-1:0; + ret = pwc_set_contour(pdev, c->value); + if (ret < 0) + return -EINVAL; + return 0; + case V4L2_CID_PRIVATE_CONTOUR: + c->value <<= 10; + ret = pwc_set_contour(pdev, c->value); + if (ret < 0) + return -EINVAL; + return 0; + case V4L2_CID_PRIVATE_BACKLIGHT: + ret = pwc_set_backlight(pdev, c->value); + if (ret < 0) + return -EINVAL; + return 0; + case V4L2_CID_PRIVATE_FLICKERLESS: + ret = pwc_set_flicker(pdev, c->value); + if (ret < 0) + return -EINVAL; + case V4L2_CID_PRIVATE_NOISE_REDUCTION: + ret = pwc_set_dynamic_noise(pdev, c->value); + if (ret < 0) + return -EINVAL; + return 0; + } return -EINVAL; }