Re: [RFC 8/8] usb/gadget: f_uvc: add configfs support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Laurent,

Thank you for a thorough review of the whole series.

W dniu 16.06.2014 19:39, Laurent Pinchart pisze:
Hi Andrzej,

Thank you for the patch.

git am complains with

Applying: usb/gadget: f_uvc: add configfs support
/home/laurent/src/kernel/media.git/.git/rebase-apply/patch:40: trailing
whitespace.
         boolean "USB Webcam function"
warning: 1 line adds whitespace errors.

Could you please fix that ?

On Friday 28 February 2014 10:32:30 Andrzej Pietrasiewicz wrote:
Add support for using uvc as a component of a composite gadget
set up with configfs.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx>
---
  Documentation/ABI/testing/configfs-usb-gadget-uvc |   11 +
  drivers/usb/gadget/Kconfig                        |   11 +
  drivers/usb/gadget/Makefile                       |    2 +-
  drivers/usb/gadget/f_uvc.c                        |   97 +-
  drivers/usb/gadget/u_uvc.h                        |   19 +
  drivers/usb/gadget/uvc_configfs.c                 | 2928 ++++++++++++++++++
  drivers/usb/gadget/uvc_configfs.h                 |  283 ++
  7 files changed, 3348 insertions(+), 3 deletions(-)
  create mode 100644 Documentation/ABI/testing/configfs-usb-gadget-uvc
  create mode 100644 drivers/usb/gadget/uvc_configfs.c
  create mode 100644 drivers/usb/gadget/uvc_configfs.h

[snip]

<snip>

Please sort the headers here too.

I'll have to learn about configfs to understand the code below, that will take
a bit more time. I propose sorting out the rest of the issues I've pointed out
for the patch set and work on getting patches 1/8 to 7/8 mainlined in the
meantime.

This sounds like a good idea.

As far as the configfs part is concerned, your input would be specially valuable.
While I can handle the technical details of implementing proper handling of
various UVC-specific parameters, I don't have enough knowledge about UVC standard
itself which I'm sure you do have. What is currently implemented is enough for
setting up a basic webcam gadget; currently supported attributes are:

control/header:
bcdUVC

control/processing:
wMaxMultiplier

terminal/camera:
wTerminalType
wObjectiveFocalLengthMin
wObjectiveFocalLengthMax
wOcularFocalLength

terminal/output:
wTerminalType

streaming:
interval
maxpacket
maxburst

streaming/input_header:
bmInfo (read only)

streaming/color_matching:
bColorPrimaries (read only)

streaming/format/frame/yuv:
wWidth
wHeight
dwMinBitRate
dwMaxBitRate
dwMaxVideoFrameBufferSize
dwDefaultFrameInterval
bFrameInterval

steaming/format/frame/mjpeg:
wWidth
wHeight
dwMinBitRate
dwMaxBitRate
dwMaxVideoFrameBufferSize
dwDefaultFrameInterval
bFrameInterval

streaming/format/yuv:
bBitsPerPixel

streaming/format/mjpeg:
bCopyProtect

Some attributes are omitted since this was an RFC. Should more attributes be
supported? Are there too many attributes supported? Your opinion here would be
appreciated.

Creating a minimal uvc gadget with configfs involves, apart from usual gadget stuff,
issuing the following commands:

$ # the below commands create their corresponding descriptors
$ mkdir functions/uvc.usb0/control/header/webcam-hdr
$ mkdir functions/uvc.usb0/control/processing/webcam-proc
$ mkdir functions/uvc.usb0/control/terminal/camera/webcam-cam
$ mkdir functions/uvc.usb0/control/terminal/output/webcam-out
$ mkdir functions/uvc.usb0/control/class/fs/webcam-fs
$ mkdir functions/uvc.usb0/streaming/input_header/webcam-ihdr
$ mkdir functions/uvc.usb0/streaming/color_matching/webcam-cm
$ mkdir functions/uvc.usb0/streaming/class/fs/streaming-fs
$ mkdir functions/uvc.usb0/streaming/class/hs/streaming-hs
$ mkdir functions/uvc.usb0/streaming/format/frame/yuv/360p
$ mkdir functions/uvc.usb0/streaming/format/yuv/format-yuv

$ # the below commands set up associations between the descriptors:
$ ln -s functions/uvc.usb0/control/header/webcam-hdr functions/uvc.usb0/control/class/fs/webcam-fs
$ ln -s functions/uvc.usb0/control/processing/webcam-proc functions/uvc.usb0/control/class/fs/webcam-fs
$ ln -s functions/uvc.usb0/control/terminal/camera/webcam-cam functions/uvc.usb0/control/class/fs/webcam-fs
$ ln -s functions/uvc.usb0/control/terminal/output/webcam-out functions/uvc.usb0/control/class/fs/webcam-fs
$ ln -s functions/uvc.usb0/streaming/format/frame/yuv/360p functions/uvc.usb0/streaming/format/yuv/format-yuv
$ ln -s functions/uvc.usb0/streaming/input_header/webcam-ihdr functions/uvc.usb0/streaming/class/fs/streaming-fs
$ ln -s functions/uvc.usb0/streaming/color_matching/webcam-cm functions/uvc.usb0/streaming/class/fs/streaming-fs
$ ln -s functions/uvc.usb0/streaming/format/yuv/format-yuv functions/uvc.usb0/streaming/class/fs/streaming-fs
$ ln -s functions/uvc.usb0/streaming/input_header/webcam-ihdr functions/uvc.usb0/streaming/class/hs/streaming-hs
$ ln -s functions/uvc.usb0/streaming/color_matching/webcam-cm functions/uvc.usb0/streaming/class/hs/streaming-hs
$ ln -s functions/uvc.usb0/streaming/format/yuv/format-yuv functions/uvc.usb0/streaming/class/hs/streaming-hs
$ ln -s functions/uvc.usb0/control/class/fs/webcam-fs functions/uvc.usb0/
$ ln -s functions/uvc.usb0/streaming/class/fs/streaming-fs functions/uvc.usb0/
$ ln -s functions/uvc.usb0/streaming/class/hs/streaming-hs functions/uvc.usb0/

I know this is quite a lot. But since the descriptors currently found in webcam.c
are only _example_ values, we need a way to create descriptors with configfs.
I allowed creating all of them in an independent way and then setting up
associations (symbolic links) among them. But perhaps some of them
_always_ come together? If that is the case, there is no way to create them
separately. Your opinion here would be appreciated.

On the other hand, the configfs interface is supposed to be merely _usable_ from
shell; _ease_ of use is not concerned - in fact userspace tools are expected to
pop up. And indeed there are projects related: e.g. libusbg - to operate on gadget's
configfs interface programmatically, gt - command line tool which internally
uses libusbg.

Thanks,

AP


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux