<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/usb/composite.h, branch v4.14.238</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.14.238</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.14.238'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2020-06-25T13:41:55Z</updated>
<entry>
<title>usb: gadget: Fix issue with config_ep_by_speed function</title>
<updated>2020-06-25T13:41:55Z</updated>
<author>
<name>Pawel Laszczak</name>
<email>pawell@cadence.com</email>
</author>
<published>2020-05-18T10:08:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0c8c366c54f07f70d03260db9e0faa52f8d65749'/>
<id>urn:sha1:0c8c366c54f07f70d03260db9e0faa52f8d65749</id>
<content type='text'>
[ Upstream commit 5d363120aa548ba52d58907a295eee25f8207ed2 ]

This patch adds new config_ep_by_speed_and_alt function which
extends the config_ep_by_speed about alt parameter.
This additional parameter allows to find proper usb_ss_ep_comp_descriptor.

Problem has appeared during testing f_tcm (BOT/UAS) driver function.

f_tcm function for SS use array of headers for both  BOT/UAS alternate
setting:

static struct usb_descriptor_header *uasp_ss_function_desc[] = {
        (struct usb_descriptor_header *) &amp;bot_intf_desc,
        (struct usb_descriptor_header *) &amp;uasp_ss_bi_desc,
        (struct usb_descriptor_header *) &amp;bot_bi_ep_comp_desc,
        (struct usb_descriptor_header *) &amp;uasp_ss_bo_desc,
        (struct usb_descriptor_header *) &amp;bot_bo_ep_comp_desc,

        (struct usb_descriptor_header *) &amp;uasp_intf_desc,
        (struct usb_descriptor_header *) &amp;uasp_ss_bi_desc,
        (struct usb_descriptor_header *) &amp;uasp_bi_ep_comp_desc,
        (struct usb_descriptor_header *) &amp;uasp_bi_pipe_desc,
        (struct usb_descriptor_header *) &amp;uasp_ss_bo_desc,
        (struct usb_descriptor_header *) &amp;uasp_bo_ep_comp_desc,
        (struct usb_descriptor_header *) &amp;uasp_bo_pipe_desc,
        (struct usb_descriptor_header *) &amp;uasp_ss_status_desc,
        (struct usb_descriptor_header *) &amp;uasp_status_in_ep_comp_desc,
        (struct usb_descriptor_header *) &amp;uasp_status_pipe_desc,
        (struct usb_descriptor_header *) &amp;uasp_ss_cmd_desc,
        (struct usb_descriptor_header *) &amp;uasp_cmd_comp_desc,
        (struct usb_descriptor_header *) &amp;uasp_cmd_pipe_desc,
        NULL,
};

The first 5 descriptors are associated with BOT alternate setting,
and others are associated with UAS.

During handling UAS alternate setting f_tcm driver invokes
config_ep_by_speed and this function sets incorrect companion endpoint
descriptor in usb_ep object.

Instead setting ep-&gt;comp_desc to uasp_bi_ep_comp_desc function in this
case set ep-&gt;comp_desc to uasp_ss_bi_desc.

This is due to the fact that it searches endpoint based on endpoint
address:

        for_each_ep_desc(speed_desc, d_spd) {
                chosen_desc = (struct usb_endpoint_descriptor *)*d_spd;
                if (chosen_desc-&gt;bEndpoitAddress == _ep-&gt;address)
                        goto ep_found;
        }

And in result it uses the descriptor from BOT alternate setting
instead UAS.

Finally, it causes that controller driver during enabling endpoints
detect that just enabled endpoint for bot.

Signed-off-by: Jayshri Pawar &lt;jpawar@cadence.com&gt;
Signed-off-by: Pawel Laszczak &lt;pawell@cadence.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: composite: fix incorrect handling of OS desc requests</title>
<updated>2018-05-25T14:17:41Z</updated>
<author>
<name>Chris Dickens</name>
<email>christopher.a.dickens@gmail.com</email>
</author>
<published>2018-01-01T02:59:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f3f3442027b5b4f7633fc008ade8b2f5558b16c9'/>
<id>urn:sha1:f3f3442027b5b4f7633fc008ade8b2f5558b16c9</id>
<content type='text'>
[ Upstream commit 5d6ae4f0da8a64a185074dabb1b2f8c148efa741 ]

When handling an OS descriptor request, one of the first operations is
to zero out the request buffer using the wLength from the setup packet.
There is no bounds checking, so a wLength &gt; 4096 would clobber memory
adjacent to the request buffer. Fix this by taking the min of wLength
and the request buffer length prior to the memset. While at it, define
the buffer length in a header file so that magic numbers don't appear
throughout the code.

When returning data to the host, the data length should be the min of
the wLength and the valid data we have to return. Currently we are
returning wLength, thus requests for a wLength greater than the amount
of data in the OS descriptor buffer would return invalid (albeit zero'd)
data following the valid descriptor data. Fix this by counting the
number of bytes when constructing the data and using this when
determining the length of the request.

Signed-off-by: Chris Dickens &lt;christopher.a.dickens@gmail.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: composite.h: fix two warnings when building docs</title>
<updated>2017-04-11T20:41:01Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@s-opensource.com</email>
</author>
<published>2017-04-05T13:23:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3e208a00cffd1358cecf79074e50b093212043c1'/>
<id>urn:sha1:3e208a00cffd1358cecf79074e50b093212043c1</id>
<content type='text'>
By definition, we use /* private: */ tag when we won't be documenting
a parameter. However, those two parameters are documented:

./include/linux/usb/composite.h:510: warning: Excess struct/union/enum/typedef member 'setup_pending' description in 'usb_composite_dev'
./include/linux/usb/composite.h:510: warning: Excess struct/union/enum/typedef member 'os_desc_pending' description in 'usb_composite_dev'

So, we need to use /* public: */ to avoid a warning.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>usb: get rid of some ReST doc build errors</title>
<updated>2017-04-11T20:40:48Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@s-opensource.com</email>
</author>
<published>2017-04-05T13:23:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e0c34e900611a58c93adf463d096c5843eb1967a'/>
<id>urn:sha1:e0c34e900611a58c93adf463d096c5843eb1967a</id>
<content type='text'>
We need an space before a numbered list to avoid those warnings:

./drivers/usb/core/message.c:478: ERROR: Unexpected indentation.
./drivers/usb/core/message.c:479: WARNING: Block quote ends without a blank line; unexpected unindent.
./include/linux/usb/composite.h:455: ERROR: Unexpected indentation.
./include/linux/usb/composite.h:456: WARNING: Block quote ends without a blank line; unexpected unindent.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>usb: gadget: composite: let USB functions process ctrl reqs in cfg0</title>
<updated>2016-08-25T09:13:17Z</updated>
<author>
<name>Felix Hädicke</name>
<email>felixhaedicke@web.de</email>
</author>
<published>2016-06-21T23:12:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1a00b457a5482c3822bfc0fd64c088b2dba93e26'/>
<id>urn:sha1:1a00b457a5482c3822bfc0fd64c088b2dba93e26</id>
<content type='text'>
It can sometimes be necessary for gadget drivers to process non-standard
control requests, which host devices can send without having sent
USB_REQ_SET_CONFIGURATION.

Therefore, the req_match() usb_function method is enhanced with the new
parameter "config0". When a USB configuration is active, this parameter
is false. When a non-core control request is processed in
composite_setup(), without an active configuration, req_match() of the
USB functions of all available configurations which implement this
function, is called with config0=true. Then the control request gets
processed by the first usb_function instance whose req_match() returns
true.

Signed-off-by: Felix Hädicke &lt;felixhaedicke@web.de&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>usb: gadget: Update config for SuperSpeedPlus</title>
<updated>2016-03-04T13:14:24Z</updated>
<author>
<name>John Youn</name>
<email>John.Youn@synopsys.com</email>
</author>
<published>2016-02-06T01:06:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=554eead5436401ae3cfdb7d79fca24c14ebab143'/>
<id>urn:sha1:554eead5436401ae3cfdb7d79fca24c14ebab143</id>
<content type='text'>
When a function is added to a configuration with usb_add_function(), the
configuration speed flags are updated. These flags indicate for which
speeds the configuration is valid for.

This patch adds a flag in the configuration for SuperSpeedPlus and
also updates this based on the existence of ssp_descriptors.

Signed-off-by: John Youn &lt;johnyoun@synopsys.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: Update function for SuperSpeedPlus</title>
<updated>2016-03-04T13:14:23Z</updated>
<author>
<name>John Youn</name>
<email>John.Youn@synopsys.com</email>
</author>
<published>2016-02-06T01:06:21Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f5c61225cf29c4f97e544ad7bd088256303acf97'/>
<id>urn:sha1:f5c61225cf29c4f97e544ad7bd088256303acf97</id>
<content type='text'>
Add a ssp_descriptors member to struct usb_function and handle the
initialization and cleanup of it. This holds the SuperSpeedPlus
descriptors for a function that supports SuperSpeedPlus. This is added
by usb_assign_descriptors().

Signed-off-by: John Youn &lt;johnyoun@synopsys.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: composite: add bind_deactivated flag to usb_function</title>
<updated>2015-07-29T14:59:19Z</updated>
<author>
<name>Robert Baldyga</name>
<email>r.baldyga@samsung.com</email>
</author>
<published>2015-05-04T12:55:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d5bb9b81dbfa35d117ecb58022ee6e7e41e4772d'/>
<id>urn:sha1:d5bb9b81dbfa35d117ecb58022ee6e7e41e4772d</id>
<content type='text'>
This patch introduces 'bind_deactivated' flag in struct usb_function.
Functions which don't want to be activated automatically after bind should
set this flag, and when they start to be ready to work they should call
usb_function_activate().

When USB function sets 'bind_deactivated' flag, initial deactivation
counter is incremented automatically, so there is no need to call
usb_function_deactivate() in function bind.

Signed-off-by: Robert Baldyga &lt;r.baldyga@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: gadget: composite: add req_match method to usb_function</title>
<updated>2015-03-10T20:33:39Z</updated>
<author>
<name>Andrzej Pietrasiewicz</name>
<email>andrzej.p@samsung.com</email>
</author>
<published>2015-03-03T09:52:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f563d230903210acc2336af58e422216b68ded76'/>
<id>urn:sha1:f563d230903210acc2336af58e422216b68ded76</id>
<content type='text'>
Non-standard requests can encode the actual interface number in a
non-standard way. For example composite_setup() assumes
that it is w_index &amp;&amp; 0xFF, but the printer function encodes the interface
number in a context-dependet way (either w_index or w_index &gt;&gt; 8).
This can lead to such requests being directed to wrong functions.

This patch adds req_match() method to usb_function. Its purpose is to
verify that a given request can be handled by a given function.
If any function within a configuration provides the method and it returns
true, then it is assumed that the right function is found.

If a function uses req_match(), it should try as hard as possible to
determine if the request is meant for it.

If no functions in a configuration provide req_match or none of them
returns true, then fall back to the usual approach.

Signed-off-by: Andrzej Pietrasiewicz &lt;andrzej.p@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>usb: gadget: configfs: add suspend/resume</title>
<updated>2014-11-03T16:00:59Z</updated>
<author>
<name>Andrzej Pietrasiewicz</name>
<email>andrzej.p@samsung.com</email>
</author>
<published>2014-10-08T10:03:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3a571870856f63064a3a45d7ffa2526d597b7fbe'/>
<id>urn:sha1:3a571870856f63064a3a45d7ffa2526d597b7fbe</id>
<content type='text'>
USB gadgets composed with configfs lack suspend and resume
methods. This patch uses composite_suspend()/composite_resume()
the same way e.g. composite_setup() or composite_disconnect()
are used in a configfs-based gadget.

Signed-off-by: Andrzej Pietrasiewicz &lt;andrzej.p@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
</feed>
