<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forums.obdev.at/app.php/feed/topic/3229" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2009-10-24T14:06:55+02:00</updated>

	<author><name><![CDATA[Objective Development Forums]]></name></author>
	<id>https://forums.obdev.at/app.php/feed/topic/3229</id>

		<entry>
		<author><name><![CDATA[pe0fko]]></name></author>
		<updated>2009-10-24T14:06:55+02:00</updated>

		<published>2009-10-24T14:06:55+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3229&amp;p=11540#p11540</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3229&amp;p=11540#p11540"/>
		<title type="html"><![CDATA[Re: Bug in USB_PROP_IS_RAM found.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3229&amp;p=11540#p11540"><![CDATA[
Hi Cristian,<br /><br />Thanks for your reply. I misunderstood the documentation I expect, did not understood that a string descriptor was different as a other descriptor.<br />Did make the change as you suggested and it is working now.<br /><br />Thanks for the useful library and sharing the code!<br />Fred<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=2772">pe0fko</a> — Sat Oct 24, 2009 2:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2009-09-22T10:46:27+02:00</updated>

		<published>2009-09-22T10:46:27+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3229&amp;p=11054#p11054</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3229&amp;p=11054#p11054"/>
		<title type="html"><![CDATA[Re: Bug in USB_PROP_IS_RAM found.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3229&amp;p=11054#p11054"><![CDATA[
The macro USB_PROP_LENGTH() is expected to return the descriptor length, not the string length.<br /><br />Your fix with len = 2 * (len + 1) works for string descriptors, but not for HID, report, device, endpoint and other descriptors. You should rather define<br /><div class="codebox"><p>Code: </p><pre><code>#define   USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER   (USB_PROP_IS_RAM |(2 * USB_CFG_SERIAL_NUMBER_LEN + 2))<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Tue Sep 22, 2009 10:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[pe0fko]]></name></author>
		<updated>2009-09-07T15:05:50+02:00</updated>

		<published>2009-09-07T15:05:50+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3229&amp;p=10869#p10869</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3229&amp;p=10869#p10869"/>
		<title type="html"><![CDATA[Bug in USB_PROP_IS_RAM found.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3229&amp;p=10869#p10869"><![CDATA[
I was trying to make a dynamic usb serial number in the firmware and want to use the USB_PROP_IS_RAM (not the USB_PROP_IS_DYNAMIC that seems to work).<br />The USB_PROP_IS_RAM did not work!<br />I did define in main.c:<br /><div class="codebox"><p>Code: </p><pre><code>int   usbDescriptorStringSerialNumber&#91;&#93; = {<br />    USB_STRING_DESCRIPTOR_HEADER(USB_CFG_SERIAL_NUMBER_LEN),<br />    USB_CFG_SERIAL_NUMBER<br />};<br /></code></pre></div><br />And in the usbconfig.h file:<br /><div class="codebox"><p>Code: </p><pre><code>#define   USB_CFG_SERIAL_NUMBER      'P','E','0','F','K','O','-','2','.','0'<br />#define   USB_CFG_SERIAL_NUMBER_LEN   10<br />#define   USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER   (USB_PROP_IS_RAM | USB_PROP_LENGTH(USB_CFG_SERIAL_NUMBER_LEN))<br /></code></pre></div><br />This source change alone was not sufficient to make the firmware running!<br /><br />I did found it had something to do with the length and changed the macro GET_DESCRIPTOR(..) in the source file usbdrv.c according the next code.<br /><div class="codebox"><p>Code: </p><pre><code>//+PE0FKO<br />#if 1<br /><br />#define GET_DESCRIPTOR(cfgProp, staticName)         \<br />    if(cfgProp){                                    \<br />        if((cfgProp) &amp; USB_PROP_IS_DYNAMIC){        \<br />            len = usbFunctionDescriptor(rq);        \<br />        }else{                                      \<br />            len = USB_PROP_LENGTH(cfgProp);         \<br />            usbMsgPtr = (uchar *)(staticName);      \<br />        }                                           \<br />        if((cfgProp) &amp; USB_PROP_IS_RAM)             \<br />        {    flags = 0; len = len*2+2;   }          \<br />    }<br /><br />#else<br /><br />#define GET_DESCRIPTOR(cfgProp, staticName)         \<br />    if(cfgProp){                                    \<br />        if((cfgProp) &amp; USB_PROP_IS_RAM)             \<br />            flags = 0;                              \<br />        if((cfgProp) &amp; USB_PROP_IS_DYNAMIC){        \<br />            len = usbFunctionDescriptor(rq);        \<br />        }else{                                      \<br />            len = USB_PROP_LENGTH(cfgProp);         \<br />            usbMsgPtr = (uchar *)(staticName);      \<br />        }                                           \<br />    }<br /><br />#endif<br />//-PE0FKO<br /></code></pre></div><br /><br />The length was not correct because the code <strong class="text-strong">#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER    sizeof(usbDescriptorStringSerialNumber)</strong> in the same usbdrv.c source file was not compiled in the next code part.<br /><div class="codebox"><p>Code: </p><pre><code>#if USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER == 0 &amp;&amp; USB_CFG_SERIAL_NUMBER_LEN<br />#undef USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER<br />#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER    sizeof(usbDescriptorStringSerialNumber)<br />PROGMEM int usbDescriptorStringSerialNumber&#91;&#93; = {<br />    USB_STRING_DESCRIPTOR_HEADER(USB_CFG_SERIAL_NUMBER_LEN),<br />    USB_CFG_SERIAL_NUMBER<br />};<br />#endif<br /></code></pre></div><br /><br />By changing the macro <strong class="text-strong">GET_DESCRIPTOR(..)</strong> I did get the code running  <img class="smilies" src="./../../../images/smilies/icon_biggrin.gif" alt=":D" title="Very Happy" /> <br /><br />Fred Krom<br />PE0FKO<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=2772">pe0fko</a> — Mon Sep 07, 2009 3:05 pm</p><hr />
]]></content>
	</entry>
	</feed>
