<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/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/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Identifying status of usb is just Charging or usb is connected.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98414/identifying-status-of-usb-is-just-charging-or-usb-is-connected</link><description>Hello!! 
 I&amp;#39;m using USB C Type port to Charging battery and USB mass storage class. 
 My development platform is nRF5340 with nRF Connect SDK in MacOS. 
 
 In my known information, Writing file and mass storage class is not working in parallel. 
 So,</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 04 Apr 2023 13:05:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98414/identifying-status-of-usb-is-just-charging-or-usb-is-connected" /><item><title>RE: Identifying status of usb is just Charging or usb is connected.</title><link>https://devzone.nordicsemi.com/thread/419057?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2023 13:05:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3729631-57a4-4f61-a145-907590199d60</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Can you explain what you mean about &amp;quot;writing file&amp;quot; here? Do you have some source on where you&amp;#39;ve seen that MSC and writing file doesn&amp;#39;t work in parallel? The &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/doc/usb_state.html"&gt;USB state module&lt;/a&gt;&amp;nbsp;registers the CONFIG_USB_HID_DEVICE_COUNT instances, and reports the necessary callbacks to the device to ensure that the state of the USB connection is tracked with the following USB states:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a title="USB_STATE_DISCONNECTED" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/README.html#c.usb_state.USB_STATE_DISCONNECTED"&gt;&lt;code&gt;&lt;span&gt;USB_STATE_DISCONNECTED&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;- USB cable is not connected.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a title="USB_STATE_POWERED" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/README.html#c.usb_state.USB_STATE_POWERED"&gt;&lt;code&gt;&lt;span&gt;USB_STATE_POWERED&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;- The device is powered from USB but is not configured for the communication.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a title="USB_STATE_ACTIVE" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/README.html#c.usb_state.USB_STATE_ACTIVE"&gt;&lt;code&gt;&lt;span&gt;USB_STATE_ACTIVE&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;- The device is ready to exchange data with the host.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a title="USB_STATE_SUSPENDED" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/README.html#c.usb_state.USB_STATE_SUSPENDED"&gt;&lt;code&gt;&lt;span&gt;USB_STATE_SUSPENDED&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;- The host has requested the device to enter the suspended state.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;These states are broadcast by the USB state module with a USB_STATE_EVENT. So you should be able to check the USB state event if you only want to do these &amp;quot;write files&amp;quot; operation when the USB state is disconnected or suspended for example.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>