This series aims at integrating configfs into uvc, the way it has been done for acm, ncm, ecm, eem, ecm subset, rndis, obex, phonet, mass_storage, FunctionFS, loopback and sourcesink. It contains everything that is required to provide the equivalent of g_webcam.ko with configfs. Rebased onto Felipe's master. BACKWARD COMPATIBILITY ====================== Please note that the old g_webcam.ko is still available and works. USING THE NEW "GADGET" ====================== Please refer to this post: http://www.spinics.net/lists/linux-usb/msg76388.html for general information from Sebastian on how to use configfs-based gadgets (*). With configfs the procedure is as follows, compared to the information mentioned above (*): instead of mkdir functions/acm.ttyS1 do mkdir functions/uvc.<instance name> e.g. mkdir functions/uvc.usb0 In functions/uvc.<instance name> there will be the following attribute files: trace - trace level bitmask, common for all uvc instances streaming_interval - 1..16 streaming_maxpacket - 1..1023 (fs), 1..3072 (hs/ss) streaming_maxburst - 0..15 (ss only) An example gadget with uvc function: $ modprobe libcomposite $ mount none cfg -t configfs $ mkdir cfg/usb_gadget/g1 $ cd cfg/usb_gadget/g1 $ mkdir configs/c.1 $ mkdir functions/uvc.usb0 $ echo 1 > functions/uvc.usb0/streaming_interval $ echo 1024 > functions/uvc.usb0/streaming_maxpacket $ mkdir strings/0x409 $ mkdir configs/c.1/strings/0x409 $ echo 0x3290 > idProduct $ echo 0x18ec > idVendor $ echo serial > strings/0x409/serialnumber $ echo Samsung > strings/0x409/manufacturer $ echo UVC Gadget > strings/0x409/product $ echo "Conf 1" > configs/c.1/strings/0x409/configuration $ echo 120 > configs/c.1/MaxPower $ ln -s functions/uvc.usb0 configs/c.1 $ echo s3c-hsotg > UDC After unbinding the gadget with echo "" > UDC the symbolic links in the configuration directory can be removed, the strings/* subdirectories in the configuration directory can be removed, the strings/* subdirectories at the gadget level can be removed and the configs/* subdirectories can be removed. The functions/* subdirectories can be removed. After that the gadget directory can be removed and then the respective modules can be unloaded. TESTING THE FUNCTIONS (actually there is only one) ===================== uvc) device: connect the gadget, enable it, uvc-gadget -u /dev/video0 -d I used Laurent's program: http://git.ideasonboard.org/uvc-gadget.git with this patch: diff --git a/uvc-gadget.c b/uvc-gadget.c index 9ef315c..f6263ba 100644 --- a/uvc-gadget.c +++ b/uvc-gadget.c @@ -387,7 +387,7 @@ uvc_events_process_standard(struct uvc_device *dev, struct usb_ctrlrequest *ctrl printf("standard request\n"); (void)dev; (void)ctrl; - (void)resp; + resp->length = 0; } static void @@ -396,7 +396,7 @@ uvc_events_process_control(struct uvc_device *dev, uint8_t req, uint8_t cs, { printf("control request (req %02x cs %02x)\n", req, cs); (void)dev; - (void)resp; + resp->length = 0; } static void -- 1.7.9.5 and these patches http://comments.gmane.org/gmane.linux.usb.general/84813 and some other fixes to be posted soon. host: vlc v4l2:///dev/video0 Andrzej Pietrasiewicz (8): usb/gadget: uvc: move descriptors to their only user usb/gadget: uvc: move module parameters from f_uvc usb/gadget: uvc: separately compile some components of f_uvc usb/gadget: f_uvc: convert f_uvc to new function interface usb/gadget: webcam: convert webcam to new interface of f_uvc usb/gadget: f_uvc: remove compatibility layer usb/gadget: f_uvc: use usb_gstrings_attach usb/gadget: f_uvc: add configfs support Documentation/ABI/testing/configfs-usb-gadget-uvc | 11 + drivers/usb/gadget/Kconfig | 16 + drivers/usb/gadget/Makefile | 2 + drivers/usb/gadget/f_uvc.c | 715 +++++++++++++++++---- drivers/usb/gadget/f_uvc.h | 17 +- drivers/usb/gadget/u_uvc.h | 41 ++ drivers/usb/gadget/uvc.h | 1 + drivers/usb/gadget/uvc_queue.c | 42 +- drivers/usb/gadget/uvc_queue.h | 35 + drivers/usb/gadget/uvc_v4l2.c | 4 +- drivers/usb/gadget/uvc_v4l2.h | 21 + drivers/usb/gadget/uvc_video.c | 10 +- drivers/usb/gadget/uvc_video.h | 24 + drivers/usb/gadget/webcam.c | 311 ++-------- 14 files changed, 822 insertions(+), 428 deletions(-) create mode 100644 Documentation/ABI/testing/configfs-usb-gadget-uvc create mode 100644 drivers/usb/gadget/u_uvc.h create mode 100644 drivers/usb/gadget/uvc_v4l2.h create mode 100644 drivers/usb/gadget/uvc_video.h -- 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