Brian Johnson schrieb:
This took a while to go through - you should post more often ;) . Seriously - some of my patches are obsolete now (which is in most cases a Good Thing) and I'd rather spend my time productively.Anyway - great stuff. 0001: - reduces code, no loss, push it! 0002: - I know nothing about that stuff (and I don't use it) 0003: - great idea - I always figured we need to be able to disable it via libv4l but your solution is much more elegant (and simple). 0004: - Hey - I already tried that last summer! Why the sudden change of mind? Anyway - I support it. 0005: - I see this patch would simplify some things however I'm not sure I like the v4l cids to be mixed in thereWell originally I was using my own set of defines for the IDs but then I realized that would mean I would need a switch statement in both the set_camera_control function and the s_fmt function. Using the same id in both places means I can just call this function passing it the v4l2 ID and value received in the s_fmt function without using the second switch statement. It seemed better to reuse the v4l2 IDs instead.0006: - I don't get your argumentation - why not put the max to 0xffff and allow a more exact setting. I know that most sensors (especially ov sensors) usually only offer 8-bit contrls but there are quite some exceptions. The integer type is necessary anyway (to be v4l2 compliant).Well currently the code was zeroing the lower byte when setting a value, so we were only really using a single byte anyways. I simply made the max value representative of what we actually use.It still uses any integer type all this does is set the max permissible value to 0xff thats perfectly ok by the v4l2 specs.0007: - makes sense 0008: - no objections 0009: - ok, but maybe a "bandwidth" parameter will make them interesting in the future (AMcap has a similar setting)I believe AMcap bandwidth just changes what alternate setting is used which neither of those functions did. At anyrate I don't think its really a good idea keeping unused functions around simply because we might use them later. If we need them later its not that much of a problem to reimplement them at a later date.0010: I agree (my sensor only offers bayer ;) ), however libv4l inclusion of the old decoders will become even more important because of this. Who's on it?Yes i agree looking at getting the bridge specific formats included in v4l specs would be a good idea. Do we currently have any documentation describing the layout of those two formats?0011: no objections 0012: no objections 0013: - the last break statement before default is missing in the big switch (maybe not necessary?) - else ok with meOops yeah that missing break should be there or the hv7131r sensor won't work. Attached fixed patch for it.Looks like need to rebase some stuff ;) . GWater--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I'm ok with these patches, if something proves to be unhelpful we can always find a better solution.
Here are my remaining patches - recreated to fit the new function, var, etc. names.
Happy new year, GWater
From 62e771418a0eda68085e913a756902c7e838c523 Mon Sep 17 00:00:00 2001 From: GWater <[email protected]> Date: Thu, 1 Jan 2009 15:17:13 +0100 Subject: [PATCH] Implement V4L2_CTRL_FLAG_NEXT_CTRL Signed-off-by: GWater <[email protected]> --- sn9c20x-v4l2.c | 38 +++++++++++++++++++++++++++++++++----- 1 files changed, 33 insertions(+), 5 deletions(-) diff --git a/sn9c20x-v4l2.c b/sn9c20x-v4l2.c index 3304d2c..226a45b 100644 --- a/sn9c20x-v4l2.c +++ b/sn9c20x-v4l2.c @@ -750,14 +750,42 @@ int sn9c20x_vidioc_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *ctrl) { int i; +#ifdef V4L2_CTRL_FLAG_NEXT_CTRL + int min; + __u32 idnew, idlast; +#endif + UDIA_DEBUG("VIDIOC_QUERYCTRL id = %d\n", ctrl->id); - for (i = 0; i < ARRAY_SIZE(sn9c20x_controls); i++) { - if (sn9c20x_controls[i].id == ctrl->id) { +#ifdef V4L2_CTRL_FLAG_NEXT_CTRL + if (ctrl->id & V4L2_CTRL_FLAG_NEXT_CTRL) { + min = 0; + idnew = V4L2_CTRL_FLAG_NEXT_CTRL; + idlast = ctrl->id & ~V4L2_CTRL_FLAG_NEXT_CTRL; + for (i = 0; i < ARRAY_SIZE(sn9c20x_controls); i++) { + if ((sn9c20x_controls[i].id < idnew) && + (sn9c20x_controls[i].id > idlast)) { + idnew = sn9c20x_controls[i].id; + min = i; + } + } + if (idnew != V4L2_CTRL_FLAG_NEXT_CTRL) { UDIA_DEBUG("VIDIOC_QUERYCTRL found\n"); - memcpy(ctrl, &sn9c20x_controls[i], - sizeof(struct v4l2_queryctrl)); - break; + memcpy(ctrl, &sn9c20x_controls[min], + sizeof(struct v4l2_queryctrl)); + return 0; + } else + return -EINVAL; + } else +#endif + { + for (i = 0; i < ARRAY_SIZE(sn9c20x_controls); i++) { + if (sn9c20x_controls[i].id == ctrl->id) { + UDIA_DEBUG("VIDIOC_QUERYCTRL found\n"); + memcpy(ctrl, &sn9c20x_controls[i], + sizeof(struct v4l2_queryctrl)); + break; + } } } -- 1.6.0.6
From 99e2acbcf3e34fe53c82c7023dea31c93350fc66 Mon Sep 17 00:00:00 2001 From: GWater <[email protected]> Date: Thu, 1 Jan 2009 15:21:28 +0100 Subject: [PATCH] Sensor inititalization has to be successful Signed-off-by: GWater <[email protected]> --- sn9c20x-bridge.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/sn9c20x-bridge.c b/sn9c20x-bridge.c index a843553..418ba5b 100644 --- a/sn9c20x-bridge.c +++ b/sn9c20x-bridge.c @@ -903,7 +903,7 @@ int sn9c20x_initialize(struct usb_sn9c20x *dev) goto err; ret = sn9c20x_initialize_sensor(dev); - return 0; + return ret; err: UDIA_ERROR("Device Init failed (%d)!\n", ret); -- 1.6.0.6
From 0b4fd6c83dd7f530e5395f3e61d06a8e341e5688 Mon Sep 17 00:00:00 2001 From: GWater <[email protected]> Date: Thu, 1 Jan 2009 15:26:05 +0100 Subject: [PATCH] Add LED control for MT9V111 based cameras Signed-off-by: GWater <[email protected]> --- sn9c20x-bridge.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sn9c20x-bridge.c b/sn9c20x-bridge.c index 418ba5b..ad12e8e 100644 --- a/sn9c20x-bridge.c +++ b/sn9c20x-bridge.c @@ -175,16 +175,20 @@ int sn9c20x_set_LEDs(struct usb_sn9c20x *dev, int enable) case SOI968_SENSOR: led[0] = 0x80; led[1] = 0xa0; - break; + break; case MT9V011_SENSOR: case OV7660_SENSOR: led[0] = 0x40; led[1] = 0x60; - break; + break; case MT9M111_SENSOR: led[0] = 0x00; led[1] = 0x60; - break; + break; + case MT9V111_SENSOR: + led[0] = 0xc0; + led[1] = 0xe0; + break; default: led[0] = 0x00; led[1] = 0x20; @@ -196,12 +200,16 @@ int sn9c20x_set_LEDs(struct usb_sn9c20x *dev, int enable) case MT9V011_SENSOR: led[0] = 0xa0; led[1] = 0xa0; - break; + break; case MT9M111_SENSOR: case OV7660_SENSOR: led[0] = 0x20; led[1] = 0x60; - break; + break; + case MT9V111_SENSOR: + led[0] = 0x80; + led[1] = 0xe0; + break; default: led[0] = 0x20; led[1] = 0x20; -- 1.6.0.6
signature.asc
Description: OpenPGP digital signature
