Yeah thats it. you still need to modify usb_sn9c20x_init o allow 2 as a valid value for the jpeg parameter, bot except for that it is looks fine to me.
On Thu, Jan 15, 2009 at 2:49 PM, GWater <[email protected]> wrote: > Brian Johnson schrieb: >> >> Ok i also realized ou will probably want to add a field to our device >> structure called jpeg copy the module param value to that durring the >> default_settings call and check it to see if it is set to auto and if >> so update it. Then the various checks that our driver does to >> enable/disable jeg format shoud now check this device specific value. >> This shold make things work as expected when auto detection is turned >> on and you have moe then one device attached. >> > > > Is this what you had in mind? > > GWater > > From a0acb2afe1d08196df6fe94ff72b12172d6e47c2 Mon Sep 17 00:00:00 2001 > From: GWater <[email protected]> > Date: Wed, 14 Jan 2009 23:16:15 +0100 > Subject: [PATCH] Disable JPEG for high-speed USB 2.0 by default > > Signed-off-by: GWater <[email protected]> > --- > sn9c20x-usb.c | 12 ++++++++++-- > sn9c20x-v4l2.c | 4 ++-- > sn9c20x.h | 2 ++ > 3 files changed, 14 insertions(+), 4 deletions(-) > > diff --git a/sn9c20x-usb.c b/sn9c20x-usb.c > index f001016..1afa714 100644 > --- a/sn9c20x-usb.c > +++ b/sn9c20x-usb.c > @@ -57,7 +57,7 @@ static __u8 bulk; > * @var jpeg > * Module parameter to enable/disable JPEG format > */ > -__u8 jpeg = 1; > +__u8 jpeg = 2; > > /** > * @var bandwidth > @@ -728,6 +728,14 @@ static int usb_sn9c20x_default_settings(struct > usb_sn9c20x *dev) > v4l2_set_control_default(dev, V4L2_CID_AUTO_WHITE_BALANCE, > auto_whitebalance); > v4l2_set_control_default(dev, V4L2_CID_EXPOSURE, exposure); > > + if (jpeg == 2) { > + if (dev->udev->speed == USB_SPEED_HIGH && bandwidth == 8) > + dev->jpeg = 0; > + else > + dev->jpeg = 1; > + } else > + dev->jpeg = jpeg; > + > sn9c20x_set_resolution(dev, 640, 480); > sn9c20x_set_format(dev, sn9c20x_fmts[0].pix_fmt); > > @@ -1029,7 +1037,7 @@ module_exit(usb_sn9c20x_exit); /**< @brief Module > exit */ > > > MODULE_PARM_DESC(fps, "Frames per second [10-30]"); /**< @brief > Description of 'fps' parameter */ > -MODULE_PARM_DESC(jpeg, "Enable JPEG support (default is enabled)"); > +MODULE_PARM_DESC(jpeg, "Enable JPEG support (default is auto-detect)"); > MODULE_PARM_DESC(bulk, "Enable Bulk transfer (default is to use ISOC)"); > MODULE_PARM_DESC(bandwidth, "Bandwidth Setting (only for ISOC)"); > MODULE_PARM_DESC(hflip, "Horizontal image flip"); /**< @brief > Description of 'hflip' parameter */ > diff --git a/sn9c20x-v4l2.c b/sn9c20x-v4l2.c > index 5c7d47b..4ecec35 100644 > --- a/sn9c20x-v4l2.c > +++ b/sn9c20x-v4l2.c > @@ -922,7 +922,7 @@ int sn9c20x_vidioc_enum_fmt_cap(struct file *file, void > *priv, > fmt->flags = 0; > fmt->pixelformat = sn9c20x_fmts[fmt->index].pix_fmt; > > - if (fmt->pixelformat == V4L2_PIX_FMT_JPEG && jpeg == 0) > + if (fmt->pixelformat == V4L2_PIX_FMT_JPEG && dev->jpeg == 0) > return -EINVAL; > > memcpy(fmt->description, sn9c20x_fmts[fmt->index].desc, 32); > @@ -951,7 +951,7 @@ int sn9c20x_vidioc_try_fmt_cap(struct file *file, void > *priv, > if(fmt->fmt.pix.field != V4L2_FIELD_NONE) > return -EINVAL; > */ > - if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG && jpeg == 0) > + if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG && dev->jpeg == 0) > return -EINVAL; > > for (index = 0; index < SN9C20X_N_FMTS; index++) > diff --git a/sn9c20x.h b/sn9c20x.h > index d5d2473..3db941f 100644 > --- a/sn9c20x.h > +++ b/sn9c20x.h > @@ -429,6 +429,8 @@ struct usb_sn9c20x { > > int resolution; > > + __u8 jpeg; > + > unsigned int frozen:1; > struct sn9c20x_video_queue queue; > struct sn9c20x_camera camera; > -- > 1.6.0.6 > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
