mbox series

[v7,0/7] usb: gadget: uvc: use configfs entries for negotiation and v4l2 VIDIOCS

Message ID 20220315143356.3919911-1-m.grzeschik@pengutronix.de (mailing list archive)
Headers show
Series usb: gadget: uvc: use configfs entries for negotiation and v4l2 VIDIOCS | expand

Message

Michael Grzeschik March 15, 2022, 2:33 p.m. UTC
This series improves the uvc video gadget by parsing the configfs
entries. With the configfs data, the driver now is able to negotiate the
format with the usb host in the kernel and also exports the supported
frames/formats/intervals via the v4l2 VIDIOC interface.

The uvc userspace stack is also under development. One example is an generic
v4l2uvcsink gstreamer elemnt, which is currently under discussion. [1]

[1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1304

With the libusbgx library [1] used by the gadget-tool [2] it is now also
possible to fully describe the configfs layout of the uvc gadget with scheme
files.

[2] https://github.com/linux-usb-gadgets/libusbgx/pull/61/commits/53231c76f9d512f59fdc23b65cd5c46b7fb09eb4

[3] https://github.com/linux-usb-gadgets/gt/tree/master/examples/systemd

The bigger picture of these patches is to provide a more versatile interface to
the uvc gadget. The goal is to simply start a uvc-gadget with the following
commands:

$ gt load uvc.scheme
$ gst-launch v4l2src ! v4l2uvcsink

--

v1: https://lore.kernel.org/linux-usb/20210530222239.8793-1-m.grzeschik@pengutronix.de/
v2: https://lore.kernel.org/linux-usb/20211117004432.3763306-1-m.grzeschik@pengutronix.de/
v3: https://lore.kernel.org/linux-usb/20211117122435.2409362-1-m.grzeschik@pengutronix.de/
v4: https://lore.kernel.org/linux-usb/20211205225803.268492-1-m.grzeschik@pengutronix.de/
v5: https://lore.kernel.org/linux-usb/20211209084322.2662616-1-m.grzeschik@pengutronix.de/
v6: https://lore.kernel.org/linux-usb/20220105115527.3592860-1-m.grzeschik@pengutronix.de/

Regards,
Michael

Michael Grzeschik (7):
  media: v4l: move helper functions for fractions from uvc to
    v4l2-common
  media: uvcvideo: move uvc_format_desc to common header
  usb: gadget: uvc: prevent index variables to start from 0
  usb: gadget: uvc: move structs to common header
  usb: gadget: uvc: track frames in format entries
  usb: gadget: uvc: add VIDIOC function
  usb: gadget: uvc: add format/frame handling code

 drivers/media/usb/uvc/uvc_ctrl.c           |   1 +
 drivers/media/usb/uvc/uvc_driver.c         | 281 +-------------
 drivers/media/usb/uvc/uvc_v4l2.c           |  14 +-
 drivers/media/usb/uvc/uvcvideo.h           | 144 -------
 drivers/media/v4l2-core/v4l2-common.c      |  82 ++++
 drivers/usb/gadget/function/f_uvc.c        | 271 +++++++++++++-
 drivers/usb/gadget/function/uvc.h          |  39 +-
 drivers/usb/gadget/function/uvc_configfs.c | 148 ++------
 drivers/usb/gadget/function/uvc_configfs.h | 120 +++++-
 drivers/usb/gadget/function/uvc_queue.c    |   3 +-
 drivers/usb/gadget/function/uvc_v4l2.c     | 412 ++++++++++++++++++---
 drivers/usb/gadget/function/uvc_video.c    |  71 +++-
 include/media/v4l2-common.h                |   4 +
 include/media/v4l2-uvc.h                   | 351 ++++++++++++++++++
 14 files changed, 1336 insertions(+), 605 deletions(-)
 create mode 100644 include/media/v4l2-uvc.h

Comments

Michael Grzeschik April 7, 2022, 2:34 p.m. UTC | #1
Hi!

This series is laying around another two weeks after it was sent.

Some feedback would be appreciated to get this code mainline.

Thanks,
Michael

On Tue, Mar 15, 2022 at 03:33:49PM +0100, Michael Grzeschik wrote:
>This series improves the uvc video gadget by parsing the configfs
>entries. With the configfs data, the driver now is able to negotiate the
>format with the usb host in the kernel and also exports the supported
>frames/formats/intervals via the v4l2 VIDIOC interface.
>
>The uvc userspace stack is also under development. One example is an generic
>v4l2uvcsink gstreamer elemnt, which is currently under discussion. [1]
>
>[1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1304
>
>With the libusbgx library [1] used by the gadget-tool [2] it is now also
>possible to fully describe the configfs layout of the uvc gadget with scheme
>files.
>
>[2] https://github.com/linux-usb-gadgets/libusbgx/pull/61/commits/53231c76f9d512f59fdc23b65cd5c46b7fb09eb4
>
>[3] https://github.com/linux-usb-gadgets/gt/tree/master/examples/systemd
>
>The bigger picture of these patches is to provide a more versatile interface to
>the uvc gadget. The goal is to simply start a uvc-gadget with the following
>commands:
>
>$ gt load uvc.scheme
>$ gst-launch v4l2src ! v4l2uvcsink
>
>--
>
>v1: https://lore.kernel.org/linux-usb/20210530222239.8793-1-m.grzeschik@pengutronix.de/
>v2: https://lore.kernel.org/linux-usb/20211117004432.3763306-1-m.grzeschik@pengutronix.de/
>v3: https://lore.kernel.org/linux-usb/20211117122435.2409362-1-m.grzeschik@pengutronix.de/
>v4: https://lore.kernel.org/linux-usb/20211205225803.268492-1-m.grzeschik@pengutronix.de/
>v5: https://lore.kernel.org/linux-usb/20211209084322.2662616-1-m.grzeschik@pengutronix.de/
>v6: https://lore.kernel.org/linux-usb/20220105115527.3592860-1-m.grzeschik@pengutronix.de/
>
>Regards,
>Michael
>
>Michael Grzeschik (7):
>  media: v4l: move helper functions for fractions from uvc to
>    v4l2-common
>  media: uvcvideo: move uvc_format_desc to common header
>  usb: gadget: uvc: prevent index variables to start from 0
>  usb: gadget: uvc: move structs to common header
>  usb: gadget: uvc: track frames in format entries
>  usb: gadget: uvc: add VIDIOC function
>  usb: gadget: uvc: add format/frame handling code
>
> drivers/media/usb/uvc/uvc_ctrl.c           |   1 +
> drivers/media/usb/uvc/uvc_driver.c         | 281 +-------------
> drivers/media/usb/uvc/uvc_v4l2.c           |  14 +-
> drivers/media/usb/uvc/uvcvideo.h           | 144 -------
> drivers/media/v4l2-core/v4l2-common.c      |  82 ++++
> drivers/usb/gadget/function/f_uvc.c        | 271 +++++++++++++-
> drivers/usb/gadget/function/uvc.h          |  39 +-
> drivers/usb/gadget/function/uvc_configfs.c | 148 ++------
> drivers/usb/gadget/function/uvc_configfs.h | 120 +++++-
> drivers/usb/gadget/function/uvc_queue.c    |   3 +-
> drivers/usb/gadget/function/uvc_v4l2.c     | 412 ++++++++++++++++++---
> drivers/usb/gadget/function/uvc_video.c    |  71 +++-
> include/media/v4l2-common.h                |   4 +
> include/media/v4l2-uvc.h                   | 351 ++++++++++++++++++
> 14 files changed, 1336 insertions(+), 605 deletions(-)
> create mode 100644 include/media/v4l2-uvc.h
>
>-- 
>2.30.2
>
>
>
Greg KH April 7, 2022, 2:52 p.m. UTC | #2
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Thu, Apr 07, 2022 at 04:34:29PM +0200, Michael Grzeschik wrote:
> Hi!
> 
> This series is laying around another two weeks after it was sent.

The merge window happened when we can not do anything.  You know that :(

> Some feedback would be appreciated to get this code mainline.

Why did you not cc: the v4l mailing list as well?

thanks,

greg k-h
Michael Grzeschik April 7, 2022, 7:53 p.m. UTC | #3
On Tue, Mar 15, 2022 at 03:33:49PM +0100, Michael Grzeschik wrote:
>This series improves the uvc video gadget by parsing the configfs
>entries. With the configfs data, the driver now is able to negotiate the
>format with the usb host in the kernel and also exports the supported
>frames/formats/intervals via the v4l2 VIDIOC interface.
>
>The uvc userspace stack is also under development. One example is an generic
>v4l2uvcsink gstreamer elemnt, which is currently under discussion. [1]
>
>[1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1304
>
>With the libusbgx library [1] used by the gadget-tool [2] it is now also
>possible to fully describe the configfs layout of the uvc gadget with scheme
>files.
>
>[2] https://github.com/linux-usb-gadgets/libusbgx/pull/61/commits/53231c76f9d512f59fdc23b65cd5c46b7fb09eb4
>
>[3] https://github.com/linux-usb-gadgets/gt/tree/master/examples/systemd
>
>The bigger picture of these patches is to provide a more versatile interface to
>the uvc gadget. The goal is to simply start a uvc-gadget with the following
>commands:
>
>$ gt load uvc.scheme
>$ gst-launch v4l2src ! v4l2uvcsink

Cc: linux-media@vger.kernel.org

>--
>
>v1: https://lore.kernel.org/linux-usb/20210530222239.8793-1-m.grzeschik@pengutronix.de/
>v2: https://lore.kernel.org/linux-usb/20211117004432.3763306-1-m.grzeschik@pengutronix.de/
>v3: https://lore.kernel.org/linux-usb/20211117122435.2409362-1-m.grzeschik@pengutronix.de/
>v4: https://lore.kernel.org/linux-usb/20211205225803.268492-1-m.grzeschik@pengutronix.de/
>v5: https://lore.kernel.org/linux-usb/20211209084322.2662616-1-m.grzeschik@pengutronix.de/
>v6: https://lore.kernel.org/linux-usb/20220105115527.3592860-1-m.grzeschik@pengutronix.de/
>
>Regards,
>Michael
>
>Michael Grzeschik (7):
>  media: v4l: move helper functions for fractions from uvc to
>    v4l2-common
>  media: uvcvideo: move uvc_format_desc to common header
>  usb: gadget: uvc: prevent index variables to start from 0
>  usb: gadget: uvc: move structs to common header
>  usb: gadget: uvc: track frames in format entries
>  usb: gadget: uvc: add VIDIOC function
>  usb: gadget: uvc: add format/frame handling code
>
> drivers/media/usb/uvc/uvc_ctrl.c           |   1 +
> drivers/media/usb/uvc/uvc_driver.c         | 281 +-------------
> drivers/media/usb/uvc/uvc_v4l2.c           |  14 +-
> drivers/media/usb/uvc/uvcvideo.h           | 144 -------
> drivers/media/v4l2-core/v4l2-common.c      |  82 ++++
> drivers/usb/gadget/function/f_uvc.c        | 271 +++++++++++++-
> drivers/usb/gadget/function/uvc.h          |  39 +-
> drivers/usb/gadget/function/uvc_configfs.c | 148 ++------
> drivers/usb/gadget/function/uvc_configfs.h | 120 +++++-
> drivers/usb/gadget/function/uvc_queue.c    |   3 +-
> drivers/usb/gadget/function/uvc_v4l2.c     | 412 ++++++++++++++++++---
> drivers/usb/gadget/function/uvc_video.c    |  71 +++-
> include/media/v4l2-common.h                |   4 +
> include/media/v4l2-uvc.h                   | 351 ++++++++++++++++++
> 14 files changed, 1336 insertions(+), 605 deletions(-)
> create mode 100644 include/media/v4l2-uvc.h
>
>-- 
>2.30.2
>
>
>
Michael Grzeschik April 7, 2022, 7:53 p.m. UTC | #4
On Thu, Apr 07, 2022 at 04:52:07PM +0200, Greg KH wrote:
>A: http://en.wikipedia.org/wiki/Top_post
>Q: Were do I find info about this thing called top-posting?
>A: Because it messes up the order in which people normally read text.
>Q: Why is top-posting such a bad thing?
>A: Top-posting.
>Q: What is the most annoying thing in e-mail?
>
>A: No.
>Q: Should I include quotations after my reply?
>
>http://daringfireball.net/2007/07/on_top

I usually don't do that. I will pay more attention next time. Thanks.

>On Thu, Apr 07, 2022 at 04:34:29PM +0200, Michael Grzeschik wrote:
>> This series is laying around another two weeks after it was sent.
>
>The merge window happened when we can not do anything.  You know that :(

Yes. You are right. However, I just tried to draw some attention
as the previous versions where also very much ignored.

>> Some feedback would be appreciated to get this code mainline.
>
>Why did you not cc: the v4l mailing list as well?

Good point. I added the list.

Regards,
Michael
Greg KH April 8, 2022, 4:49 a.m. UTC | #5
On Thu, Apr 07, 2022 at 09:53:50PM +0200, Michael Grzeschik wrote:
> On Tue, Mar 15, 2022 at 03:33:49PM +0100, Michael Grzeschik wrote:
> > This series improves the uvc video gadget by parsing the configfs
> > entries. With the configfs data, the driver now is able to negotiate the
> > format with the usb host in the kernel and also exports the supported
> > frames/formats/intervals via the v4l2 VIDIOC interface.
> > 
> > The uvc userspace stack is also under development. One example is an generic
> > v4l2uvcsink gstreamer elemnt, which is currently under discussion. [1]
> > 
> > [1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1304
> > 
> > With the libusbgx library [1] used by the gadget-tool [2] it is now also
> > possible to fully describe the configfs layout of the uvc gadget with scheme
> > files.
> > 
> > [2] https://github.com/linux-usb-gadgets/libusbgx/pull/61/commits/53231c76f9d512f59fdc23b65cd5c46b7fb09eb4
> > 
> > [3] https://github.com/linux-usb-gadgets/gt/tree/master/examples/systemd
> > 
> > The bigger picture of these patches is to provide a more versatile interface to
> > the uvc gadget. The goal is to simply start a uvc-gadget with the following
> > commands:
> > 
> > $ gt load uvc.scheme
> > $ gst-launch v4l2src ! v4l2uvcsink
> 
> Cc: linux-media@vger.kernel.org

That does not actually get the full set of patches sent to the list :(

Please resend the whole series.

thanks,

greg k-h