drivers/usbdev/gadget/composite_desc.c
int composite_mkstrdesc(struct composite_dev_s *priv, uint8_t id, uint16_t index, uint8_t *buf)
{
  int len = -1;
  int i;
  int ret;

  if (index == 0 && id == OS_STRING_ID)
    {
      ret = memcpy_s(buf, USB_COMP_EP0_BUFSIZ, (void *)g_os_string, g_os_string[0]);
      if (ret != EOK)
        {
          return -1;
        }
      return g_os_string[0];
    }

  for (i = 0; i < priv->ndevices; i++)
    {
      len = priv->device[i].compdesc.mkstrdesc(id, buf);
    }

  return len;
}
/****************************************************************************
 * Name: composite_mkstrdesc
 *
 * Description:
 *   Construct a string descriptor
 *
 ****************************************************************************/
composite_mkstrdesc
Description:
Construct a string descriptor
composite_mkstrdesc Description : Construct a string descriptor
int composite_mkstrdesc(struct composite_dev_s *priv, uint8_t id, uint16_t index, uint8_t *buf)
{
  int len = -1;
  int i;
  int ret;
  if (index == 0 && id == OS_STRING_ID)
    {
      ret = memcpy_s(buf, USB_COMP_EP0_BUFSIZ, (void *)g_os_string, g_os_string[0]);
      if (ret != EOK)
        {
          return -1;
        }
      return g_os_string[0];
    }
  for (i = 0; i < priv->ndevices; i++)
    {
      len = priv->device[i].compdesc.mkstrdesc(id, buf);
    }
  return len;
}
int composite_mkstrdesc ( struct composite_dev_s * priv , uint8_t id , uint16_t index , uint8_t * buf ) { int len = -1 ; int i ; int ret ; if ( index == 0 && id == OS_STRING_ID ) { ret = memcpy_s ( buf , USB_COMP_EP0_BUFSIZ , ( void * ) g_os_string , g_os_string [ 0 ] ) ; if ( ret != EOK ) { return -1 ; } return g_os_string [ 0 ] ; } for ( i = 0 ; i < priv -> ndevices ; i ++ ) { len = priv -> device [ i ] . compdesc . mkstrdesc ( id , buf ) ; } return len ; }
Name: composite_mkstrdesc
 Description:
   Construct a string descriptor
Name : composite_mkstrdesc Description : Construct a string descriptor