<?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/1465" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2008-05-24T19:03:43+02:00</updated>

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

		<entry>
		<author><name><![CDATA[kwebdesigns]]></name></author>
		<updated>2008-05-24T19:03:43+02:00</updated>

		<published>2008-05-24T19:03:43+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5435#p5435</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5435#p5435"/>
		<title type="html"><![CDATA[Adding Interrupt OUT to powerSwitch.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5435#p5435"><![CDATA[
I am having trouble getting a descriptor for Bulk-Out Endpoint 1. I too get -22 returned from writing to this endpoint.<br /><br />In usbconfig.h I have:<br /><div class="codebox"><p>Code: </p><pre><code>#define USB_CFG_DESCR_PROPS_CONFIGURATION           USB_PROP_IS_DYNAMIC</code></pre></div><br /><br />In main.c I have this for the descriptor:<br /><div class="codebox"><p>Code: </p><pre><code>PROGMEM char configDescriptor&#91;&#93; = &#123;    /* USB configuration descriptor */ <br />    9,          /* sizeof&#40;usbDescriptorConfiguration&#41;: length of descriptor in bytes */ <br />    USBDESCR_CONFIG,    /* descriptor type */ <br />    25,   /* total length of data returned &#40;including inlined descriptors&#41; */ <br />   0,<br />    1,          /* number of interfaces in this configuration */ <br />    1,          /* index of this configuration */ <br />    0,          /* configuration name string index */ <br />#if USB_CFG_IS_SELF_POWERED <br />    USBATTR_SELFPOWER,  /* attributes */ <br />#else <br />    USBATTR_BUSPOWER,   /* attributes */ <br />#endif <br />    USB_CFG_MAX_BUS_POWER/2,            /* max USB current in 2mA units */ <br />/* interface descriptor follows inline: */ <br />    9,          /* sizeof&#40;usbDescrInterface&#41;: length of descriptor in bytes */ <br />    USBDESCR_INTERFACE, /* descriptor type */ <br />    0,          /* index of this interface */ <br />    0,          /* alternate setting for this interface */ <br />    1,   /* endpoints excl 0: number of endpoint descriptors to follow */ <br />    USB_CFG_INTERFACE_CLASS, <br />    USB_CFG_INTERFACE_SUBCLASS, <br />    USB_CFG_INTERFACE_PROTOCOL, <br />    0,          /* string index for interface */ <br />/* endpoint descriptor for endpoint 1 out */ <br />    7,          /* sizeof&#40;usbDescrEndpoint&#41; */ <br />    USBDESCR_ENDPOINT,  /* descriptor type = endpoint */ <br />    0x01,       /* Out endpoint number 1 */ <br />    0x02,       /* attrib: Bulk endpoint */ <br />    8, 0,      /* maximum packet size */       <br />    USB_CFG_INTR_POLL_INTERVAL+25 /* in ms */ <br />&#125;;<br /><br />uchar usbFunctionDescriptor&#40; struct usbRequest *rq &#41; &#123;<br />   uchar *p = NULL, len = 0;<br />   <br />   if&#40;rq-&gt;wValue.bytes&#91;1&#93; == USBDESCR_CONFIG&#41;&#123;<br />      p = &#40;uchar *&#41;configDescriptor;<br />      len = sizeof&#40;configDescriptor&#41;;<br />   &#125;<br />   <br />    usbMsgPtr = p;<br />    return len;<br />&#125;</code></pre></div><br /><br />libusb shows this about my device:<br /><div class="codebox"><p>Code: </p><pre><code>  wTotalLength:         18<br />  bNumInterfaces:       1<br />  bConfigurationValue:  1<br />  iConfiguration:       0<br />  bmAttributes:         80h<br />  MaxPower:             50<br />    bInterfaceNumber:   0<br />    bAlternateSetting:  0<br />    bNumEndpoints:      0<br />    bInterfaceClass:    0<br />    bInterfaceSubClass: 0<br />    bInterfaceProtocol: 0<br />    iInterface:         0</code></pre></div><br />Any help would be appreciated. Thanks in advance.<br /><br />EDIT: I got it to work. Oddly enough I had removed the symbol to oddebug.o from the Makefile and I added it back to try and debug the device. After adding the symbol it worked.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=929">kwebdesigns</a> — Sat May 24, 2008 7:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[miroslav.talasek]]></name></author>
		<updated>2008-05-20T20:00:26+02:00</updated>

		<published>2008-05-20T20:00:26+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5411#p5411</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5411#p5411"/>
		<title type="html"><![CDATA[Adding Interrupt OUT to powerSwitch.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5411#p5411"><![CDATA[
my host code is <br /><div class="codebox"><p>Code: </p><pre><code>usb_init&#40;&#41;;<br />    if&#40;usbOpenDevice&#40;&amp;handle, USBDEV_SHARED_VENDOR, USBDEV_SHARED_PRODUCT&#41; != 0&#41;&#123;<br />        fprintf&#40;stderr, &quot;Could not find USB device \&quot;PowerSwitch\&quot; with vid=0x%x pid=0x%x\n&quot;, USBDEV_SHARED_VENDOR, USBDEV_SHARED_PRODUCT&#41;;<br />        exit&#40;1&#41;;<br />    &#125;<br />    usb_set_configuration&#40;handle, 1&#41;;<br /><br />    usb_claim_interface&#40;handle, 0&#41;;<br />    <br /><br />    nBytes = usb_control_msg&#40;handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, 0, RES&#40;100,100&#41;, 0, &#40;char *&#41;buffer, sizeof&#40;buffer&#41;, 5000&#41;;<br /><br /><br />   char bufferOut&#91;255&#93;;<br />   memset&#40;bufferOut,255,255&#41;;<br />   int test = usb_bulk_write&#40;<br />            handle,             // handle obtained with usb_open&#40;&#41;<br />           0x02,// identifies endpoint 2<br />           bufferOut,             // data buffer<br />           200,     <br />           10000<br />       &#41;;<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1104">miroslav.talasek</a> — Tue May 20, 2008 8:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-05-20T11:43:36+02:00</updated>

		<published>2008-05-20T11:43:36+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5406#p5406</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5406#p5406"/>
		<title type="html"><![CDATA[Adding Interrupt OUT to powerSwitch.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5406#p5406"><![CDATA[
did you set the configuration and claimed the interface on host side?<br /><br />the device open should look something like this:<br /><br /><div class="codebox"><p>Code: </p><pre><code>usb_dev_handle *handle;<br /> <br />if&#40;!usbOpenDevice&#40;&amp;handle, VENDOR_ID, NULL, PRODUCT_ID, NULL&#41;&#41;<br />    abortWithDeviceWasNotFondError&#40;&#41;;<br />usb_set_configuration&#40;handle, 1&#41;;<br />usb_claim_interface&#40;handle, 0&#41;;<br /><br /></code></pre></div><br /><br />from <a href="http://avrusb.wikidot.com/host-software" class="postlink">docu wiki</a><br /><br />so long,<br />comboy<p>Statistics: Posted by Guest — Tue May 20, 2008 11:43 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[miroslav.talasek]]></name></author>
		<updated>2008-05-20T08:05:02+02:00</updated>

		<published>2008-05-20T08:05:02+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5404#p5404</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5404#p5404"/>
		<title type="html"><![CDATA[Adding Interrupt OUT to powerSwitch.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5404#p5404"><![CDATA[
I buils my own descriptor with 2 endpoints <br /><br />in lsusb  now i can see <br /><div class="codebox"><p>Code: </p><pre><code>Interface Descriptor:<br />      bLength                 9<br />      bDescriptorType         4<br />      bInterfaceNumber        0<br />      bAlternateSetting       0<br />      bNumEndpoints           2<br />      bInterfaceClass         0 &#40;Defined at Interface level&#41;<br />      bInterfaceSubClass      0<br />      bInterfaceProtocol      0<br />      iInterface              0<br />      Endpoint Descriptor:<br />        bLength                 7<br />        bDescriptorType         5<br />        bEndpointAddress     0x00  EP 0 OUT<br />        bmAttributes            0<br />          Transfer Type            Control<br />          Synch Type               None<br />          Usage Type               Data<br />        wMaxPacketSize     0x0008  1x 8 bytes<br />        bInterval              10<br />      Endpoint Descriptor:<br />        bLength                 7<br />        bDescriptorType         5<br />        bEndpointAddress     0x02  EP 2 OUT<br />        bmAttributes            2<br />          Transfer Type            Bulk<br />          Synch Type               None<br />          Usage Type               Data<br />        wMaxPacketSize     0x00ff  1x 255 bytes<br />        bInterval              10<br />Device Status:     0x0000<br />  &#40;Bus Powered&#41;<br /></code></pre></div><br /><br />it seems all is ok <br />but function <br /><div class="codebox"><p>Code: </p><pre><code>char bufferOut&#91;255&#93;;<br />   memset&#40;bufferOut,255,255&#41;;<br />   int test = usb_bulk_write&#40;<br />            handle,             // handle obtained with usb_open&#40;&#41;<br />           0x02,// identifies endpoint 1<br />           bufferOut,             // data buffer<br />           200,     // maximum amount to read<br />           1000<br />       &#41;;<br /></code></pre></div><br />return not any error but always zero<br /><br />messages to control endpoint still work perfectly<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1104">miroslav.talasek</a> — Tue May 20, 2008 8:05 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-05-19T23:22:57+02:00</updated>

		<published>2008-05-19T23:22:57+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5403#p5403</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5403#p5403"/>
		<title type="html"><![CDATA[Adding Interrupt OUT to powerSwitch.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5403#p5403"><![CDATA[
ok i see <img class="smilies" src="./../../../images/smilies/icon_biggrin.gif" alt=":D" title="Very Happy" /><br /><br />Thanks for the help all!<br />this should also solve the problem of miroslav.talasek.<br />for a bulk out you need to define your endpoint as well<br /><br />so let's see what i can build with the newly aquired USB skills <img class="smilies" src="./../../../images/smilies/icon_biggrin.gif" alt=":D" title="Very Happy" /><br />comboy<p>Statistics: Posted by Guest — Mon May 19, 2008 11:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Grendel]]></name></author>
		<updated>2008-05-19T23:07:52+02:00</updated>

		<published>2008-05-19T23:07:52+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5402#p5402</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5402#p5402"/>
		<title type="html"><![CDATA[Adding Interrupt OUT to powerSwitch.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5402#p5402"><![CDATA[
Configure usbconfig.h to provide your own configuration descriptor (set USB_CFG_DESCR_PROPS_CONFIGURATION to USB_PROP_IS_DYNAMIC) and add the function uchar usbFunctionDescriptor( struct usbRequest *rq ) to your code.<br /><br />I don't have the time to go into detail (@ work right now..), I did it in my project tho -- check out the <a href="http://grendel.koolbear.com/files/3dpvert_2008-02-09.zip" class="postlink">3DP-Vert project</a> for details.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=101">Grendel</a> — Mon May 19, 2008 11:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-05-19T22:08:54+02:00</updated>

		<published>2008-05-19T22:08:54+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5401#p5401</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5401#p5401"/>
		<title type="html"><![CDATA[Adding Interrupt OUT to powerSwitch.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5401#p5401"><![CDATA[
Hooray! it works.<br />defining my own out endpoint in the usb descriptor helped. i found some info here<br /><a href="http://www.beyondlogic.org/usbnutshell/usb5.htm#EndpointDescriptors" class="postlink">USB in a nutshell</a><br /><br />the problem with all of port A bekoming 0xff was a little typo in my code <img class="smilies" src="./../../../images/smilies/icon_wink.gif" alt=";)" title="Wink" /><br /><br />but what i ask myself now is if there is a proper way of using only one interrupt out point without modifying usbdrv.c? <br /><br />so long,<br />comboy<p>Statistics: Posted by Guest — Mon May 19, 2008 10:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[miroslav.talasek]]></name></author>
		<updated>2008-05-19T10:58:15+02:00</updated>

		<published>2008-05-19T10:58:15+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5396#p5396</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5396#p5396"/>
		<title type="html"><![CDATA[Adding Interrupt OUT to powerSwitch.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5396#p5396"><![CDATA[
it is not a solution , it must work !<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1104">miroslav.talasek</a> — Mon May 19, 2008 10:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-05-19T10:25:27+02:00</updated>

		<published>2008-05-19T10:25:27+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5395#p5395</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5395#p5395"/>
		<title type="html"><![CDATA[Adding Interrupt OUT to powerSwitch.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5395#p5395"><![CDATA[
Meanwhile I assume error -22 means no endpoint found <img class="smilies" src="./../../../images/smilies/icon_wink.gif" alt=";)" title="Wink" /><br /><br />I added an endpoint descriptor manually to usbdrv.c, now the usb_interrupt_write() function returns a valid value.<br /><br />it doesn't mean my device works now... no matter what instruction is in<br />usbFunctionWriteOut() all LEDs on port A light up when interrupt is received.<br />even if usbFunctionWriteOut contains PORTA = 0x00;<br /><br />any ideas on this?<br /><br />same happens when i try to send some payload data with a controller msg.<br />the host says transfer went allright, but on my usb device, again, all LEDs on port A light up even if usbFunctionWrite() contains only PORTA = 0x00;<br /><br />so long,<br /><br />ComBoy <img class="smilies" src="./../../../images/smilies/icon_smile.gif" alt=":)" title="Smile" /><p>Statistics: Posted by Guest — Mon May 19, 2008 10:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Grendel]]></name></author>
		<updated>2008-05-19T09:42:57+02:00</updated>

		<published>2008-05-19T09:42:57+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5394#p5394</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5394#p5394"/>
		<title type="html"><![CDATA[Adding Interrupt OUT to powerSwitch.]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1465&amp;p=5394#p5394"><![CDATA[
Seems there's no endpoint descriptor for any OUT EP in the default configuration descriptor in usbdrv.c. What does error -22 mean ?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=101">Grendel</a> — Mon May 19, 2008 9:42 am</p><hr />
]]></content>
	</entry>
	</feed>
