Re: [PATCH] [media] usbtv: Add driver for Fushicai USBTV007 video frame grabber

2013-06-17 Thread Lubomir Rintel
On Wed, 2013-06-12 at 09:49 +0200, Hans Verkuil wrote:
...
> > > > +static int usbtv_queryctrl(struct file *file, void *priv,
> > > > +   struct v4l2_queryctrl *ctrl)
> > > > +{
> > > > +   return -EINVAL;
> > > > +}
> > > 
> > > Drop this ioctl. If it doesn't do anything, then don't specify it.
> > 
> > It actually does something; EINVAL here for any ctrl signals there's
> > zero controls.
> > 
> > When undefined, ENOTTY that is returned is considered invalid by
> > gstreamer source.
> 
> What version of gstreamer are you using? Looking at the gstreamer code it
> seems that it can handle ENOTTY at least since September last year. Not 
> handling
> ENOTTY is an application bug (there are other - rare - drivers that do not
> have any controls) and as such I really don't like seeing a workaround like
> this in a driver, especially since this seems like it should be working fine
> with the latest gstreamer.

I was using GStreamer from RHEL6. I retried with Fedora 17 and it worked
fine.

Regards,
Lubo

-- 
Lubomir Rintel 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [media] usbtv: Add driver for Fushicai USBTV007 video frame grabber

2013-06-12 Thread Hans Verkuil
On Mon 10 June 2013 19:43:31 Lubomir Rintel wrote:
> Reverse-engineered driver for cheapo video digitizer, made from observations 
> of
> Windows XP driver. The protocol is not yet completely understood, so far we
> don't provide any controls, only support a single format out of three and 
> don't
> support the audio device.
> 
> Signed-off-by: Lubomir Rintel 
> Cc: Mauro Carvalho Chehab 
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-me...@vger.kernel.org
> ---
> Changes for v2:
> - Fix a typo in comment
> - Make prototype register settings static const
> - Solve parity calculation weirdness
> - Attempt to fix interlacing
> - Add timestamp to frames
> - [v4l2-compliance] Set pix format priv to 0
> - Drop usbtv_*_fmt_vid_cap code duplication
> - [v4l2-compliance] Add vidioc_create_bufs
> - [v4l2-compliance] Use file handle priorities
> - Drop "Driver" from initial dev_info
> 
>  drivers/media/usb/Kconfig|1 +
>  drivers/media/usb/Makefile   |1 +
>  drivers/media/usb/usbtv/Kconfig  |   10 +
>  drivers/media/usb/usbtv/Makefile |1 +
>  drivers/media/usb/usbtv/usbtv.c  |  715 
> ++
>  5 files changed, 728 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/media/usb/usbtv/Kconfig
>  create mode 100644 drivers/media/usb/usbtv/Makefile
>  create mode 100644 drivers/media/usb/usbtv/usbtv.c
> 
> diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig
> index 0a7d520..8e10267 100644
> --- a/drivers/media/usb/Kconfig
> +++ b/drivers/media/usb/Kconfig
> @@ -17,6 +17,7 @@ source "drivers/media/usb/zr364xx/Kconfig"
>  source "drivers/media/usb/stkwebcam/Kconfig"
>  source "drivers/media/usb/s2255/Kconfig"
>  source "drivers/media/usb/sn9c102/Kconfig"
> +source "drivers/media/usb/usbtv/Kconfig"
>  endif
>  
>  if MEDIA_ANALOG_TV_SUPPORT
> diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile
> index 7f51d7e..0935f47 100644
> --- a/drivers/media/usb/Makefile
> +++ b/drivers/media/usb/Makefile
> @@ -20,3 +20,4 @@ obj-$(CONFIG_VIDEO_STK1160) += stk1160/
>  obj-$(CONFIG_VIDEO_CX231XX) += cx231xx/
>  obj-$(CONFIG_VIDEO_TM6000) += tm6000/
>  obj-$(CONFIG_VIDEO_EM28XX) += em28xx/
> +obj-$(CONFIG_VIDEO_USBTV) += usbtv/
> diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig
> new file mode 100644
> index 000..8864436
> --- /dev/null
> +++ b/drivers/media/usb/usbtv/Kconfig
> @@ -0,0 +1,10 @@
> +config VIDEO_USBTV
> +tristate "USBTV007 video capture support"
> +depends on VIDEO_DEV
> +select VIDEOBUF2_VMALLOC
> +
> +---help---
> +  This is a video4linux2 driver for USBTV007 based video capture 
> devices.
> +
> +  To compile this driver as a module, choose M here: the
> +  module will be called usbtv
> diff --git a/drivers/media/usb/usbtv/Makefile 
> b/drivers/media/usb/usbtv/Makefile
> new file mode 100644
> index 000..28b872f
> --- /dev/null
> +++ b/drivers/media/usb/usbtv/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_VIDEO_USBTV) += usbtv.o
> diff --git a/drivers/media/usb/usbtv/usbtv.c b/drivers/media/usb/usbtv/usbtv.c
> new file mode 100644
> index 000..c2a02c2
> --- /dev/null
> +++ b/drivers/media/usb/usbtv/usbtv.c
> @@ -0,0 +1,715 @@
> +/*
> + * Fushicai USBTV007 Video Grabber Driver
> + *
> + * Product web site:
> + * 
> http://www.fushicai.com/products_detail/&productId=d05449ee-b690-42f9-a661-aa7353894bed.html
> + *
> + * Following LWN articles were very useful in construction of this driver:
> + * Video4Linux2 API series: http://lwn.net/Articles/203924/
> + * videobuf2 API explanation: http://lwn.net/Articles/447435/
> + * Thanks go to Jonathan Corbet for providing this quality documentation.
> + * He is awesome.
> + *
> + * Copyright (c) 2013 Lubomir Rintel
> + * All rights reserved.
> + * No physical hardware was harmed running Windows during the
> + * reverse-engineering activity
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions, and the following disclaimer,
> + *without modification.
> + * 2. The name of the author may not be used to endorse or promote products
> + *derived from this software without specific prior written permission.
> + *
> + * Alternatively, this software may be distributed under the terms of the
> + * GNU General Public License ("GPL").
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* Hardware. */
> +#define USBTV_VIDEO_ENDP 0x81
> +#define USBTV_BASE   0xc000
> +#define USBTV_REQUEST_REG12
> +
> +/* Number of concurrent isochronous urbs submitted.
> + * Higher numbers was seen to overly saturate the USB bus. *

Re: [PATCH] [media] usbtv: Add driver for Fushicai USBTV007 video frame grabber

2013-06-12 Thread Hans Verkuil
On Mon 10 June 2013 19:38:54 Lubomir Rintel wrote:
> On Mon, 2013-06-10 at 13:05 +0200, Hans Verkuil wrote:
> > > Also, I the hardware uses V4L2_FIELD_ALTERNATE interlacing, but I 
> > > couldn't make
> > > it work,
> > 
> > What didn't work exactly?
> 
> Both mplayer and gstream v4l2src displayed only half of an image. Not
> sure which combinations of flags did I use anymore.

That makes sense since few if any apps can handle FIELD_ALTERNATE.

> > > +static int usbtv_queryctrl(struct file *file, void *priv,
> > > + struct v4l2_queryctrl *ctrl)
> > > +{
> > > + return -EINVAL;
> > > +}
> > 
> > Drop this ioctl. If it doesn't do anything, then don't specify it.
> 
> It actually does something; EINVAL here for any ctrl signals there's
> zero controls.
> 
> When undefined, ENOTTY that is returned is considered invalid by
> gstreamer source.

What version of gstreamer are you using? Looking at the gstreamer code it
seems that it can handle ENOTTY at least since September last year. Not handling
ENOTTY is an application bug (there are other - rare - drivers that do not
have any controls) and as such I really don't like seeing a workaround like
this in a driver, especially since this seems like it should be working fine
with the latest gstreamer.

> > It doesn't look too bad :-) You're using all the latest frameworks which is
> > excellent.
> 
> Thanks for your time. I'll follow up with a new version that aims to
> address all the concerns above (apart for the queryctl change, which
> would break with gstreamer).
> 
> > Can you run the v4l2-compliance tool and post the output of that tool?
> 
> Driver Info:
>   Driver name   : usbtv
>   Card type : usbtv
>   Bus info  : usb-:00:1d.7-5
>   Driver version: 3.10.0
>   Capabilities  : 0x8501
>   Video Capture
>   Read/Write
>   Streaming
>   Device Capabilities
>   Device Caps   : 0x0501
>   Video Capture
>   Read/Write
>   Streaming
> 
> Compliance test for device /dev/video1 (not using libv4l2):
> 
> Required ioctls:
>   test VIDIOC_QUERYCAP: OK
> 
> Allow for multiple opens:
>   test second video open: OK
>   test VIDIOC_QUERYCAP: OK
>   test VIDIOC_G/S_PRIORITY: OK
> 
> Debug ioctls:
>   test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
>   test VIDIOC_LOG_STATUS: OK (Not Supported)
> 
> Input ioctls:
>   test VIDIOC_G/S_TUNER: OK (Not Supported)
>   test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
>   test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
>   test VIDIOC_ENUMAUDIO: OK (Not Supported)
>   test VIDIOC_G/S/ENUMINPUT: OK
>   test VIDIOC_G/S_AUDIO: OK (Not Supported)
>   Inputs: 1 Audio Inputs: 0 Tuners: 0
> 
> Output ioctls:
>   test VIDIOC_G/S_MODULATOR: OK (Not Supported)
>   test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
>   test VIDIOC_ENUMAUDOUT: OK (Not Supported)
>   test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
>   test VIDIOC_G/S_AUDOUT: OK (Not Supported)
>   Outputs: 0 Audio Outputs: 0 Modulators: 0
> 
> Control ioctls:
>   test VIDIOC_QUERYCTRL/MENU: OK
>   test VIDIOC_G/S_CTRL: OK (Not Supported)
>   test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
>   test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
>   test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
>   Standard Controls: 0 Private Controls: 0
> 
> Input/Output configuration ioctls:
>   test VIDIOC_ENUM/G/S/QUERY_STD: OK
>   test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
>   test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
> 
> Format ioctls:
>   test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
>   test VIDIOC_G/S_PARM: OK
>   test VIDIOC_G_FBUF: OK (Not Supported)
>   test VIDIOC_G_FMT: OK
>   test VIDIOC_TRY_FMT: OK
>   test VIDIOC_S_FMT: OK
>   test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
> 
> Codec ioctls:
>   test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
>   test VIDIOC_G_ENC_INDEX: OK (Not Supported)
>   test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
> 
> Buffer ioctls:
>   test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
> 
> Total: 36, Succeeded: 36, Failed: 0, Warnings: 0
> 
> 

Nice!

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [media] usbtv: Add driver for Fushicai USBTV007 video frame grabber

2013-06-10 Thread Lubomir Rintel
On Mon, 2013-06-10 at 13:05 +0200, Hans Verkuil wrote:
> > Also, I the hardware uses V4L2_FIELD_ALTERNATE interlacing, but I couldn't 
> > make
> > it work,
> 
> What didn't work exactly?

Both mplayer and gstream v4l2src displayed only half of an image. Not
sure which combinations of flags did I use anymore.

> > +static int usbtv_queryctrl(struct file *file, void *priv,
> > +   struct v4l2_queryctrl *ctrl)
> > +{
> > +   return -EINVAL;
> > +}
> 
> Drop this ioctl. If it doesn't do anything, then don't specify it.

It actually does something; EINVAL here for any ctrl signals there's
zero controls.

When undefined, ENOTTY that is returned is considered invalid by
gstreamer source.

> It doesn't look too bad :-) You're using all the latest frameworks which is
> excellent.

Thanks for your time. I'll follow up with a new version that aims to
address all the concerns above (apart for the queryctl change, which
would break with gstreamer).

> Can you run the v4l2-compliance tool and post the output of that tool?

Driver Info:
Driver name   : usbtv
Card type : usbtv
Bus info  : usb-:00:1d.7-5
Driver version: 3.10.0
Capabilities  : 0x8501
Video Capture
Read/Write
Streaming
Device Capabilities
Device Caps   : 0x0501
Video Capture
Read/Write
Streaming

Compliance test for device /dev/video1 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Control ioctls:
test VIDIOC_QUERYCTRL/MENU: OK
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 0 Private Controls: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK

Total: 36, Succeeded: 36, Failed: 0, Warnings: 0

-- 
Lubomir Rintel 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [media] usbtv: Add driver for Fushicai USBTV007 video frame grabber

2013-06-10 Thread Hans Verkuil
Just as I sent my reply I realized that my notes w.r.t. field handling
were incomplete. So I'll try to clarify it below.

On Mon June 10 2013 13:05:04 Hans Verkuil wrote:
> Hi Lubomir!
> 
> Thanks for working on this.
> 
> I've got some review comments below...
> 
> On Mon June 10 2013 11:52:11 Lubomir Rintel wrote:
> > Reverse-engineered driver for cheapo video digitizer, made from 
> > observations of
> > Windows XP driver. The protocol is not yet completely understood, so far we
> > don't provide any controls, only support a single format out of three and 
> > don't
> > support the audio device.
> > 
> > Signed-off-by: Lubomir Rintel 
> > Cc: Mauro Carvalho Chehab 
> > Cc: linux-kernel@vger.kernel.org
> > Cc: linux-me...@vger.kernel.org
> > ---
> > Hi everyone,
> > 
> > this is my first experience with v4l2, videobuf2, usb and a video video
> > hardware. Therefore, please be careful reviewing this as I could have made
> > mistakes that are not likely to happen for more experienced people.
> > 
> > I've not figured out the controls for the hardware yet, thus the huge set of
> > unidentified register settings. I've been very unsuccessfully struggling 
> > with
> > my Windows installation (the Windows driver for hardware was not usable 
> > enough
> > with any other player than the cranky one shipped with it, crashing and
> > deadlocking quite often). It seems quite possible to create a simpler
> > directshow app that would just set the controls; and I plan to do that as 
> > time
> > permits.
> > 
> > Also, I the hardware uses V4L2_FIELD_ALTERNATE interlacing, but I couldn't 
> > make
> > it work,
> 
> What didn't work exactly?
> 
> > so I'm doing deinterlacing in the driver, which is obviously not the
> > right thing to do. Could anyone educate me on proper way of dealing with 
> > data
> > interlaced this way? I could not find a decent example, and I'm not even 
> > sure
> > what the sizes in format specification are (like, is the height after or 
> > before
> > deinterlacing?).
> 
> FIELD_ALTERNATE means that each buffer contains one field, so the format 
> height
> should be 240/288 (NTSC/PAL).
> 
> Drivers using FIELD_ALTERNATE are very rare.

Given the fact that very few drivers do FIELD_ALTERNATE it makes sense to 
convert
it in the driver to FIELD_INTERLACED format, which is much more common. While
normally format conversions in the kernel are discouraged I think it is not an
issue here: the data has to be copied into the buffer anyway, so why not copy it
in a way that makes more sense.

Doing this will give buffers that use FIELD_INTERLACED and have as height the 
full
frame size (480 or 576, depending on the standard).



> > +static int usbtv_g_fmt_vid_cap(struct file *file, void *priv,
> > +   struct v4l2_format *f)
> 
> Rename to usbtv_fmt_vid_cap and use this for all g/try/s ops.
> 
> > +{
> > +   f->fmt.pix.width = USBTV_WIDTH;
> > +   f->fmt.pix.height = USBTV_HEIGHT;
> > +   f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
> > +   f->fmt.pix.field = V4L2_FIELD_NONE;
> 
> This should be V4L2_FIELD_ALTERNATE I guess.

Correction: this should be FIELD_INTERLACED.

> 
> > +   f->fmt.pix.bytesperline = USBTV_WIDTH * 2;
> > +   f->fmt.pix.sizeimage = (f->fmt.pix.bytesperline * f->fmt.pix.height);
> > +   f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
> > +   return 0;
> > +}

BTW, one thing that is missing in this driver is that the timestamp isn't
set in the buffer. The correct sequence in usbtv_image_chunk() is:

 buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED;
 buf->vb.v4l2_buf.sequence = usbtv->sequence++;
 v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
 vb2_set_plane_payload(&buf->vb, 0, size);
 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [media] usbtv: Add driver for Fushicai USBTV007 video frame grabber

2013-06-10 Thread Hans Verkuil
Hi Lubomir!

Thanks for working on this.

I've got some review comments below...

On Mon June 10 2013 11:52:11 Lubomir Rintel wrote:
> Reverse-engineered driver for cheapo video digitizer, made from observations 
> of
> Windows XP driver. The protocol is not yet completely understood, so far we
> don't provide any controls, only support a single format out of three and 
> don't
> support the audio device.
> 
> Signed-off-by: Lubomir Rintel 
> Cc: Mauro Carvalho Chehab 
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-me...@vger.kernel.org
> ---
> Hi everyone,
> 
> this is my first experience with v4l2, videobuf2, usb and a video video
> hardware. Therefore, please be careful reviewing this as I could have made
> mistakes that are not likely to happen for more experienced people.
> 
> I've not figured out the controls for the hardware yet, thus the huge set of
> unidentified register settings. I've been very unsuccessfully struggling with
> my Windows installation (the Windows driver for hardware was not usable enough
> with any other player than the cranky one shipped with it, crashing and
> deadlocking quite often). It seems quite possible to create a simpler
> directshow app that would just set the controls; and I plan to do that as time
> permits.
> 
> Also, I the hardware uses V4L2_FIELD_ALTERNATE interlacing, but I couldn't 
> make
> it work,

What didn't work exactly?

> so I'm doing deinterlacing in the driver, which is obviously not the
> right thing to do. Could anyone educate me on proper way of dealing with data
> interlaced this way? I could not find a decent example, and I'm not even sure
> what the sizes in format specification are (like, is the height after or 
> before
> deinterlacing?).

FIELD_ALTERNATE means that each buffer contains one field, so the format height
should be 240/288 (NTSC/PAL).

Drivers using FIELD_ALTERNATE are very rare.

> 
> Thanks a lot!
> Lubo
> 
>  drivers/media/usb/Kconfig|1 +
>  drivers/media/usb/Makefile   |1 +
>  drivers/media/usb/usbtv/Kconfig  |   10 +
>  drivers/media/usb/usbtv/Makefile |1 +
>  drivers/media/usb/usbtv/usbtv.c  |  723 
> ++
>  5 files changed, 736 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/media/usb/usbtv/Kconfig
>  create mode 100644 drivers/media/usb/usbtv/Makefile
>  create mode 100644 drivers/media/usb/usbtv/usbtv.c
> 
> diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig
> index 0a7d520..8e10267 100644
> --- a/drivers/media/usb/Kconfig
> +++ b/drivers/media/usb/Kconfig
> @@ -17,6 +17,7 @@ source "drivers/media/usb/zr364xx/Kconfig"
>  source "drivers/media/usb/stkwebcam/Kconfig"
>  source "drivers/media/usb/s2255/Kconfig"
>  source "drivers/media/usb/sn9c102/Kconfig"
> +source "drivers/media/usb/usbtv/Kconfig"
>  endif
>  
>  if MEDIA_ANALOG_TV_SUPPORT
> diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile
> index 7f51d7e..0935f47 100644
> --- a/drivers/media/usb/Makefile
> +++ b/drivers/media/usb/Makefile
> @@ -20,3 +20,4 @@ obj-$(CONFIG_VIDEO_STK1160) += stk1160/
>  obj-$(CONFIG_VIDEO_CX231XX) += cx231xx/
>  obj-$(CONFIG_VIDEO_TM6000) += tm6000/
>  obj-$(CONFIG_VIDEO_EM28XX) += em28xx/
> +obj-$(CONFIG_VIDEO_USBTV) += usbtv/
> diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig
> new file mode 100644
> index 000..8864436
> --- /dev/null
> +++ b/drivers/media/usb/usbtv/Kconfig
> @@ -0,0 +1,10 @@
> +config VIDEO_USBTV
> +tristate "USBTV007 video capture support"
> +depends on VIDEO_DEV
> +select VIDEOBUF2_VMALLOC
> +
> +---help---
> +  This is a video4linux2 driver for USBTV007 based video capture 
> devices.
> +
> +  To compile this driver as a module, choose M here: the
> +  module will be called usbtv
> diff --git a/drivers/media/usb/usbtv/Makefile 
> b/drivers/media/usb/usbtv/Makefile
> new file mode 100644
> index 000..28b872f
> --- /dev/null
> +++ b/drivers/media/usb/usbtv/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_VIDEO_USBTV) += usbtv.o
> diff --git a/drivers/media/usb/usbtv/usbtv.c b/drivers/media/usb/usbtv/usbtv.c
> new file mode 100644
> index 000..d165cb1
> --- /dev/null
> +++ b/drivers/media/usb/usbtv/usbtv.c
> @@ -0,0 +1,723 @@
> +/*
> + * Fushicai USBTV007 Video Grabber Driver
> + *
> + * Product web site:
> + * 
> http://www.fushicai.com/products_detail/&productId=d05449ee-b690-42f9-a661-aa7353894bed.html
> + *
> + * Following LWN articles were very useful in construction of this driver:
> + * Video4Linux2 API series: http://lwn.net/Articles/203924/
> + * videobuf2 API explanation: http://lwn.net/Articles/447435/
> + * Thanks go to Jonathan Corbet for providing this quality documentation.
> + * He is awesome.
> + *
> + * Copyright (c) 2013 Lubomir Rintel
> + * All rights reserved.
> + * No physical hadrware was harmed running Windows during the

typo: hardware

> + * reverse-engineering activity
> + *
> + * Redistribution and us