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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2016-10-25T07:00:53+02:00</updated>

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

		<entry>
		<author><name><![CDATA[BrainSlugs83]]></name></author>
		<updated>2016-10-25T07:00:53+02:00</updated>

		<published>2016-10-25T07:00:53+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10554&amp;p=31611#p31611</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10554&amp;p=31611#p31611"/>
		<title type="html"><![CDATA[Re: &quot;This device cannot start&quot; (code 10)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10554&amp;p=31611#p31611"><![CDATA[
Actually, scratch that.<br /><br />Looking closer at your code I noticed this:<br /><br /><div class="codebox"><p>Code: </p><pre><code>    0x95, 0x06,                 //    REPORT_COUNT (2)<br />    0x81, 0x03,                 //    INPUT (Cnst,Var,Abs)</code></pre></div><br /><br />Notice that your comment correctly says &quot;REPORT COUNT 2&quot;, but actually the code says 6.  You should just fix it to be 2 like the comment says and that should work.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=21891">BrainSlugs83</a> — Tue Oct 25, 2016 7:00 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[BrainSlugs83]]></name></author>
		<updated>2016-10-25T00:58:19+02:00</updated>

		<published>2016-10-25T00:58:19+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10554&amp;p=31609#p31609</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10554&amp;p=31609#p31609"/>
		<title type="html"><![CDATA[Re: &quot;This device cannot start&quot; (code 10)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10554&amp;p=31609#p31609"><![CDATA[
Looks like you have 14 buttons per gamepad -- 14 bits is definitely not byte aligned.<br /><br />You could add two buttons per gamepad to bring it up to 16 buttons, or you could add 2 bits of padding per gamepad.<br /><br />For padding, under &quot;0x05, 0x09 // Usage Page (Button)&quot;, right after &quot;0x81, 0x02  // (Input, Data, Var, Abs)&quot; you need to account for the two extra bits of data, something like:<br /><br /><div class="codebox"><p>Code: </p><pre><code>// Padding -- reportBuffer must be byte aligned:<br />0x75, 0x01,               //   REPORT_SIZE (1) <br />0x95, 0x02,               //   REPORT_COUNT (2)<br />0x81, 0x03,               //   INPUT (Constant, Var, Abs)</code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=21891">BrainSlugs83</a> — Tue Oct 25, 2016 12:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[renanAFJ]]></name></author>
		<updated>2016-09-01T00:31:04+02:00</updated>

		<published>2016-09-01T00:31:04+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10554&amp;p=31494#p31494</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10554&amp;p=31494#p31494"/>
		<title type="html"><![CDATA[&quot;This device cannot start&quot; (code 10)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10554&amp;p=31494#p31494"><![CDATA[
&quot;Report Descriptor was not byte aligned&quot; says the general info.<br />&quot;The passed ACL did not contain the minimum required information.&quot; says the &quot;Problem Status&quot; on.<br /><br />I´m a slightly changed version of the &quot;2 player gamepad&quot; descriptor available on this tutorial:<br /><!-- m --><a class="postlink" href="http://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/">http://eleccelerator.com/tutorial-about ... scriptors/</a><!-- m --><br /><br />My controller is a dual arcade one so each player have 14 buttons, so my descriptor goes like this:<br /><br /><div class="codebox"><p>Code: </p><pre><code>PROGMEM const char usbHidReportDescriptor&#91;USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH&#93; = <br />{<br />    //Gamepad 1 (34 bytes)<br />   0x05, 0x01,                 // USAGE_PAGE (Generic Desktop)<br />    0x09, 0x05,                 // USAGE (Game Pad)<br />    0xa1, 0x01,                 // COLLECTION (Application)<br />   0xa1, 0x00,                 //   COLLECTION (Physical)<br />   0x85, 0x01,               //     RERPOT_ID (1)<br />    0x05, 0x09,                 //     USAGE_PAGE (Button)<br />    0x19, 0x01,                 //     USAGE_MINIMUM (Button 1)<br />    0x29, 0x0e,                 //     USAGE_MAXIMUM (Button 14)<br />    0x15, 0x00,                 //     LOGICAL_MINIMUM (0)<br />    0x25, 0x01,                 //     LOGICAL_MAXIMUM (1)<br />    0x95, 0x0e,                 //    REPORT_COUNT (14)<br />    0x75, 0x01,                 //    REPORT_SIZE (1)<br />    0x81, 0x02,                 //    INPUT (Data,Var,Abs)<br />    0x75, 0x01,                 //    REPORT_SIZE (1)<br />    0x95, 0x06,                 //    REPORT_COUNT (2)<br />    0x81, 0x03,                 //    INPUT (Cnst,Var,Abs)<br />   0xc0,                       //   END_COLLECTION<br />    0xc0,                       // END_COLLECTION<br />   //Gamepad 2 (34 bytes)<br />   0x05, 0x01,                 // USAGE_PAGE (Generic Desktop)<br />   0x09, 0x05,                 // USAGE (Game Pad)<br />   0xa1, 0x01,                 // COLLECTION (Application)<br />   0xa1, 0x00,                 //   COLLECTION (Physical)<br />   0x85, 0x02,               //     REPORT_ID (2)<br />   0x05, 0x09,                 //     USAGE_PAGE (Button)<br />   0x19, 0x01,                 //     USAGE_MINIMUM (Button 1)<br />   0x29, 0x0e,                 //     USAGE_MAXIMUM (Button 14)<br />   0x15, 0x00,                 //     LOGICAL_MINIMUM (0)<br />   0x25, 0x01,                 //     LOGICAL_MAXIMUM (1)<br />   0x75, 0x01,                 //    REPORT_SIZE (1)<br />   0x95, 0x0e,                 //    REPORT_COUNT (14)<br />   0x81, 0x02,                 //    INPUT (Data,Var,Abs)<br />   0x75, 0x01,                 //    REPORT_SIZE (1)<br />   0x95, 0x06,                 //    REPORT_COUNT (2)<br />   0x81, 0x03,                 //    INPUT (Cnst,Var,Abs)<br />   0xc0,                       //   END_COLLECTION<br />   0xc0                  // END_COLLECTION<br />};<br /></code></pre></div><br /><br />My reports goes like this:<br /><div class="codebox"><p>Code: </p><pre><code>bufferToUse&#91;0&#93; =  1;<br />bufferToUse&#91;1&#93; =  buttonsPlayer1&#91;0&#93;;<br />bufferToUse&#91;2&#93; =  buttonsPlayer1&#91;1&#93;;<br />bufferToUse&#91;3&#93; =  2;<br />bufferToUse&#91;4&#93; =  buttonsPlayer2&#91;0&#93;;<br />bufferToUse&#91;5&#93; =  buttonsPlayer2&#91;1&#93;;</code></pre></div><br /><br />The reportBuffer DATABUFSIZE is set to 6<br /><div class="codebox"><p>Code: </p><pre><code>static uchar    reportBuffer&#91;DATABUFSIZE&#93;;   </code></pre></div><br /><br />and the usbFunctionSetup goes like this:<br /><br /><div class="codebox"><p>Code: </p><pre><code>uchar usbFunctionSetup(uchar data&#91;8&#93;)<br />{<br />   usbRequest_t* usbReq = (usbRequest_t *) data;<br /><br />    usbMsgPtr = reportBuffer;<br />    if((usbReq-&gt;bmRequestType &amp; USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS)<br />   {    <br />      // Class request type <br />        if(usbReq-&gt;bRequest == USBRQ_HID_GET_REPORT)<br />      {  <br />         // wValue: ReportType (highbyte), ReportID (lowbyte) <br />            // We only have one report type, so don't look at wValue <br />            buildReport(FALSE);<br />            return sizeof(reportBuffer);<br />        }<br />      else if(usbReq-&gt;bRequest == USBRQ_HID_GET_IDLE)<br />      {<br />            usbMsgPtr = &amp;idleRate;<br />            return 1;<br />        }<br />      else if(usbReq-&gt;bRequest == USBRQ_HID_SET_IDLE)<br />      {<br />            idleRate = usbReq-&gt;wValue.bytes&#91;1&#93;;<br />        }<br />    }<br />   else<br />   {<br />        // No vendor specific requests implemented<br />    }<br />   <br />   return 0;<br />}</code></pre></div><br /><br />I´ve used the Boxter project, by Olof Holmgren, as a safe place to start. Any ideas?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=22181">renanAFJ</a> — Thu Sep 01, 2016 12:31 am</p><hr />
]]></content>
	</entry>
	</feed>
