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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2010-01-13T16:25:19+02:00</updated>

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

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2010-01-13T16:25:19+02:00</updated>

		<published>2010-01-13T16:25:19+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3765&amp;p=12817#p12817</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3765&amp;p=12817#p12817"/>
		<title type="html"><![CDATA[endpoints, claim_interface problems]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3765&amp;p=12817#p12817"><![CDATA[
Hi,<br /><br />i`m writting a simple application using libusb-win32 and AVRUSB on atmega8 and windows 7 (but I had also these problems on XP). I have installed LIBUSB64Fix. I have problem with endpoints other than endpoint 0. Control messages work fine. But when I want to send something by usb_bulk_write() to e.g. endpoint 1 I have some problems. I suppose that by the device side everything is ok, endpoints are &quot;enabled&quot; in usbconfig.h and when I run usblib test application (testlibusb-win.exe) I get:<br /><br /><div class="codebox"><p>Code: </p><pre><code>DLL version:   0.1.12.1<br />Driver version:   0.1.10.2<br /><br />bus/device  idVendor/idProduct<br />bus-0/\\.\libusb0-0001--0x16ad-0x05dc     16AD/05DC<br />- Manufacturer : obdev.at<br />- Product      : Akcelerometr_XYZ<br />  wTotalLength:         32<br />  bNumInterfaces:       1<br />  bConfigurationValue:  1<br />  iConfiguration:       0<br />  bmAttributes:         80h<br />  MaxPower:             50<br />    bInterfaceNumber:   0<br />    bAlternateSetting:  0<br />    bNumEndpoints:      2<br />    bInterfaceClass:    0<br />    bInterfaceSubClass: 0<br />    bInterfaceProtocol: 0<br />    iInterface:         0<br />      bEndpointAddress: 81h<br />      bmAttributes:     03h<br />      wMaxPacketSize:   8<br />      bInterval:        10<br />      bRefresh:         0<br />      bSynchAddress:    0<br />      bEndpointAddress: 83h<br />      bmAttributes:     03h<br />      wMaxPacketSize:   8<br />      bInterval:        10<br />      bRefresh:         0<br />      bSynchAddress:    0<br /></code></pre></div><br /><br />So I can see that I should have two endpoints more than control ep.<br /><br />My code of host application:<br /><div class="codebox"><p>Code: </p><pre><code>int main()<br />{<br />   usb_dev_handle* hDevice;        <br />   char buffer&#91;8&#93;;<br /><br />// OpenUsbDevice() - function finding devices and returning hadnle to ones - works fine<br />   if( (hDevice = OpenUsbDevice()) == 0 ) {<br />      cout &lt;&lt; &quot;Urzadzenie nieodnalezione&quot; &lt;&lt; endl; <br />      exit(1);<br />   }<br />   <br />   int ctrl = usb_control_msg(hDevice, USB_TYPE_VENDOR, 1, 0, 0, 0, 0, 3000);              // WORKS FINE<br />   <br />   if(ctrl &lt; 0 ){<br />      cout &lt;&lt; &quot;Blad polaczenia&quot; &lt;&lt; endl;      <br />      exit(1);<br />   }<br />   <br />   usb_set_configuration(hDevice, 1);<br />   usb_claim_interface(hDevice, 0);<br />   cout &lt;&lt; usb_strerror() &lt;&lt; endl;<br /><br />   usb_bulk_write(hDevice, USB_ENDPOINT_IN | 1, buffer, sizeof(buffer), 5000);<br />      <br />   cout &lt;&lt; usb_strerror() &lt;&lt; endl;<br /><br />   usb_release_interface(hDevice, 0);<br />   usb_close(hDevice);<br />   system(&quot;PAUSE&quot;);<br />   return 0;<br />}<br /></code></pre></div><br /><br />I`m getting such errors:<br /><br />for claim function usb_claim_interface(hDevice, 0);  (when second parameter is 0) :<br /><em class="text-italics">usb_os_find_devices: couldn't read device descriptor</em><br /><br />for claim function usb_claim_interface(hDevice, 1); (when second parameter is 1) :<br /><em class="text-italics">usb_claim_interface: could not claim interface 1, win error: The parameter is in correct.</em><br /><br />for usb_bulk_write(hDevice, USB_ENDPOINT_IN | 1, buffer, sizeof(buffer), 5000); i got:<br /><em class="text-italics">_usb_setup_async: invalid endpoint 0x81</em><br /><br />Please, help...<p>Statistics: Posted by Guest — Wed Jan 13, 2010 4:25 pm</p><hr />
]]></content>
	</entry>
	</feed>
