<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>RL-USB / Switch between several Devices</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/39874/rl-usb-switch-between-several-devices</link><description> 
We plan to add USB support to a device (based on LPC2xxx). 
User/Devicesoftware should decide if the device connects as Mass
Storage, VCOM or both. 
(similar found in several mobile phones &amp;quot;only charge&amp;quot;,&amp;quot;mass storage
device&amp;quot;,&amp;quot;internet tethering&amp;quot; etc</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: RL-USB / Switch between several Devices</title><link>https://community.arm.com/thread/61097?ContentTypeID=1</link><pubDate>Mon, 10 Sep 2012 01:30:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:60c80513-4694-432c-bf80-863c87370269</guid><dc:creator>Chinzei Tsuneo</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;gt; Does the KEIL Usbd-Stack support such &amp;quot;switching&amp;quot;?&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
The exposed interface of KEIL RL-USB library doesn&amp;#39;t support
run-time switch of USB configuration. If you would get the source
code of the library, it isn&amp;#39;t so difficult to modify the stack code
to support run-time configuration switch.&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;gt; Is there any opensource usb stack already supporting
this?&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
I&amp;#39;m not sure, if there is any one. Requirement of run-time config
switch is not a major one. Also, the modification of USB stack for
this purpose is not so difficult, if full source code of the stack
would be open.&lt;/p&gt;

&lt;p&gt;
To switch USB configuration, roughly speaking, your firmware
should change these features.&lt;br /&gt;
1) Descriptors&lt;br /&gt;
2) Parser/handler of Class requests&lt;br /&gt;
3) Endpoint process&lt;/p&gt;

&lt;p&gt;
The outline of modification is,&lt;/p&gt;

&lt;p&gt;
1) Descriptors&lt;br /&gt;
The descriptors are sent to host when host puts Get_Descriptor
request. In the process of this request, your firmware sends a
descriptor of the current configuration.&lt;/p&gt;

&lt;p&gt;
2) Parser/handler of Class requests&lt;br /&gt;
When host puts a class request, it is passed to the target class of
the interface number, specified by the SETUP data (usually, wIndex
field). However, config switch changes interface number of target
classes. Your firmware needs a thin process to resolve specified
interface number to the target interface of current
configuration.&lt;/p&gt;

&lt;p&gt;
3) Endpoint process&lt;br /&gt;
If your USB MCU has enough endpoints, you may assign unique
endpoint(s) for each class, so that config switch doesn&amp;#39;t affect to
the endpoint number.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>