drivers/usbdev/gadget/f_acm_desc.c
int cdcacm_mkstrdesc(uint8_t id, uint8_t *buf)
{
  errno_t ret;
  const char *str;
  int i;

  for (i = 0; g_cdcacm_device_strings[i].s != NULL; i++)
    {
      str = g_cdcacm_device_strings[i].s;
      if (g_cdcacm_device_strings[i].id == id)
        {
          ret = memcpy_s(buf, USB_COMP_EP0_BUFSIZ, (const void *)str, (uint32_t)str[0]);
          if (ret != EOK)
            {
              usb_err("memcpy_s failed, ret = %d\n", ret);
              return -1;
            }
          return str[0];
        }
    }

  usb_err("Can not find the id = %u of string\n", id);
  return -1;
}
/****************************************************************************
 * Name: cdcacm_mkstrdesc
 *
 * Description:
 *   Construct a string descriptor
 *
 ****************************************************************************/
cdcacm_mkstrdesc
Description:
Construct a string descriptor
cdcacm_mkstrdesc Description : Construct a string descriptor
int cdcacm_mkstrdesc(uint8_t id, uint8_t *buf)
{
  errno_t ret;
  const char *str;
  int i;
  for (i = 0; g_cdcacm_device_strings[i].s != NULL; i++)
    {
      str = g_cdcacm_device_strings[i].s;
      if (g_cdcacm_device_strings[i].id == id)
        {
          ret = memcpy_s(buf, USB_COMP_EP0_BUFSIZ, (const void *)str, (uint32_t)str[0]);
          if (ret != EOK)
            {
              usb_err("memcpy_s failed, ret = %d\n", ret);
              return -1;
            }
          return str[0];
        }
    }
  usb_err("Can not find the id = %u of string\n", id);
  return -1;
}
int cdcacm_mkstrdesc ( uint8_t id , uint8_t * buf ) { errno_t ret ; const char * str ; int i ; for ( i = 0 ; g_cdcacm_device_strings [ i ] . s != NULL ; i ++ ) { str = g_cdcacm_device_strings [ i ] . s ; if ( g_cdcacm_device_strings [ i ] . id == id ) { ret = memcpy_s ( buf , USB_COMP_EP0_BUFSIZ , ( const void * ) str , ( uint32_t ) str [ 0 ] ) ; if ( ret != EOK ) { usb_err ( " \n " , ret ) ; return -1 ; } return str [ 0 ] ; } } usb_err ( " \n " , id ) ; return -1 ; }
Name: cdcacm_mkstrdesc
 Description:
   Construct a string descriptor
Name : cdcacm_mkstrdesc Description : Construct a string descriptor