<?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>how to get the callback of usb communicate ok?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76138/how-to-get-the-callback-of-usb-communicate-ok</link><description>hi, 
 im use the usb of nrf52840,and i want to get the event that the usb communicate is build.for example，the usb wire of pc can plug in the usb of 52840，and the usb wire of charge adapter also can plug in the usb of nrf52840,so how can i know the host</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 15 Jun 2021 14:10:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76138/how-to-get-the-callback-of-usb-communicate-ok" /><item><title>RE: how to get the callback of usb communicate ok?</title><link>https://devzone.nordicsemi.com/thread/315441?ContentTypeID=1</link><pubDate>Tue, 15 Jun 2021 14:10:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8db838a-fbf2-4553-a93e-7e63a8f0b775</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If I understand correctly, the problem is that once you enable CapsLock with wired usb mode, all keys are invalid.&lt;/p&gt;
&lt;p&gt;Are you sure that you are setting the correct bit in the usb keyboard &amp;quot;modifier key&amp;quot; byte ?&lt;/p&gt;
&lt;p&gt;In this specification, page 70:&amp;nbsp;&lt;a href="https://www.usb.org/sites/default/files/documents/hid1_11.pdf"&gt;https://www.usb.org/sites/default/files/documents/hid1_11.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The &amp;quot;modifier key&amp;quot; byte is defined as following:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1623766016391v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It states that you shall set bit 1 (ie: 0x02) to enable caps lock.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get the callback of usb communicate ok?</title><link>https://devzone.nordicsemi.com/thread/315263?ContentTypeID=1</link><pubDate>Tue, 15 Jun 2021 04:05:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8398faa7-75b1-4439-8f24-1099f24e6535</guid><dc:creator>pipixia_8_8</dc:creator><description>&lt;p&gt;the key unvalid is in the usbmode of&amp;nbsp; mac os,windowns will not ,and the ble mode of mac&amp;nbsp; os also will not&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get the callback of usb communicate ok?</title><link>https://devzone.nordicsemi.com/thread/315261?ContentTypeID=1</link><pubDate>Tue, 15 Jun 2021 03:58:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cddf02d4-e72f-484c-8548-f11153c89ff2</guid><dc:creator>pipixia_8_8</dc:creator><description>&lt;p&gt;hi&lt;/p&gt;
&lt;p&gt;thanks for your reply，and resolve the problem, but now a new problem is that in the usb mode the caplock key will unit the key send ,if i press the capslock ，the key like a,b,c,d will unvalid,but the in the ble mode，there is no the problem also windows not to.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get the callback of usb communicate ok?</title><link>https://devzone.nordicsemi.com/thread/314450?ContentTypeID=1</link><pubDate>Wed, 09 Jun 2021 12:06:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d5e2ba3-ce96-4e66-8c9b-b9bd575ced2e</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The USB state can be fetched via this function:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;state = usbd_core_state_get();&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The power events&amp;nbsp;APP_USBD_EVT_POWER_READY and&amp;nbsp;APP_USBD_EVT_POWER_REMOVED can be used for detecting power.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>