[PATCH 1/4] usb: gadget: uvc: synchronize streamon/off with uvc_function_set_alt

2018-04-17 Thread Paul Elder
against uvc_v4l2_streamon, or by userspace neglecting to issue the VIDIOC_STREAMOFF ioctl. To fix this, add two more uvc states: starting and stopping. Use these to prevent the racing, and to detect when VIDIOC_STREAMON is issued without previously issuing VIDIOC_STREAMOFF. Signed-off-by: Paul

[PATCH 2/4] usb: gadget: composite: add function to increment delayed_status

2018-04-17 Thread Paul Elder
mon/off is called in between this return and increment, uvc_function_setup_continue within uvc_v4l2_streamon/off will WARN that cdev->delayed_status is zero. To fix situations like this, add a function to increment cdev->delayed_status. Signed-off-by: Paul Elder --- drivers/usb/gadget/compos

[PATCH 0/5] usb: gadget: uvc: fix racing between

2018-04-17 Thread Paul Elder
ad of USB_GADGET_DELAYED_STATUS. Finally, there is another way to trigger the aforementioned BUG: start streaming and (physically) disconnect usb. To fix this, call uvcg_video_enable 0 in uvc_function_disable. Paul Elder (4): usb: gadget: uvc: synchronize streamon/off with uvc_function_set_alt usb: g

[PATCH 3/4] usb: gadget: uvc: synchronize usb status phase delay for uvc_function_set_alt

2018-04-17 Thread Paul Elder
x this, use usb_composite_setup_delay to increment cdev->delayed_status, and then return 0 so that composite_setup doesn't increment cdev->delayed_status again. Signed-off-by: Paul Elder --- drivers/usb/gadget/function/f_uvc.c| 13 - drivers/usb/gadget/function/uvc_

[PATCH 4/4] usb: gadget: uvc: disable stream when disconnected

2018-04-17 Thread Paul Elder
physically disconnecting usb. To fix this, do the streamoff procedures on usb disconnect. Signed-off-by: Paul Elder --- drivers/usb/gadget/function/f_uvc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index 3324d36e809c

Re: [PATCH 0/5] usb: gadget: uvc: fix racing between uvc_function_set_alt and streamon/off

2018-04-17 Thread Paul Elder
I'm sorry; I sent this one again only because I realized I accidentally truncated the subject line on the original cover letter. On Tue, Apr 17, 2018 at 11:20:15PM -0400, Paul Elder wrote: > Down the call stack from the ioctl handler for VIDIOC_STREAMON, > uvc_video_alloc_requests

Re: [PATCH 0/5] usb: gadget: uvc: fix racing between

2018-04-17 Thread Paul Elder
Also forgot to mention that I did this against 4.16. From what I can tell, only drivers/usb/gadget/composite.c has changed between then and 4.17-rc1 :/ On Tue, Apr 17, 2018 at 11:18:12PM -0400, Paul Elder wrote: > Down the call stack from the ioctl handler for VIDIOC_STREA

[PATCH v2 0/3] usb: gadget: uvc: fix racing between uvc_function_set_alt and streamon/off

2018-04-24 Thread Paul Elder
o fix this, call uvcg_video_enable 0 in uvc_function_disable. Changes in v2: 1. Remove delay usb status phase Paul Elder (3): usb: gadget: uvc: synchronize streamon/off with uvc_function_set_alt usb: gadget: uvc: remove delay usb status phase from uvc usb: gadget: uvc: disable s

[PATCH v2 3/3] usb: gadget: uvc: disable stream when disconnected

2018-04-24 Thread Paul Elder
physically disconnecting usb. To fix this, do the streamoff procedures on usb disconnect. Signed-off-by: Paul Elder --- Changes in v2: Nothing drivers/usb/gadget/function/f_uvc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function

[PATCH v2 1/3] usb: gadget: uvc: synchronize streamon/off with uvc_function_set_alt

2018-04-24 Thread Paul Elder
against uvc_v4l2_streamon, or by userspace neglecting to issue the VIDIOC_STREAMOFF ioctl. To fix this, add two more uvc states: starting and stopping. Use these to prevent the racing, and to detect when VIDIOC_STREAMON is issued without previously issuing VIDIOC_STREAMOFF. Signed-off-by: Paul

[PATCH v2 2/3] usb: gadget: uvc: remove delay usb status phase

2018-04-24 Thread Paul Elder
The completion of the usb status phase doesn't need to be delayed from uvc_function_set_alt to uvc_v4l2_streamon/off. Remove USB_GADGET_DELAYED_STATUS and usb_composite_setup_delay from these two, respectively. Signed-off-by: Paul Elder --- Changes in v2: 1. Remove delay usb status

MUSB issue

2018-07-02 Thread Paul Elder
Hello Felipe, We have discovered an issue in MUSB gadget when receiving control OUT transfers. I have specifically observed it very frequently on the second SET_CUR UVC request when trying to stream video with yavta from a UVC gadget. What happens is that in the DATA phase, the controller copies

Re: MUSB issue

2018-07-09 Thread Paul Elder
Hi Alan, On Mon, Jul 02, 2018 at 04:03:34PM -0400, Alan Stern wrote: > On Mon, 2 Jul 2018, Laurent Pinchart wrote: > > > Hi Alan, > > > > On Monday, 2 July 2018 18:13:27 EEST Alan Stern wrote: > > > On Mon, 2 Jul 2018, Paul Elder wrote: > > > > Hell

Re: MUSB issue

2018-07-10 Thread Paul Elder
On Tue, Jul 10, 2018 at 11:23:50AM -0400, Alan Stern wrote: > On Tue, 10 Jul 2018, Paul Elder wrote: > > > > > Are there other mechanisms ? If there are no other > > > > mechanism, I won't be able to validate the DATA stage in userspace as I > > > &g

Re: [PATCH 1/3] usb: gadget: uvc: Factor out video USB request queueing

2018-09-24 Thread Paul Elder
es: Looks good to me. Reviewed-by: Paul Elder Tested-by: Paul Elder > --- > drivers/usb/gadget/function/uvc_video.c | 30 -- > 1 file changed, 20 insertions(+), 10 deletions(-) > > diff --git a/drivers/usb/gadget/function/uvc_video.c > b/driver

Re: [PATCH 0/4] usb: gadget: uvc: Fix endianness and sign issues

2018-09-24 Thread Paul Elder
using the correct format to > print unsigned int values. For the whole series: Looks good to me. Reviewed-by: Paul Elder Tested-by: Paul Elder > Laurent Pinchart (4): > usb: video: Fix endianness mismatches in descriptor structures > usb: gadget: uvc: configfs: Fix operat

[PATCH] usb: gadget: musb: fix short isoc packets with inventra dma for pandaboard es

2018-10-08 Thread Paul Elder
SoC/USBSniffer I have forward-ported this patch from 2.6.34 to 4.19-rc1. Signed-off-by: Paul Elder --- drivers/usb/musb/musb_gadget.c | 21 ++--- drivers/usb/musb/musbhsdma.c | 21 +++-- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/usb/m

[PATCH 3/6] usb: gadget: uvc: package setup and data for control OUT requests

2018-10-09 Thread Paul Elder
handler to be able to read it and send it to userspace. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- drivers/usb/gadget/function/f_uvc.c | 3 +++ drivers/usb/gadget/function/uvc.h | 1 + include/uapi/linux/usb/g_uvc.h | 3 ++- 3 files changed, 6 insertions(+), 1 deletio

[PATCH 5/6] usb: musb: gadget: implement send_response

2018-10-09 Thread Paul Elder
This patch implements a mechanism to signal the MUSB driver to reply to a control OUT request with STALL or ACK. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- drivers/usb/musb/musb_gadget_ep0.c | 41 ++ 1 file changed, 41 insertions(+) diff --git a

[PATCH 6/6] usb: gadget: uvc: allow ioctl to send response in status stage

2018-10-09 Thread Paul Elder
control OUT request sends a response to the data stage, and so the ioctl now notifies the UDC driver to reply with STALL or ACK. In the case of a control IN request, the ioctl sends the UVC data as before. Also tell the UDC to delay the status stage for this to work. Signed-off-by: Paul Elder

[PATCH 0/6] usb: gadget: add mechanism to asynchronously validate data stage of ctrl out request

2018-10-09 Thread Paul Elder
ned for a long time again shows that it isn't being used. The conclusion is that since the API hasn't been used for a long time, it is safe to fix it. Paul Elder (6): usb: uvc: include videodev2.h in g_uvc.h usb: gadget: uvc: enqueue usb request in setup handler for control OUT

[PATCH 1/6] usb: uvc: include videodev2.h in g_uvc.h

2018-10-09 Thread Paul Elder
videodev2.h in g_uvc.h. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- include/uapi/linux/usb/g_uvc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/usb/g_uvc.h b/include/uapi/linux/usb/g_uvc.h index 3c9ee3020cbb..6698c3263ae8 100644 --- a/include/uapi/linux/usb

[PATCH 4/6] usb: gadget: add functions to signal udc driver to delay status stage

2018-10-09 Thread Paul Elder
called by function drivers to tell the UDC what to reply in the status stage that it has requested to be delayed. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- drivers/usb/gadget/udc/core.c | 35 +++ include/linux/usb/gadget.h| 11 +++ 2 files ch

[PATCH 2/6] usb: gadget: uvc: enqueue usb request in setup handler for control OUT

2018-10-09 Thread Paul Elder
, to reply with a STALL). This problem is remedied by having the setup handler enqueue the empty uvc request data, instead of waiting for userspace to do it. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- drivers/usb/gadget/function/f_uvc.c| 25 +++-- drivers

Re: [PATCH 5/6] usb: musb: gadget: implement send_response

2018-10-31 Thread Paul Elder
Hi Bin, On Thu, Oct 11, 2018 at 11:07:46AM -0500, Bin Liu wrote: > Hi, > > On Tue, Oct 09, 2018 at 10:49:02PM -0400, Paul Elder wrote: > > This patch implements a mechanism to signal the MUSB driver to reply to > > a control OUT request with STALL or ACK. > > &g

Re: [PATCH 4/6] usb: gadget: add functions to signal udc driver to delay status stage

2018-11-01 Thread Paul Elder
Hi Alan, On Thu, Oct 18, 2018 at 10:07:36AM -0400, Alan Stern wrote: > On Thu, 18 Oct 2018, Laurent Pinchart wrote: > > > Hi Bin, > > > > On Thursday, 11 October 2018 19:10:21 EEST Bin Liu wrote: > > > On Tue, Oct 09, 2018 at 10:49:01PM -0400, Paul Elder wro

Re: [PATCH] usb: gadget: musb: fix short isoc packets with inventra dma for pandaboard es

2018-12-13 Thread Paul Elder
On Tue, Oct 09, 2018 at 02:32:20AM -0400, Paul Elder wrote: > Handling short packets (length < max packet size) in the Inventra DMA > engine in the MUSB driver causes the MUSB DMA controller to hang. An > example of a problem that is caused by this problem is when streaming > vid

Re: [PATCH 4/6] usb: gadget: add functions to signal udc driver to delay status stage

2018-12-13 Thread Paul Elder
st(gadget->ep0, GFP_ATOMIC); > if (req) { > req->length = 0; > req->no_implicit_status = 1; > req->complete = /* req's deallocation routine */ > usb_ep_queue(gadget->ep0, req, GFP_ATOMIC); > } > } > > Then all a UDC driver would need to do is call > usb_gadget_control_complete() after invoking a control request's > completion handler. The no_implicit_status and status arguments would > be taken from the request that was just completed. > > With this one call added to each UDC, all the existing function drivers > would work correctly. Even though they don't explicitly queue > status-stage requests, the new routine will do so for them, > transparently. Function drivers that want to handle their own > status-stage requests explicitly will merely have to set the > req->no_implicit_status bit. I think this is a good idea. We still get the benefits of explicit status stage without being overly intrusive in the conversion, and we maintain the queue-based API. Would it be fine for me to proceed in this direction for a v2? > (We might or might not need to watch out for 0-length control-OUT > transfers. Function drivers _do_ queue status-stage requests for > those.) Thanks, Paul Elder

[PATCH v2 4/6] usb: gadget: add mechanism to specify an explicit status stage

2018-12-16 Thread Paul Elder
. Signed-off-by: Paul Elder v1 Reviewed-by: Laurent Pinchart --- Changes from v1: Complete change of API. Now we use a flag that should be set in the usb_request that is queued for the data stage to signal to the UDC that we want to delay the status stage (as opposed to setting a flag in the UDC

[PATCH v2 5/6] usb: musb: gadget: implement optional explicit status stage

2018-12-16 Thread Paul Elder
Implement the mechanism for optional explicit status stage for the MUSB driver. This allows a function driver to specify what to reply for the status stage. The functionality for an implicit status stage is retained. Signed-off-by: Paul Elder v1 Reviewed-by: Laurent Pinchart v1 Acked-by: Bin

[PATCH v2 6/6] usb: gadget: uvc: allow ioctl to send response in status stage

2018-12-16 Thread Paul Elder
control OUT request sends a response to the data stage, and so the ioctl now notifies the UDC driver to reply with STALL or ACK. In the case of a control IN request, the ioctl sends the UVC data as before. Also tell the UDC to delay the status stage for this to work. Signed-off-by: Paul Elder

[PATCH v2 0/6] usb: gadget: add mechanism to asynchronously validate data stage of ctrl out request

2018-12-16 Thread Paul Elder
f the usb_request is for the status stage and if it has been requested to be explicit, and if so check the status that should be sent. (See 5/6 "usb: musb: gadget: implement optional explicit status stage" for an implementation for MUSB) Paul Elder (6): usb: uvc: include videodev2

[PATCH v2 2/6] usb: gadget: uvc: enqueue usb request in setup handler for control OUT

2018-12-16 Thread Paul Elder
, to reply with a STALL). This problem is remedied by having the setup handler enqueue the empty uvc request data, instead of waiting for userspace to do it. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v1 drivers/usb/gadget/function/f_uvc.c| 25

[PATCH v2 1/6] usb: uvc: include videodev2.h in g_uvc.h

2018-12-16 Thread Paul Elder
videodev2.h in g_uvc.h. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v1 include/uapi/linux/usb/g_uvc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/usb/g_uvc.h b/include/uapi/linux/usb/g_uvc.h index 3c9ee3020cbb..6698c3263ae8 100644 --- a

[PATCH] usb: gadget: uvc: add uvcg_warn macro

2018-12-16 Thread Paul Elder
We only have uvcg_dbg, uvcg_info, and uvcg_err, so add uvcg_warn macro to print gadget device name and function name along with format. Signed-off-by: Paul Elder --- drivers/usb/gadget/function/uvc.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/gadget/function/uvc.h b

[PATCH v2 3/6] usb: gadget: uvc: package setup and data for control OUT requests

2018-12-16 Thread Paul Elder
handler to be able to read it and send it to userspace. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v1 drivers/usb/gadget/function/f_uvc.c | 3 +++ drivers/usb/gadget/function/uvc.h | 1 + include/uapi/linux/usb/g_uvc.h | 3 ++- 3 files changed, 6 insert

[PATCH v3 1/6] usb: uvc: include videodev2.h in g_uvc.h

2018-12-19 Thread Paul Elder
videodev2.h in g_uvc.h. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v2 No change from v1 include/uapi/linux/usb/g_uvc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/usb/g_uvc.h b/include/uapi/linux/usb/g_uvc.h index 3c9ee3020cbb..6698c3263ae8

[PATCH v3 5/6] usb: musb: gadget: implement optional explicit status stage

2018-12-19 Thread Paul Elder
Implement the mechanism for optional explicit status stage for the MUSB driver. This allows a function driver to specify what to reply for the status stage. The functionality for an implicit status stage is retained. Signed-off-by: Paul Elder v1 Reviewed-by: Laurent Pinchart v1 Acked-by: Bin

[PATCH v3 4/6] usb: gadget: add mechanism to specify an explicit status stage

2018-12-19 Thread Paul Elder
. Signed-off-by: Paul Elder v1 Reviewed-by: Laurent Pinchart --- Changes from v2: Add status parameter to usb_gadget_control_complete, so that a usb_request is not queued if the status of the just given back request is nonzero. Changes from v1: Complete change of API. Now we use a flag that should be

[PATCH v3 2/6] usb: gadget: uvc: enqueue usb request in setup handler for control OUT

2018-12-19 Thread Paul Elder
, to reply with a STALL). This problem is remedied by having the setup handler enqueue the empty uvc request data, instead of waiting for userspace to do it. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v2 No change from v1 drivers/usb/gadget/function/f_uvc.c| 25

[PATCH v3 3/6] usb: gadget: uvc: package setup and data for control OUT requests

2018-12-19 Thread Paul Elder
handler to be able to read it and send it to userspace. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v2 No change from v1 drivers/usb/gadget/function/f_uvc.c | 3 +++ drivers/usb/gadget/function/uvc.h | 1 + include/uapi/linux/usb/g_uvc.h | 3 ++- 3 files

[PATCH v3 0/6] usb: gadget: add mechanism to asynchronously validate data stage of ctrl out request

2018-12-19 Thread Paul Elder
t is for the status stage and if it has been requested to be explicit, and if so check the status that should be sent. (See 5/6 "usb: musb: gadget: implement optional explicit status stage" for an implementation for MUSB) Paul Elder (6): usb: uvc: include videodev2.h in g_uvc.h u

[PATCH v3 6/6] usb: gadget: uvc: allow ioctl to send response in status stage

2018-12-19 Thread Paul Elder
control OUT request sends a response to the data stage, and so the ioctl now notifies the UDC driver to reply with STALL or ACK. In the case of a control IN request, the ioctl sends the UVC data as before. Also tell the UDC to delay the status stage for this to work. Signed-off-by: Paul Elder

Re: [PATCH v3 4/6] usb: gadget: add mechanism to specify an explicit status stage

2018-12-21 Thread Paul Elder
On Wed, Dec 19, 2018 at 11:01:52AM -0500, Alan Stern wrote: > On Wed, 19 Dec 2018, Paul Elder wrote: > > > A usb gadget function driver may or may not want to delay the status > > stage of a control OUT request. An instance it m

[PATCH v4 5/6] usb: musb: gadget: implement optional explicit status stage

2019-01-06 Thread Paul Elder
Implement the mechanism for optional explicit status stage for the MUSB driver. This allows a function driver to specify what to reply for the status stage. The functionality for an implicit status stage is retained. Signed-off-by: Paul Elder v1 Reviewed-by: Laurent Pinchart v1 Acked-by: Bin

[PATCH v4 0/6] usb: gadget: add mechanism to asynchronously validate data stage of ctrl out request

2019-01-06 Thread Paul Elder
be explicit, and if so check the status that should be sent. (See 5/6 "usb: musb: gadget: implement optional explicit status stage" for an implementation for MUSB) Paul Elder (6): usb: uvc: include videodev2.h in g_uvc.h usb: gadget: uvc: enqueue usb request in setup handler for con

[PATCH v4 3/6] usb: gadget: uvc: package setup and data for control OUT requests

2019-01-06 Thread Paul Elder
handler to be able to read it and send it to userspace. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v3 No change from v2 No change from v1 drivers/usb/gadget/function/f_uvc.c | 3 +++ drivers/usb/gadget/function/uvc.h | 1 + include/uapi/linux/usb/g_uvc.h

[PATCH v4 4/6] usb: gadget: add mechanism to specify an explicit status stage

2019-01-06 Thread Paul Elder
IN ACK the host's zero-length data packet, or for control OUT send a zero-length DATA1 ACK packet. Signed-off-by: Paul Elder Acked-by: Alan Stern v1 Reviewed-by: Laurent Pinchart --- Changes from v3: - More specific in commit message about what to do for udc driver acking - Set explicit_s

[PATCH v4 6/6] usb: gadget: uvc: allow ioctl to send response in status stage

2019-01-06 Thread Paul Elder
control OUT request sends a response to the data stage, and so the ioctl now notifies the UDC driver to reply with STALL or ACK. In the case of a control IN request, the ioctl sends the UVC data as before. Also tell the UDC to delay the status stage for this to work. Signed-off-by: Paul Elder

[PATCH v4 1/6] usb: uvc: include videodev2.h in g_uvc.h

2019-01-06 Thread Paul Elder
videodev2.h in g_uvc.h. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v3 No change from v2 No change from v1 include/uapi/linux/usb/g_uvc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/usb/g_uvc.h b/include/uapi/linux/usb/g_uvc.h index

[PATCH v4 2/6] usb: gadget: uvc: enqueue usb request in setup handler for control OUT

2019-01-06 Thread Paul Elder
, to reply with a STALL). This problem is remedied by having the setup handler enqueue the empty uvc request data, instead of waiting for userspace to do it. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v3 No change from v2 No change from v1 drivers/usb/gadget

Re: [PATCH] usb: gadget: musb: fix short isoc packets with inventra dma for pandaboard es

2019-01-07 Thread Paul Elder
9, 2018 at 02:32:20AM -0400, Paul Elder wrote: > > Handling short packets (length < max packet size) in the Inventra DMA > > engine in the MUSB driver causes the MUSB DMA controller to hang. An > > example of a problem that is caused by this problem is when streaming > >

Re: [PATCH v4 5/6] usb: musb: gadget: implement optional explicit status stage

2019-01-07 Thread Paul Elder
On Sun, Jan 06, 2019 at 03:03:09PM -0500, Alan Stern wrote: > On Sun, 6 Jan 2019, Paul Elder wrote: > > > Implement the mechanism for optional explicit status stage for the MUSB > > driver. This allows a function driver to specify what to reply for the > > status stage.

[PATCH v5 0/6] usb: gadget: add mechanism to asynchronously validate data stage of ctrl out request

2019-01-08 Thread Paul Elder
usb_gadget_giveback_request, and in its queue function should check if the usb_request is for the status stage and if it has been requested to be explicit, and if so check the status that should be sent. (See 5/6 "usb: musb: gadget: implement optional explicit status stage" for an implem

[PATCH v5 5/6] usb: musb: gadget: implement optional explicit status stage

2019-01-08 Thread Paul Elder
Implement the mechanism for optional explicit status stage for the MUSB driver. This allows a function driver to specify what to reply for the status stage. The functionality for an implicit status stage is retained. Signed-off-by: Paul Elder v1 Reviewed-by: Laurent Pinchart v1 Acked-by: Bin

[PATCH v5 6/6] usb: gadget: uvc: allow ioctl to send response in status stage

2019-01-08 Thread Paul Elder
control OUT request sends a response to the data stage, and so the ioctl now notifies the UDC driver to reply with STALL or ACK. In the case of a control IN request, the ioctl sends the UVC data as before. Also tell the UDC to delay the status stage for this to work. Signed-off-by: Paul Elder

[PATCH v5 3/6] usb: gadget: uvc: package setup and data for control OUT requests

2019-01-08 Thread Paul Elder
handler to be able to read it and send it to userspace. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v4 No change from v3 No change from v2 No change from v1 drivers/usb/gadget/function/f_uvc.c | 3 +++ drivers/usb/gadget/function/uvc.h | 1 + include/uapi/linux/u

[PATCH v2] usb: gadget: musb: fix short isoc packets with inventra dma

2019-01-08 Thread Paul Elder
ard-usbsniffer:beagleboard-usbsniffer-kernel.git;a=patch;h=b0be3b6cc195ba732189b04f1d43ec843c3e54c9 [2] http://beagleboard-usbsniffer.blogspot.com/2010/07/musb-isochronous-transfers-fixed.html [3] http://elinux.org/BeagleBoard/GSoC/USBSniffer Signed-off-by: Paul Elder --- Changes in v2: - no more flushing F

[PATCH v5 2/6] usb: gadget: uvc: enqueue usb request in setup handler for control OUT

2019-01-08 Thread Paul Elder
, to reply with a STALL). This problem is remedied by having the setup handler enqueue the empty uvc request data, instead of waiting for userspace to do it. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v4 No change from v3 No change from v2 No change from v1 drivers

[PATCH v5 4/6] usb: gadget: add mechanism to specify an explicit status stage

2019-01-08 Thread Paul Elder
1 ACK packet. Signed-off-by: Paul Elder v4 Acked-by: Alan Stern v1 Reviewed-by: Laurent Pinchart --- Changes from v4: - Change parameter of usb_gadget_control_complete to simply take a usb_request - Make usb_gadget_control_complete do nothing if the request has no length (ie. no data stage) Ch

[PATCH v5 1/6] usb: uvc: include videodev2.h in g_uvc.h

2019-01-08 Thread Paul Elder
videodev2.h in g_uvc.h. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v4 No change from v3 No change from v2 No change from v1 include/uapi/linux/usb/g_uvc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/usb/g_uvc.h b/include/uapi/linux/usb

[PATCH v3 3/4] usb: gadget: uvc: disable stream when disconnected

2019-01-08 Thread Paul Elder
. To fix this, do the streamoff procedures on usb disconnect. Since uvcg_video_enable is not interrupt-safe, add an interrupt-safe version uvcg_video_cancel, and use that. Signed-off-by: Paul Elder v2 Reviewed-by: Kieran Bingham --- Changes in v3: - added interrupt-safe uvcg_video_cancel and used

[PATCH v3 4/4] usb: gadget: uvc: remove unused/duplicate function prototypes from uvc.h

2019-01-08 Thread Paul Elder
Defined in uvc.h, uvc_endpoint_stream doesn't exist, and uvc_function_connect, uvc_function_disconnect, and uvc_function_setup_continue have duplicates in f_uvc.h. Remove these four function prototypes from uvc.h Signed-off-by: Paul Elder --- drivers/usb/gadget/function/uvc.h | 10

[PATCH v3 2/4] usb: gadget: uvc: don't delay the status phase of non-zero SET_INTERFACE requests

2019-01-08 Thread Paul Elder
dify the status phase delay API to fix the race condition. Signed-off-by: Paul Elder --- Changes in v3: Nothing Changes in v2: 1. Remove delay usb status phase drivers/usb/gadget/function/f_uvc.c| 3 ++- drivers/usb/gadget/function/uvc_v4l2.c | 6 -- 2 files changed, 2 insertions(

[PATCH v3 0/4] usb: gadget: uvc: fix racing between uvc_function_set_alt and streamon/off

2019-01-08 Thread Paul Elder
ff - added interrupt-safe uvcg_video_cancel and used instead of the non-interrupt-save uvcg_video_enable 0 in uvc_function_disable Changes in v2: 1. Remove delay usb status phase Paul Elder (4): usb: gadget: uvc: synchronize streamon/off with uvc_function_set_alt usb: gadget: uvc: don&#

[PATCH v3 1/4] usb: gadget: uvc: synchronize streamon/off with uvc_function_set_alt

2019-01-08 Thread Paul Elder
when userspace neglects to issue the VIDIOC_STREAMOFF ioctl. To fix this, add two more uvc states: starting and stopping. Use these to prevent the racing, and to detect when VIDIOC_STREAMON is issued without previously issuing VIDIOC_STREAMOFF. Signed-off-by: Paul Elder --- Changes in v3: - add

Re: [PATCH v2] usb: gadget: musb: fix short isoc packets with inventra dma

2019-01-10 Thread Paul Elder
Hi Bin, On Wed, Jan 09, 2019 at 09:02:15AM -0600, Bin Liu wrote: > Hi Paul, > > On Wed, Jan 09, 2019 at 02:10:09AM -0500, Paul Elder wrote: > > Handling short packets (length < max packet size) in the Inventra DMA > > engine in the MUSB driver causes the MUSB DM

Re: [PATCH v5 4/6] usb: gadget: add mechanism to specify an explicit status stage

2019-01-11 Thread Paul Elder
On Wed, Jan 09, 2019 at 02:06:31PM -0500, Alan Stern wrote: > On Wed, 9 Jan 2019, Paul Elder wrote: > > > A usb gadget function driver may or may not want to delay the status > > stage of a control OUT request. An instance where it might want to is to > > asynchronousl

Re: [PATCH v5 0/6] usb: gadget: add mechanism to asynchronously validate data stage of ctrl out request

2019-01-11 Thread Paul Elder
On Thu, Jan 10, 2019 at 03:39:25PM -0500, Alan Stern wrote: > On Wed, 9 Jan 2019, Paul Elder wrote: > > > This patch series adds a mechanism to allow asynchronously validating > > the data stage of a control OUT request, and for stalling or suceeding > > the request accord

Re: [PATCH v5 4/6] usb: gadget: add mechanism to specify an explicit status stage

2019-01-13 Thread Paul Elder
On Fri, Jan 11, 2019 at 10:50:11AM -0500, Alan Stern wrote: > On Fri, 11 Jan 2019, Paul Elder wrote: > > > On Wed, Jan 09, 2019 at 02:06:31PM -0500, Alan Stern wrote: > > > On Wed, 9 Jan 2019, Paul Elder wrote: > > > > > > > A usb gadget function driv

[PATCH v3] usb: gadget: musb: fix short isoc packets with inventra dma

2019-01-15 Thread Paul Elder
ard-usbsniffer:beagleboard-usbsniffer-kernel.git;a=patch;h=b0be3b6cc195ba732189b04f1d43ec843c3e54c9 [2] http://beagleboard-usbsniffer.blogspot.com/2010/07/musb-isochronous-transfers-fixed.html [3] http://elinux.org/BeagleBoard/GSoC/USBSniffer Signed-off-by: Paul Elder --- Changes in v3: - remove unnecess

Re: [PATCH v5 4/6] usb: gadget: add mechanism to specify an explicit status stage

2019-01-15 Thread Paul Elder
On Mon, Jan 14, 2019 at 10:24:44AM -0500, Alan Stern wrote: > On Mon, 14 Jan 2019, Paul Elder wrote: > > > > > > Can you check your uvc > > > > > changes using dummy_hcd with the patch below? > > > > > > > > I'm not sure what to

Re: [PATCH v5 4/6] usb: gadget: add mechanism to specify an explicit status stage

2019-01-18 Thread Paul Elder
On Wed, Jan 16, 2019 at 10:06:53AM -0500, Alan Stern wrote: > On Wed, 16 Jan 2019, Paul Elder wrote: > > > On Mon, Jan 14, 2019 at 10:24:44AM -0500, Alan Stern wrote: > > > On Mon, 14 Jan 2019, Paul Elder wrote: > > > > > > > > > > Can you c

Re: [PATCH v5 4/6] usb: gadget: add mechanism to specify an explicit status stage

2019-01-20 Thread Paul Elder
On Fri, Jan 18, 2019 at 11:52:57AM -0500, Alan Stern wrote: > On Fri, 18 Jan 2019, Paul Elder wrote: > > > > > I meant the functions (procedures) in the function driver, so the setup > > > > handler (uvc_function_setup), the completion handler > > > > (

[PATCH v6 4/6] usb: gadget: add mechanism to specify an explicit status stage

2019-01-20 Thread Paul Elder
1 ACK packet. Signed-off-by: Paul Elder v4 Acked-by: Alan Stern v1 Reviewed-by: Laurent Pinchart --- No change from v5 Changes from v4: - Change parameter of usb_gadget_control_complete to simply take a usb_request - Make usb_gadget_control_complete do nothing if the request has no length (i

[PATCH v6 6/6] usb: gadget: uvc: allow ioctl to send response in status stage

2019-01-20 Thread Paul Elder
gadget driver aware of if the completion handler is called for the status stage, and do nothing (as opposed to giving userspace the UVC data again). Signed-off-by: Paul Elder --- Changes from v5: - add event_status flag and use to keep track of whether or not the gadget is in the status stage

[PATCH v6 0/6] usb: gadget: add mechanism to asynchronously validate data stage of ctrl out request

2019-01-20 Thread Paul Elder
: implement optional explicit status stage" for an implementation for MUSB) Paul Elder (6): usb: uvc: include videodev2.h in g_uvc.h usb: gadget: uvc: enqueue usb request in setup handler for control OUT usb: gadget: uvc: package setup and data for control OUT requests usb: gadget:

[PATCH v6 1/6] usb: uvc: include videodev2.h in g_uvc.h

2019-01-20 Thread Paul Elder
videodev2.h in g_uvc.h. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v5 No change from v4 No change from v3 No change from v2 No change from v1 include/uapi/linux/usb/g_uvc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/usb/g_uvc.h b/include

[PATCH v6 2/6] usb: gadget: uvc: enqueue usb request in setup handler for control OUT

2019-01-20 Thread Paul Elder
, to reply with a STALL). This problem is remedied by having the setup handler enqueue the empty uvc request data, instead of waiting for userspace to do it. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v5 No change from v4 No change from v3 No change from v2 No change

[PATCH v6 3/6] usb: gadget: uvc: package setup and data for control OUT requests

2019-01-20 Thread Paul Elder
handler to be able to read it and send it to userspace. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v5 No change from v4 No change from v3 No change from v2 No change from v1 drivers/usb/gadget/function/f_uvc.c | 3 +++ drivers/usb/gadget/function/uvc.h | 1 + in

[PATCH v6 5/6] usb: musb: gadget: implement optional explicit status stage

2019-01-20 Thread Paul Elder
Implement the mechanism for optional explicit status stage for the MUSB driver. This allows a function driver to specify what to reply for the status stage. The functionality for an implicit status stage is retained. Signed-off-by: Paul Elder v1 Reviewed-by: Laurent Pinchart v1 Acked-by: Bin

Re: [PATCH v5 4/6] usb: gadget: add mechanism to specify an explicit status stage

2019-01-23 Thread Paul Elder
On Wed, Jan 23, 2019 at 04:10:12PM -0500, Alan Stern wrote: > On Mon, 14 Jan 2019, Paul Elder wrote: > > > On Fri, Jan 11, 2019 at 10:50:11AM -0500, Alan Stern wrote: > > > On Fri, 11 Jan 2019, Paul Elder wrote: > > > > > > > On Wed, Jan 09,

[PATCH v7 1/6] usb: uvc: include videodev2.h in g_uvc.h

2019-01-23 Thread Paul Elder
videodev2.h in g_uvc.h. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v6 No change from v5 No change from v4 No change from v3 No change from v2 No change from v1 include/uapi/linux/usb/g_uvc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/usb

[PATCH v7 3/6] usb: gadget: uvc: package setup and data for control OUT requests

2019-01-23 Thread Paul Elder
handler to be able to read it and send it to userspace. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v6 No change from v5 No change from v4 No change from v3 No change from v2 No change from v1 drivers/usb/gadget/function/f_uvc.c | 3 +++ drivers/usb/gadget/func

[PATCH v7 2/6] usb: gadget: uvc: enqueue usb request in setup handler for control OUT

2019-01-23 Thread Paul Elder
, to reply with a STALL). This problem is remedied by having the setup handler enqueue the empty uvc request data, instead of waiting for userspace to do it. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change from v6 No change from v5 No change from v4 No change from v3 No change

[PATCH v7 0/6] usb: gadget: add mechanism to asynchronously validate data stage of ctrl OUT request

2019-01-23 Thread Paul Elder
has been requested to be explicit, and if so check the status that should be sent. (See 5/6 "usb: musb: gadget: implement optional explicit status stage" for an implementation for MUSB) Paul Elder (6): usb: uvc: include videodev2.h in g_uvc.h usb: gadget: uvc: enqueue usb requ

[PATCH v7 5/6] usb: musb: gadget: implement optional explicit status stage

2019-01-23 Thread Paul Elder
Implement the mechanism for optional explicit status stage for the MUSB driver. This allows a function driver to specify what to reply for the status stage. The functionality for an implicit status stage is retained. Signed-off-by: Paul Elder v1 Reviewed-by: Laurent Pinchart v1 Acked-by: Bin

[PATCH v7 6/6] usb: gadget: uvc: allow ioctl to send response in status stage

2019-01-23 Thread Paul Elder
gadget driver aware of if the completion handler is called for the status stage, and do nothing (as opposed to giving userspace the UVC data again). Signed-off-by: Paul Elder --- No change from v6 Changes from v5: - add event_status flag and use to keep track of whether or not the gadget is

[PATCH v7 4/6] usb: gadget: add mechanism to specify an explicit status stage

2019-01-23 Thread Paul Elder
1 ACK packet. Signed-off-by: Paul Elder v4 Acked-by: Alan Stern v1 Reviewed-by: Laurent Pinchart --- No change from v6 No change from v5 Changes from v4: - Change parameter of usb_gadget_control_complete to simply take a usb_request - Make usb_gadget_control_complete do nothing if the request h