This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Mistake found in RTL version of "usbcore.c" in USB_ReqGetDescriptor()

Hello!
I have recently decided to try a newer version of USB for RTL and detected a mistake in file "usbcore.c":

__inline BOOL USB_ReqGetDescriptor (void) {
  U8  *pD;
  U32 len, n;

  switch (SetupPacket.bmRequestType.BM.Recipient) {
    case REQUEST_TO_DEVICE:
      switch (SetupPacket.wValue.WB.H) {

          ...

        case USB_STRING_DESCRIPTOR_TYPE:
          pD = (U8 *)USB_StringDescriptor;
          for (n = 0; n != SetupPacket.wValue.WB.L; n++) {
            if (((USB_STRING_DESCRIPTOR *)pD)->bLength != 0) {
              pD += ((USB_STRING_DESCRIPTOR *)pD)->bLength;
            }
          }
          if (((USB_STRING_DESCRIPTOR *)pD)->bLength == 0) {
            return (__FALSE);
          }
          EP0Data.pData = pD;
          len = ((USB_STRING_DESCRIPTOR *)pD)->bLength;
         break;

         ...

      }
      break;

      ...
}

Selected code part which is responsible for sending the string descriptor to the host, doesn't work correctly. In previous versions of USB sources, al least in version V1.10 of USB Core Module it worked well and it looked like this:

        case USB_STRING_DESCRIPTOR_TYPE:
          EP0Data.pData = (U8 *)USB_StringDescriptor + SetupPacket.wValue.WB.L;
          len = ((USB_STRING_DESCRIPTOR *)EP0Data.pData)->bLength;
          break;

Please correct the issue if I am right, or explain the situation if not.
Thanks in advance.

Parents Reply Children
No data