public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Amit Virdi <amit.virdi@st.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"rdunlap@infradead.org" <rdunlap@infradead.org>,
	"ming.lei@canonical.com" <ming.lei@canonical.com>,
	"hdegoede@redhat.com" <hdegoede@redhat.com>
Subject: Re: [PATCH] usb: core: allow zero packet flag for interrupt urbs
Date: Mon, 21 Jul 2014 10:37:37 +0530	[thread overview]
Message-ID: <53CCA019.7030007@st.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1407181034220.979-100000@iolanthe.rowland.org>

On 7/18/2014 8:09 PM, Alan Stern wrote:
> On Fri, 18 Jul 2014, Amit Virdi wrote:
>
>> On 7/17/2014 8:25 PM, Alan Stern wrote:
>>> I can't say this is actually wrong, but have you ever encountered a
>>> situation where this would be needed?  How often does anyone need to do
>>> a multi-packet transfer over an interrupt endpoint?
>>
>> Honestly, I haven't found any such real device yet. I did this change
>> while I was going through the code when adding support for interrupt
>> transfers in gadget zero. I'm a no expert, but the spec says it should
>> be supported so this code should be added.
>
> I just remembered, the HID spec requires that all reports (except the
> longest) end with a short packet.  And since output reports are allowed
> to be sent over an Interrupt-OUT endpoint, we have to accept the
> URB_ZERO_PACKET flag for interrupt URBs.
>

Ok, great!

>> However, I messed up a little in this patch. It should have been
>> ---
>>           case USB_ENDPOINT_XFER_ISOC:
>>                   allowed |= URB_ISO_ASAP;
>>                   break;
>> +       case USB_ENDPOINT_XFER_INT:
>> +               if (is_out)
>> +                       allowed |= URB_ZERO_PACKET;
>> +               else
>> +                       allowed |= URB_SHORT_NOT_OK;
>> +               break;
>>           }
>>           allowed &= urb->transfer_flags;
>>
>> ---
>> Otherwise, it sets zero packet flag for control out transfers too.
>>
>> I'll send a V2 with this change if you agree to setting of the zero
>> packet flag for interrupt transfers.
>
> How about this change instead?
>
>   			URB_FREE_BUFFER);
>   	switch (xfertype) {
>   	case USB_ENDPOINT_XFER_BULK:
> +	case USB_ENDPOINT_XFER_INT:

Looks better.
I'll submit a V2 with this change.

Regards
Amit Virdi

  reply	other threads:[~2014-07-21  5:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17  8:47 [PATCH] usb: core: allow zero packet flag for interrupt urbs Amit Virdi
2014-07-17 10:43 ` Hans de Goede
2014-07-17 14:55 ` Alan Stern
2014-07-17 17:59   ` Steve Calfee
2014-07-17 19:32     ` Alan Stern
2014-07-17 20:59       ` Steve Calfee
2014-07-18 14:34         ` Alan Stern
2014-07-18 11:56   ` Amit Virdi
2014-07-18 14:39     ` Alan Stern
2014-07-21  5:07       ` Amit Virdi [this message]
2014-07-21  5:16         ` [PATCH V2] " Amit Virdi
2014-07-21 14:06           ` Alan Stern

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=53CCA019.7030007@st.com \
    --to=amit.virdi@st.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    --cc=rdunlap@infradead.org \
    --cc=stern@rowland.harvard.edu \
    /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