[ bug ] descriptor of size 255 limit?

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
ulao
Rank 4
Rank 4
Posts: 481
Joined: Mon Aug 25, 2008 8:45 pm

[ bug ] descriptor of size 255 limit?

Post by ulao » Wed Mar 24, 2010 5:17 am

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 ?
Last edited by ulao on Tue Apr 20, 2010 4:19 am, edited 3 times in total.

ulao
Rank 4
Rank 4
Posts: 481
Joined: Mon Aug 25, 2008 8:45 pm

Re: descriptor application collection too big?

Post by ulao » Thu Mar 25, 2010 6:01 pm

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

ulao
Rank 4
Rank 4
Posts: 481
Joined: Mon Aug 25, 2008 8:45 pm

Re: descriptor application collection too big?

Post by ulao » Wed Apr 14, 2010 10:02 pm

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.

ulao
Rank 4
Rank 4
Posts: 481
Joined: Mon Aug 25, 2008 8:45 pm

Re: descriptor of size 255 limit?

Post by ulao » Mon Apr 19, 2010 11:58 pm

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.

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Re: [ bug ] descriptor of size 255 limit?

Post by christian » Mon Aug 30, 2010 2:49 pm

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.

Post Reply