<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: To obj_ptr-&amp;gt;desc_callback.set_configuration() or not to obj_ptr-&amp;gt;desc_callback.set_configuration(), that is the question. in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/To-obj-ptr-gt-desc-callback-set-configuration-or-not-to-obj-ptr/m-p/345551#M16832</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the report! I have passed it to our USB stack team, and will let you when I have any more information!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Best Regards,&lt;/P&gt;&lt;P&gt;Kan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Mar 2015 07:08:40 GMT</pubDate>
    <dc:creator>Kan_Li</dc:creator>
    <dc:date>2015-03-04T07:08:40Z</dc:date>
    <item>
      <title>To obj_ptr-&gt;desc_callback.set_configuration() or not to obj_ptr-&gt;desc_callback.set_configuration(), that is the question.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/To-obj-ptr-gt-desc-callback-set-configuration-or-not-to-obj-ptr/m-p/345550#M16831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found something interesting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While researching the set_configuration() callback, I got curious, and did a find/grep, to find everyone who called it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;c:\Freescale_BM_USB_Stack_v5.0\Src\usb_core\device\sources\classes&amp;gt;find . -name *.[ch] | xargs grep set_configuration&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;./cdc/usb_cdc.c:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cdc_obj_ptr-&amp;gt;desc_callback.set_configuration((uint32_t)cdc_obj_ptr-&amp;gt;controller_handle, (uint8_t)(*(uint16_t*)val));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;./msd/usb_msc.c:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msc_dev_ptr-&amp;gt;desc_callback.set_configuration((uint32_t)msc_dev_ptr-&amp;gt;controller_handle, (uint8_t)(*(uint16_t *)val));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It appears that only the CDC and MSC classes pass the SetConfiguration event to the application.&amp;nbsp; The Audio, DFU, HID, and PHDC classes do not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A composite device that combined both a CDC and an MSC would hit the callback twice.&amp;nbsp; Conversely, an Audio/HID composite device would never hit the callback.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Possibly similar lines should be added to the Audio, DFU, HID, and PHDC device class drivers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Possibly, those lines should be guarded with #if !USBCFG_DEV_COMPOSITE/#endif, and an unguarded similar line added to usb_composite.c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All such lines should certainly be guarded with lines of the form:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (cdc_obj_ptr-&amp;gt;desc_callback.set_configuration)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (msc_dev_ptr-&amp;gt;desc_callback.set_configuration)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to make certain nobody crashes their device by passing a NULL callback.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 20:13:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/To-obj-ptr-gt-desc-callback-set-configuration-or-not-to-obj-ptr/m-p/345550#M16831</guid>
      <dc:creator>johnstrohm</dc:creator>
      <dc:date>2015-02-27T20:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: To obj_ptr-&gt;desc_callback.set_configuration() or not to obj_ptr-&gt;desc_callback.set_configuration(), that is the question.</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/To-obj-ptr-gt-desc-callback-set-configuration-or-not-to-obj-ptr/m-p/345551#M16832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the report! I have passed it to our USB stack team, and will let you when I have any more information!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Best Regards,&lt;/P&gt;&lt;P&gt;Kan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 07:08:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/To-obj-ptr-gt-desc-callback-set-configuration-or-not-to-obj-ptr/m-p/345551#M16832</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2015-03-04T07:08:40Z</dc:date>
    </item>
  </channel>
</rss>

