From: Michael Grzeschik <mgr@pengutronix.de>
To: linux-usb@vger.kernel.org
Cc: balbi@kernel.org, paul.elder@ideasonboard.com,
laurent.pinchart@ideasonboard.com, kernel@pengutronix.de
Subject: Re: [PATCH v5 7/7] usb: gadget: uvc: add format/frame handling code
Date: Wed, 5 Jan 2022 12:54:51 +0100 [thread overview]
Message-ID: <YdWHC29gbI1mKOj7@pengutronix.de> (raw)
In-Reply-To: <20211212232719.GA3912@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 4085 bytes --]
Since this series did not get any feedback and the mentioned code needs
to be fixed I will just start the new year with a fresh v6 series.
On Mon, Dec 13, 2021 at 12:27:19AM +0100, Michael Grzeschik wrote:
>Ping
>
>On Thu, Dec 09, 2021 at 09:43:22AM +0100, Michael Grzeschik wrote:
>>The Hostside format selection is currently only done in userspace, as
>>the events for SET_CUR and GET_CUR are allways moved to the application
>>layer. Since the v4l2 device parses the configfs data, the format
>>negotiation can be done in the kernel. This patch adds the functions to
>>set the current configuration while continuing to forward all unknown
>>events to the userspace level.
>>
>>Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
>>
>>---
>>v1 -> v2:
>> - fixed the commit message
>> - changed pr_debug to pr_err in events_process_data
>> - aligned many indentations
>> - simplified uvc_events_process_data
>> - fixed uvc_fill_streaming_control calls in uvcg_video_init
>> - added setup_subcribed to decide if userspace takes over on EOPNOTSUPP
>> - added data_subscribed to decide if userspace takes over on EOPNOTSUPP
>> - removed duplicate send_response
>> - wrting fmt and frm in full
>>v2 -> v3:
>> - added find_format_index to set the right probe
>>v3 -> v4:
>> - add function find_ival_index and use for cur_ival
>> - fix swapped frame and format in uvc_events_process_data on uvc_fill_streaming_control
>> - set proper resp.length on ep0 complete
>> - dropped setting cur_probe on set_format since function was removed
>> - added locking around getting correspondent cur_{frame,format,ival}
>>v4 -> v5:
>> - fixed sparse errors reported by kernel test robot
>>
>>drivers/usb/gadget/function/f_uvc.c | 234 +++++++++++++++++++++++-
>>drivers/usb/gadget/function/uvc.h | 19 ++
>>drivers/usb/gadget/function/uvc_v4l2.c | 66 ++++++-
>>drivers/usb/gadget/function/uvc_video.c | 12 +-
>>4 files changed, 324 insertions(+), 7 deletions(-)
>>
>
>[snip]
>
>>static void
>>uvc_function_ep0_complete(struct usb_ep *ep, struct usb_request *req)
>>{
>> struct uvc_device *uvc = req->context;
>> struct v4l2_event v4l2_event;
>> struct uvc_event *uvc_event = (void *)&v4l2_event.u.data;
>>+ struct uvc_request_data resp;
>>+ int ret;
>>
>> if (uvc->event_setup_out) {
>> uvc->event_setup_out = 0;
>>
>>+ memset(&resp, 0, sizeof(resp));
>>+ resp.length = -EL2HLT;
>>+
>>+ ret = uvc_events_process_data(uvc, req);
>>+ /* If we have no error on process */
>>+ if (!ret) {
>>+ resp.length = req->length;
>>+ uvc_send_response(uvc, &resp);
>>+ return;
>
>I just found out, that depending on the host implementation, sending a
>response persisting probe or commit is no valid. I will just keep it
>aligned with the uvc-gadget implementation and fix it not to send any
>response in that both cases.
>
>>+ }
>>+
>>+ /* If we have a real error on process */
>>+ if (ret != -EOPNOTSUPP)
>>+ return;
>>+
>>+ /* If we have -EOPNOTSUPP */
>>+ if (!uvc->data_subscribed)
>>+ return;
>>+
>>+ /* If we have data subscribed */
>> memset(&v4l2_event, 0, sizeof(v4l2_event));
>> v4l2_event.type = UVC_EVENT_DATA;
>> uvc_event->data.length = req->actual;
>
>Beside that, I hope somebody would help reviewing this, before I will
>send v6.
>
>Laurant? Do you have any thoughts on that whole stack?
>
>Thanks,
>Michael
>
>--
>Pengutronix e.K. | |
>Steuerwalder Str. 21 | http://www.pengutronix.de/ |
>31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
>Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2022-01-05 11:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-09 8:43 [PATCH v5 0/7] usb: gadget: uvc: use configfs entries for negotiation and v4l2 VIDIOCS Michael Grzeschik
2021-12-09 8:43 ` [PATCH v5 1/7] media: v4l: move helper functions for fractions from uvc to v4l2-common Michael Grzeschik
2021-12-09 8:43 ` [PATCH v5 2/7] media: uvcvideo: move uvc_format_desc to common header Michael Grzeschik
2021-12-09 8:43 ` [PATCH v5 3/7] usb: gadget: uvc: prevent index variables to start from 0 Michael Grzeschik
2021-12-09 8:43 ` [PATCH v5 4/7] usb: gadget: uvc: move structs to common header Michael Grzeschik
2021-12-09 8:43 ` [PATCH v5 5/7] usb: gadget: uvc: track frames in format entries Michael Grzeschik
2021-12-09 8:43 ` [PATCH v5 6/7] usb: gadget: uvc: add VIDIOC function Michael Grzeschik
2021-12-09 8:43 ` [PATCH v5 7/7] usb: gadget: uvc: add format/frame handling code Michael Grzeschik
2021-12-12 23:27 ` Michael Grzeschik
2022-01-05 11:54 ` Michael Grzeschik [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YdWHC29gbI1mKOj7@pengutronix.de \
--to=mgr@pengutronix.de \
--cc=balbi@kernel.org \
--cc=kernel@pengutronix.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-usb@vger.kernel.org \
--cc=paul.elder@ideasonboard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).