Is this a bug in the new LPCUSBLib?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is this a bug in the new LPCUSBLib?

1,191 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mifi on Tue May 14 14:15:39 MST 2013

Hello,

I am using the latest LPCopen, v1.03. And I think I found a bug
in the examples where the descriptors will be set.

E.g. take a look in the Descriptors.c of the "KeyboardDevice".

For the ConfigurationDescriptor, TotalConfigurationSize, 1 will be
subtracted because of the termination byte.

But this is missing in the CALLBACK, here the code looks like:

    case DTYPE_Configuration:
        Address = &ConfigurationDescriptor;
        Size    = sizeof(USB_Descriptor_Configuration_t);
        break;

I think the code should be changed to:

    case DTYPE_Device:
        Address = &DeviceDescriptor;
        Size    = DeviceDescriptor.Header.Size;
        break;

    case DTYPE_Configuration:
        Address = &ConfigurationDescriptor;
        Size    = ConfigurationDescriptor.Config.TotalConfigurationSize;
        break;

Best regards,
Michael

Labels (1)
0 Kudos
Reply
4 Replies

1,163 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wellsk on Fri Jun 07 08:54:00 MST 2013

I've added a bug tracker issue for this at http://www.lpcware.com/content/bugtrackerissue/lpcusblib-descriptor-size-bug

0 Kudos
Reply

1,163 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxpUSBlib team on Wed May 15 03:30:56 MST 2013

Hello Micheal,


We agree with you, this is an issue! Our software will fail if host requests for device configuration with length equal to 0xFF, in this case, the block found by Vitah does not help!


Thank you, Micheal and Vitah! We will update the fix in next release!


 


With best regards,

0 Kudos
Reply

1,163 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mifi on Tue May 14 22:42:29 MST 2013

Hello vitah,

the Problem is that the size is wrong reported. Here
I have checked it with an USB analyzer, and the size
was marked as wrong.

Best regards,
Michael

0 Kudos
Reply

1,163 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vitah on Tue May 14 21:31:47 MST 2013

Hello Michael,


I thought like you too, but after digged into source code. I found that USBLIB will not always send descriptor data with the size specified in "Size" variable. Inside function Endpoint_Write_Control_Stream_LE, USBLIB will check for minimum number of Descriptor Struct size and requested length from host. So that I guess, in this case, the terminal byte will not be sent b/c host only requests size = TotalConfigurationSize.


Endpoint_Stream.c


...


uint8_t Endpoint_Write_Control_Stream_LE(uint8_t corenum, const void *const Buffer,
                                         uint16_t Length)
{
    Endpoint_Write_Stream_LE(corenum, (uint8_t *) Buffer, MIN(Length, USB_ControlRequest.wLength), NULL);
    Endpoint_ClearIN(corenum);


...

0 Kudos
Reply