Re: make a confirm for [usb: dwc3: gadget: skip Set/Clear Halt when invalid]

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

 



Hi,

that patch is not 100% correct. You can revert it in your tree. I added
that because of a problem I found when running adb against macOS.

It's actually okay to send Clear Halt at any time, but for some reason
dwc3 was hanging when running adb against macOS.

If you can revert the patch and make sure it works against all 3 major
OSes (linux, windows and mac) I'd be really glad.

liangshengjun <liangshengjun@xxxxxxxxxxxxx> writes:
> Hi felipe,
>
>       I have met a case about set/clear Halt patch
> Version: linux v4.16,
> Case:  usb uvc run with bulk-mode connect to Windows 7 PC. When PC stop camera application , it would send clearHalt request to uvc device to streaming-off video transfer.
>            But with v4.16 dwc3 drivers, it would skip handling this clear Halt request , because dep->flags is not DWC3_EP_STALL status, then it causes PC restart camera application , uvc transfer fail.
>            And I have confirmed v3.18 dwc3 drivers is OK.
>
>       So how to balance for handling clear Halt without first setHalt ??
>
> PS:
> commit ffb80fc672c3a7b6afd0cefcb1524fb99917b2f3
> Author: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx>
> Date:   Thu Jan 19 13:38:42 2017 +0200
>
>     usb: dwc3: gadget: skip Set/Clear Halt when invalid
>
>     At least macOS seems to be sending
>     ClearFeature(ENDPOINT_HALT) to endpoints which
>     aren't Halted. This makes DWC3's CLEARSTALL command
>     time out which causes several issues for the driver.
>
>     Instead, let's just return 0 and bail out early.
>
>     Cc: <stable@xxxxxxxxxxxxxxx>
>     Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx>
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 6faf484..0a664d8 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1379,6 +1379,9 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol)
>                 unsigned transfer_in_flight;
>                 unsigned started;
>
> +               if (dep->flags & DWC3_EP_STALL)
> +                       return 0;
> +
>                 if (dep->number > 1)
>                         trb = dwc3_ep_prev_trb(dep, dep->trb_enqueue);
>                 else
> @@ -1400,6 +1403,8 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol)
>                 else
>                         dep->flags |= DWC3_EP_STALL;
>         } else {
> +               if (!(dep->flags & DWC3_EP_STALL))
> +                       return 0;
>
>                 ret = dwc3_send_clear_stall_ep_cmd(dep);
>                 if (ret)
>
>
> Liang Shengjun
> [cid:image001.png@01D40971.9265B340]
> HISILICON TECHNOLOGIES CO., LTD.
> New R&D Center, Wuhe Road, Bantian,
> Longgang District, Shenzhen 518129 P.R. China
>

-- 
balbi

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux