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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2015-12-15T02:55:52+02:00</updated>

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

		<entry>
		<author><name><![CDATA[ulao]]></name></author>
		<updated>2015-12-15T02:55:52+02:00</updated>

		<published>2015-12-15T02:55:52+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10174&amp;p=30617#p30617</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10174&amp;p=30617#p30617"/>
		<title type="html"><![CDATA[usb functino write on linux]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10174&amp;p=30617#p30617"><![CDATA[
Linux oes not seem to be replying to my usb function writes? Windows seems to be ok.<br /><br />I do see this with usbmon<br />&gt; e.g. status code &quot;-115&quot;<br />Assuming x86 32, -115 = -EINPROGRESS, that means URB still pending, no results yet<br /><br /><div class="codebox"><p>Code: </p><pre><code>ffff8800089495c0 3713432687 S Ci:2:007:0 s a1 01 0302 0000 0005 8 &lt;<br />ffff8800089495c0 3713436685 C Ci:2:007:0 0 5 = 02000201 01<br />ffff8800089495c0 3713436692 S Ci:2:007:0 s a1 01 0303 0000 0005 8 &lt;<br />ffff8800089495c0 3713440574 C Ci:2:007:0 0 5 = 030101ff 01<br />ffff880008948f00 3713441250 S Io:2:007:1 -115:8 2 = 0c04<br />ffff880008948f00 3713445537 C Io:2:007:1 0:8 2 &gt;<br />ffff880008948f00 3713445589 S Io:2:007:1 -115:8 2 = 0c04<br />ffff880008948f00 3713453546 C Io:2:007:1 0:8 2 &gt;<br />ffff880008948f00 3713453577 S Io:2:007:1 -115:8 2 = 0c01<br />ffff880008948f00 3713461603 C Io:2:007:1 0:8 2 &gt;</code></pre></div><br /><br />This is my pipe set up.<br /><div class="codebox"><p>Code: </p><pre><code>char my_usbDescriptorConfiguration&#91;&#93; = {    /* USB configuration descriptor */<br />     9,          /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */<br />    USBDESCR_CONFIG,    /* descriptor type */<br />    18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + /*7 * USB_CFG_HAVE_INTRIN_ENDPOINT3*/ + 7 + 9, 0,<br />                /* total length of data returned (including inlined descriptors) */<br />    1,          /* number of interfaces in this configuration */<br />    1,          /* index of this configuration */<br />    0,          /* configuration name string index */<br />    USB_CFG_IS_SELF_POWERED,  /* attributes */<br /><br />    USB_CFG_MAX_BUS_POWER/2,            /* max USB current in 2mA units */<br />/* interface descriptor follows inline: */<br />    9,          /* sizeof(usbDescrInterface): 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 + USB_CFG_HAVE_INTRIN_ENDPOINT ,//+ USB_CFG_HAVE_INTRIN_ENDPOINT3,   /* 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 /><br />    9,          /* sizeof(usbDescrHID): length of descriptor in bytes */<br />    USBDESCR_HID,   /* descriptor type: HID */<br />    0x10, 0x01, /* BCD representation of HID version */<br />    0x00,       /* target country code */<br />    0x01,       /* number of HID Report (or other HID class) Descriptor infos to follow */<br />    0x22,       /* descriptor type: report */<br />    USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 5,  /* total length of report descriptor *///<br />//#endif<br /><br /><br />#if USB_CFG_HAVE_INTRIN_ENDPOINT    /* endpoint descriptor for endpoint 1 */<br />    7,          /* sizeof(usbDescrEndpoint) */ <br />    USBDESCR_ENDPOINT,  /* descriptor type = endpoint */<br />   0x81,       // bulk IN endpoint number 1 <br />    0x03,       /* attrib: Interrupt endpoint */<br />    8, 0,       /* maximum packet size */ <br />    0x08, /* in ms*/<br /><br />//the output.<br /><br />    7,          // sizeof(usbDescrEndpoint)<br />    5,  // descriptor type = endpoint<br />    0x01,      // out endpoint number 2 <br />    0x03,       // attrib: Interrupt endpoint <br />    8, 0,       // maximum packet size <br />    0x08, // in ms<br />#endif   <br /><br />};<br /></code></pre></div><br /><br />My descriptor set up<br /><div class="codebox"><p>Code: </p><pre><code>unsigned   usbFunctionDescriptor(struct usbRequest *rq)<br />{<br />   if ((rq-&gt;bmRequestType &amp; USBRQ_TYPE_MASK) != USBRQ_TYPE_STANDARD)<br />      return 0;<br /><br />   if (rq-&gt;bRequest == USBRQ_GET_DESCRIPTOR)<br />   {<br />      // USB spec 9.4.3, high byte is descriptor type<br />      switch (rq-&gt;wValue.bytes&#91;1&#93;)<br />      {<br />         case USBDESCR_DEVICE:<br />            usbMsgPtr = (void*)usbDescrDevice;      <br />            return getUsbDescrDevice_size();<br />         case USBDESCR_HID_REPORT:<br />            usbMsgPtr = (void*)analog_usbHidReportDescriptor;<br />            return  getAnalogUsbHidReportDescriptor_size();<br />         case USBDESCR_CONFIG:<br />            usbMsgPtr = my_usbDescriptorConfiguration;<br />            return sizeof(my_usbDescriptorConfiguration);<br />      }<br />   }<br /><br />   return 0;<br />}<br /></code></pre></div><br /><br />Linux reports that is see's both pipes.<br /><div class="codebox"><p>Code: </p><pre><code> Endpoint Descriptor:<br />        bLength                 7<br />        bDescriptorType         5<br />        bEndpointAddress     0x81  EP 1 IN<br />        bmAttributes            3<br />          Transfer Type            Interrupt<br />          Synch Type               None<br />          Usage Type               Data<br />        wMaxPacketSize     0x0008  1x 8 bytes<br />        bInterval               8<br />      Endpoint Descriptor:<br />        bLength                 7<br />        bDescriptorType         5<br />        bEndpointAddress     0x01  EP 1 OUT<br />        bmAttributes            3<br />          Transfer Type            Interrupt<br />          Synch Type               None<br />          Usage Type               Data<br />        wMaxPacketSize     0x0008  1x 8 bytes<br />        bInterval               8</code></pre></div><br />but  uchar usbFunctionWrite(uchar *data, uchar len) is never called. <br /><br />I do have a if(rq-&gt;bRequest == USBRQ_HID_SET_REPORT)  return USB_NO_MSG; in my usbFunctionSetup but as mentioned windows is working so I know its done mostly correct. Seems its only linux based OS's.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=1281">ulao</a> — Tue Dec 15, 2015 2:55 am</p><hr />
]]></content>
	</entry>
	</feed>
