Ok just took a quick look at amsn source and yes the code for setting
an attribute is definitely broken it checks the value tht you are
setting for a range of 0 - 65535. this is definitely wrong as av4l2
control value is first of all signed and second of all it should be
using its defined min/max values anyways. I attached a quick patch
that fixes this issue with amsn in case anyone is interested.

Also kopete seems to have two issues one it appears it also doesn't
bother to consider that a control value can be negative and kopete
actually natively knows bayer format whcih unless i use somethign like
libv4l it will use by default. and none of the controls that use our
bridges color matrix (hue/sat/contrast/brightness) work when using
bayer since it is not being converted to YUV. this is one reason you
should not use bayer unless there is no other choice.

Also I'm of the mind that we should not modify our driver in order to
fix broken applications. The more correct thing will be to patch the
applications to properly follow v4l2 specs. In this case allow
controls with negative values.

2009/3/20 Boris Borisov <[email protected]>:
> I forget! Also kopette is not support correctly hue tuning
>
> Brian Johnson wrote:
>
> So you are saying the that when you use v4lucp to adjust the hue
> control below 0 that he hue does not actually change? And that the
> function sn9c20x_set_optical_parameters is never called?
>
> 2009/3/19 Boris Borisov <[email protected]>:
>
>
> Exactly the function is not call via V4L for negative hue. And I not
> found the reason for missing call.
>
> Brian Johnson wrote:
>
>
> Boris,
> I'm not sure what you mean by the function is not being called when
> hue is negative using this patch it certainly seems to work with
> negative hues for me. About the issue with sysfs i did a quick
> modification that should fix that
>
> 2009/3/19 Boris Borisov <[email protected]>:
>
>
>
> Brian,
> I get the current version of driver and apply the my patc and your
> changes for range. But from V4L if hue is negative the set function is
> not call. I can't find where is mistake. I attach the patches. Also from
> sysfs the values is only positive.
> Brian Johnson wrote:
>
>
>
> Boris,
>
> Can you post a fixed patch ithat includes the -180 - 180 fix plus
> fxing th checkpatch.pl errors and adding the code to add hue as a
> module param?
>
> If you post the patch in the thread i created called weekend patches
> it willl give us till the end of sunday for people to hoopefully look
> at and review the patch before actually committing it.
>
> 2009/3/19 Boris Borisov <[email protected]>:
>
>
>
>
> I agree. The mistake is my because I working in night and firs version is
> similar as you patch and hue betweeh -180 and 180 degree. But after coup of
>
>
>
>
> snip
>
>
>
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Lets make microdia webcams plug'n play, (currently plug'n pray)
To post to this group, send email to [email protected]
Visit us online https://groups.google.com/group/microdia
-~----------~----~----~----~------~----~------~--~---

diff -Naur amsn-0.97.2~debian.orig/utils/linux/capture/capture.c amsn-0.97.2~debian/utils/linux/capture/capture.c
--- amsn-0.97.2~debian.orig/utils/linux/capture/capture.c	2008-05-28 07:37:45.000000000 -0400
+++ amsn-0.97.2~debian/utils/linux/capture/capture.c	2009-03-20 04:51:20.000000000 -0400
@@ -867,15 +867,13 @@
     return TCL_OK;
   }
   
-  if (new_value > 65535 || new_value < 0) {
-//    Tcl_SetResult(interp, "Invalid value. It should be between 0 and 65535" , TCL_STATIC);
-//    return TCL_ERROR;
-    return TCL_OK;
-  }
-  
   // Get the ng_attribute struct from the attribute id
   attr = ng_attr_byid(&(capItem->dev), attribute);
   
+  if (new_value > attr->max || new_value < attr->min) {
+    return TCL_OK;
+  }
+
   // Set attribute value using attribute->write proc...
   if (attr != NULL) {
       if (new_value != -1)

Reply via email to