Page 1 of 1

[ bug ] descriptor of size 255 limit?

Posted: Wed Mar 24, 2010 5:17 am
by ulao
I have a descriptor that needs a lot of info to make the physical layer work. Most examples show 10 pages of stuff. All of this info goes under the usage application collection. I get about 200 lines worth before I run in to trouble. Is this a limit of the atmega168 ( still have room on the chip ), the v-usb, or something I dont understand?

I get my size with sizeof like this.

Code: Select all

int getGenericUsbHidReportDescriptor_size(void)
{
   return sizeof(generic_usbHidReportDescriptor);
}

So I know that is not the issue. Commenting a few lines out allow the device to enumerate. un-commenting them will cause a failure. It does not matter what section I comment out. There must be a limitation somewhere ?

Seems to be wDescriptorLength greater then 2 00FBh (251) bytes where I get issues.guessing 255 ?

Re: descriptor application collection too big?

Posted: Thu Mar 25, 2010 6:01 pm
by ulao
I got a reply on usb-if, can anyone answer this, or point me to where I might find the answers.

What about the code that sequences the descriptor out of your firmware to the host? Does that have a byte-sized counter for keeping track of "remaining bytes"?

Re: descriptor application collection too big?

Posted: Wed Apr 14, 2010 10:02 pm
by ulao
ok I think I get the problem but cant make it work.

This is what I do normally.

my_usbDescriptorConfiguration[25] = rt_usbHidReportDescriptorSize;

and now I do this..

my_usbDescriptorConfiguration[25] = rt_usbHidReportDescriptorSize - 0xff;
my_usbDescriptorConfiguration[26] = 0x01;

I also set #define USB_CFG_LONG_TRANSFERS 1 Figuring that would be needed as well. I verified the descriptor is good. Still not getting a enumeration. Anything else need to be changed to allow a desc > ff ?

when I watch the enumeration the transfer buffer length on the hid desc is 0x003c yet I told it 0x013c, I traced down to usbFunctionDescriptor, and it seems to be return a char, even though its set to return an int.

Re: descriptor of size 255 limit?

Posted: Mon Apr 19, 2010 11:58 pm
by ulao
Ok I did a lot of tracing and found the break down in here

static inline void usbProcessRx(uchar *data, uchar len)

when it calls for usbDriverSetup it returns a 8 bit car value.

notice the end..

Code: Select all

    return len;
}

and the beginning

Code: Select all

static inline usbMsgLen_t usbDriverSetup(usbRequest_t *rq)
{
uchar   len  = 0, *dataPtr = usbTxBuf + 9;  /* there are 2 bytes free space at the end of the buffer */


So I set it to

Code: Select all

static inline usbMsgLen_t usbDriverSetup(usbRequest_t *rq)
{
usbMsgLen_t   len  = 0;
char *dataPtr = usbTxBuf + 9;  /* there are 2 bytes free space at the end of the buffer */


Am I wrong? -- either way its working now, so my guess is this 'WAS' a bug.

Re: [ bug ] descriptor of size 255 limit?

Posted: Mon Aug 30, 2010 2:49 pm
by christian
Thanks for pointing this out! Yes, it IS a bug. Please report such bugs via http://www.obdev.at/vusb/feedback.html, since we don't read the forums regularly.