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

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2010-08-10T21:57:03+02:00</updated>

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

		<entry>
		<author><name><![CDATA[n-regen]]></name></author>
		<updated>2010-08-10T21:57:03+02:00</updated>

		<published>2010-08-10T21:57:03+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3748&amp;p=15494#p15494</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=15494#p15494"/>
		<title type="html"><![CDATA[Re: How to output data to e.g. HID device]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=15494#p15494"><![CDATA[
<blockquote><div><cite>iphi wrote:</cite>Ok, I finally figured it out to feed HID_DATA from Delphi.<br />The JvHidController component works great.<br />If anybody would like the Pascal code, contact me.<br />Tom</div></blockquote><br />Could you please upload your source somewhere or send it to nrsend-delphihiddata[at]yahoo[dot]de?<br />I spent the whole day trying different Delphi-implementations of the hid-data example and all of them failed, so a working example would be really helpful.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=4225">n-regen</a> — Tue Aug 10, 2010 9:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2010-05-17T15:14:04+02:00</updated>

		<published>2010-05-17T15:14:04+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3748&amp;p=14495#p14495</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=14495#p14495"/>
		<title type="html"><![CDATA[Re: How to output data to e.g. HID device]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=14495#p14495"><![CDATA[
Have you checked that bytesRemaining is 16 bit, not 8 bit as in the example?<br /><br />In any case, you don't need to change the logical maximum. that's just the value range of a byte explained to the host side driver.<br /><br />Also, please check whether you use usbRequest-&gt;wLength anywhere. Most examples use the low 8 bit only in order to save code size. If you exceed 255 bytes, you must honor all 16 bits.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Mon May 17, 2010 3:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dima_hz]]></name></author>
		<updated>2010-05-14T17:08:24+02:00</updated>

		<published>2010-05-14T17:08:24+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3748&amp;p=14471#p14471</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=14471#p14471"/>
		<title type="html"><![CDATA[How to output data to e.g. HID device]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=14471#p14471"><![CDATA[
answer for (vsovereign)<br />regarding your last post. this functions are used for converting received data from USB device to strings and printing them into the application. Also All Bytes have in front the sign (0x) when they are shown to you in hidtool.c eg: 0xFF, 0x01, etc.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3898">dima_hz</a> — Fri May 14, 2010 5:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dima_hz]]></name></author>
		<updated>2010-05-14T17:04:33+02:00</updated>

		<published>2010-05-14T17:04:33+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3748&amp;p=14470#p14470</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=14470#p14470"/>
		<title type="html"><![CDATA[How to output data to e.g. HID device]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=14470#p14470"><![CDATA[
Hello everyone here. Nice work i have found here. I also have a little time and just tried something from here. Also i know about this site from long time ago. Sincerely i like everything which is here.<br />Now i would like to ask something about increasing lenght from 254 to 512 or 1024... maximum which i could try was 254 bytes. If i try to put something bigger it returns strange values... In one word the result is not satisfactory. I am speaking about hiddata example. so there is what i have done:<br /><br />1. increased the report count<br /><br /><span style="color: #0040FF">PROGMEM char usbHidReportDescriptor[23] = {    /* USB report descriptor */<br />    0x06, 0x00, 0xff,              // USAGE_PAGE (Generic Desktop)<br />    0x09, 0x01,                    // USAGE (Vendor Usage 1)<br />    0xa1, 0x01,                    // COLLECTION (Application)<br />    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)<br />    0x26, 0xff, 0x00,              //   LOGICAL_MAXIMUM (255)<br />    0x75, 0x08,                    //   REPORT_SIZE (8)<br />//0x95, 0x80,                  //   REPORT_COUNT (128)<br />//0x95, 0xFF,                  //   REPORT_COUNT (255)<br />//0x96, 0x00, 0x01,              //   REPORT_COUNT (256)<br />0x96, 0x00, 0x02,              //   REPORT_COUNT (512)<br />    0x09, 0x00,                    //   USAGE (Undefined)<br />    0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)<br />    0xc0                           // END_COLLECTION<br />};</span><br /><br /><br /><br /><br />2. <span style="color: #0000FF">changed usbHidReportDescriptor[23] from 22 to 23</span><br /><br />3. changed the same value at usbconfig.h<br /><span style="color: #0000FF">#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH    23</span><br /><br />3. changed long transfers in usbconfig.h<br /><span style="color: #0000FF">#define USB_CFG_LONG_TRANSFERS          1</span><br /><br />4. created one #define in main.c (firmware code) to work much easier and to not look everywere for values... and used this define everywhere in the code where was indicated 128 (original value) and replaced.<br /><br />#define EEP_BITES255// number of bytes remaining. Original 128<br /><br /><span style="color: #000000">usbMsgLen_t usbFunctionSetup(uchar data[8])<br />{<br />usbRequest_t    *rq = (void *)data;<br /><br />    if((rq-&gt;bmRequestType &amp; USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS){    /* HID class request */<br />        if(rq-&gt;bRequest == USBRQ_HID_GET_REPORT){  /* wValue: ReportType (highbyte), ReportID (lowbyte) */<br />            /* since we have only one report type, we can ignore the report-ID */<br />            bytesRemaining = EEP_BITES;<br />            currentAddress = 0;<br />            return USB_NO_MSG;  /* use usbFunctionRead() to obtain data */<br />        }else if(rq-&gt;bRequest == USBRQ_HID_SET_REPORT){<br />            /* since we have only one report type, we can ignore the report-ID */<br />            bytesRemaining = EEP_BITES;<br />            currentAddress = 0;<br />            return USB_NO_MSG;  /* use usbFunctionWrite() to receive data from host */<br />        }<br />    }else{<br />//..... case 0.1.2....<br />}</span><br /><br /><br />5. Now speaking about hidtool.exe<br />i have changed lenght from 129 (128+1) to 513 (512+1)<br /><br /><span style="color: #0000FF">int main(int argc, char **argv)<br />{<br />usbDevice_t *dev;<br />char        buffer[513];    /* room for dummy report ID*/<br />int         err;<br /><br />    if(argc &lt; 2){<br />        usage(argv[0]);<br />        exit(1);<br />    }<br />    if((dev = openDevice()) == NULL)<br />        exit(1);<br />    if(strcasecmp(argv[1], &quot;read&quot;) == 0){<br />        int len = sizeof(buffer);<br />        if((err = usbhidGetReport(dev, 0, buffer, &amp;len)) != 0){<br />            fprintf(stderr, &quot;error reading data: %s\n&quot;, usbErrorMessage(err));<br />        }else{<br />            hexdump(buffer + 1, sizeof(buffer) - 1);<br />        }<br />    }else if(strcasecmp(argv[1], &quot;write&quot;) == 0){<br />        int i, pos;<br />        memset(buffer, 0, sizeof(buffer));<br />        for(pos = 1, i = 2; i &lt; argc &amp;&amp; pos &lt; sizeof(buffer); i++){<br />            pos += hexread(buffer + pos, argv[i], sizeof(buffer) - pos);<br />        }<br />        if((err = usbhidSetReport(dev, buffer, sizeof(buffer))) != 0)   /* add a dummy report ID */<br />            fprintf(stderr, &quot;error writing data: %s\n&quot;, usbErrorMessage(err));<br />    }else{<br />        usage(argv[0]);<br />        exit(1);<br />    }<br />    usbhidCloseDevice(dev);<br />    return 0;<br />}</span><br /><br />compiled with MinGW. everything work fine device reads 512 bytes. but correctly it reads only first 255 because in main.c there is  (#define EEP_BITES255// number of bytes remaining. Original 128)<br />now when i try to increase this to 256 or much much more it doesn`t read even first 255 bytes. I guess it sends command in hex format like 0xFF (254 bytes) or maybe i am wrong why i can`t get it work???<br />should i increase this too in HidDescriptors: PROGMEM --&gt;&gt;&gt;&gt;     0x26, 0xff, 0x00,              //   LOGICAL_MAXIMUM (255) to 511 or bigger? any ideea please<br />I have increased it to read from 128 to 255 but how to do it for much more??? Now devices have bigger eeprom sizes. Thanks!!! and sorry for my long long message. I appreciate that from you! Soon i will post some examples which i have developed in C++ builder 2009 based on powerswitch... opening, closing ports ; read write some bits to eeprom ; controlling LCD in the same time, etc All with GUI interface.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3898">dima_hz</a> — Fri May 14, 2010 5:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[vsovereign]]></name></author>
		<updated>2010-02-21T18:35:08+02:00</updated>

		<published>2010-02-21T18:35:08+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3748&amp;p=13344#p13344</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=13344#p13344"/>
		<title type="html"><![CDATA[Re: How to output data to e.g. HID device]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=13344#p13344"><![CDATA[
Hi,<br /><br />sorry for this newbie question.<br />I've run the HID_data example that is mentioned above.<br />It works okay.<br />But now I'm trying to understand it.<br />Especially the host part.<br /><br />hidtool.c is how you read and write to the device.<br />But how does it actually accomplish this?<br /><br />hiddata.c .....well I assume this is where the device is recognized?<br />Also where the size of the data is determined?<br />But I thought that the firmware part does the recognizing task.<br />Why do we need another program?<br />Is my understanding of hiddata.c correct?<br /><br />Also what do these do? They're in : vusb -&gt; examples -&gt; hid_data -&gt; commandline -&gt; hid_tool<br /><br /><blockquote class="uncited"><div><br />static void hexdump(char *buffer, int len)<br />{<br />int     i;<br />FILE    *fp = stdout;<br /><br />    for(i = 0; i &lt; len; i++){<br />        if(i != 0){<br />            if(i % 16 == 0){<br />                fprintf(fp, &quot;\n&quot;);<br />            }else{<br />                fprintf(fp, &quot; &quot;);    <br />            }<br />        }<br />        fprintf(fp, &quot;0x%02x&quot;, buffer[i] &amp; 0xff);<br />    }<br />    if(i != 0)<br />        fprintf(fp, &quot;\n&quot;);<br />}<br /><br />static int  hexread(char *buffer, char *string, int buflen)<br />{<br />char    *s;<br />int     pos = 0;      <br /><br />    while((s = strtok(string, &quot;, &quot;)) != NULL &amp;&amp; pos &lt; buflen){<br />        string = NULL;<br />        buffer[pos++] = (char)strtol(s, NULL, 0);<br />    }<br />    return pos;<br />}<br /><br /></div></blockquote><br /><br /><br />Thank you<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3326">vsovereign</a> — Sun Feb 21, 2010 6:35 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[pcs]]></name></author>
		<updated>2010-02-10T23:15:10+02:00</updated>

		<published>2010-02-10T23:15:10+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3748&amp;p=13204#p13204</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=13204#p13204"/>
		<title type="html"><![CDATA[Re: How to output data to e.g. HID device]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=13204#p13204"><![CDATA[
hi,<br /><br />i would be interested how to get the HID smaple to work with the Delphi HIDcontroller.<br />Tom can you please give me some advce?<br /><br />kind regards<br />pcs<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3519">pcs</a> — Wed Feb 10, 2010 11:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2010-01-22T11:36:52+02:00</updated>

		<published>2010-01-22T11:36:52+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3748&amp;p=12956#p12956</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=12956#p12956"/>
		<title type="html"><![CDATA[Re: How to output data to e.g. HID device]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=12956#p12956"><![CDATA[
Endpoint 0 is described in the USB spec. Since it MUST be a control endpoint, there is no need to add a separate descriptor for it.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Fri Jan 22, 2010 11:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[uchar]]></name></author>
		<updated>2010-01-21T15:03:44+02:00</updated>

		<published>2010-01-21T15:03:44+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3748&amp;p=12944#p12944</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=12944#p12944"/>
		<title type="html"><![CDATA[Re: How to output data to e.g. HID device]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=12944#p12944"><![CDATA[
Christian, is again necessary to me your help <img class="smilies" src="./../../../images/smilies/icon_smile.gif" alt=":)" title="Smile" /> <br /><br />In an example hid-data the exchange goes through default control endpoint. Where it is described descriptor by this endpoint? (In a file usbdrv.c  described two endpoint, with numbers 1 and 3)<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3029">uchar</a> — Thu Jan 21, 2010 3:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[uchar]]></name></author>
		<updated>2010-01-20T18:38:54+02:00</updated>

		<published>2010-01-20T18:38:54+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3748&amp;p=12931#p12931</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=12931#p12931"/>
		<title type="html"><![CDATA[Re: How to output data to e.g. HID device]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=12931#p12931"><![CDATA[
Excuse, I have understood <img class="smilies" src="./../../../images/smilies/icon_smile.gif" alt=":)" title="Smile" /> <br /><br />Has downloaded HID Descriptor Tool and has checked up parametre Report Count - for 512 byte it should be such: 0x96, 0x00, 0x02.<br /><br />Now all works <img class="smilies" src="./../../../images/smilies/icon_smile.gif" alt=":)" title="Smile" /><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3029">uchar</a> — Wed Jan 20, 2010 6:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[uchar]]></name></author>
		<updated>2010-01-20T18:13:49+02:00</updated>

		<published>2010-01-20T18:13:49+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=3748&amp;p=12930#p12930</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=12930#p12930"/>
		<title type="html"><![CDATA[Re: How to output data to e.g. HID device]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=3748&amp;p=12930#p12930"><![CDATA[
Yes, I saw this define and have installed it, but it has not helped <img class="smilies" src="./../../../images/smilies/icon_sad.gif" alt=":(" title="Sad" /> <br /><br />Also I have changed a report-descriptor :<br /><br /><div class="codebox"><p>Code: </p><pre><code>PROGMEM char usbHidReportDescriptor&#91;23&#93; = {    /* USB report descriptor */<br />    0x06, 0x00, 0xff,              // USAGE_PAGE (Generic Desktop)<br />    0x09, 0x01,                    // USAGE (Vendor Usage 1)<br />    0xa1, 0x01,                    // COLLECTION (Application)<br />    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)<br />    0x26, 0xff, 0xff,              //   LOGICAL_MAXIMUM (512)  <br />    0x75, 0x08,                    //   REPORT_SIZE (8)<br />    0x96, 0xff, 0xff,                //   REPORT_COUNT (512)  <br />    0x09, 0x00,                    //   USAGE (Undefined)<br />    0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)<br />    0xc0                           // END_COLLECTION<br />};<br /></code></pre></div><br /><br /><br />Please, tell in what my error.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=3029">uchar</a> — Wed Jan 20, 2010 6:13 pm</p><hr />
]]></content>
	</entry>
	</feed>
