Start MSC device example lacks string descriptors

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Adding them back in is not hard, but tracking it down was a bit annoying.

 

First, in Config/usbd_msc_config.h, change CONF_USB_MSC_IMANUFACT to 1, and CONF_USB_MSC_IPRODUCT to 2.

 

Next, in usb/class/msc/device/mscdf_desc.h change this:

 

 

/** USB Device descriptors and configuration descriptors */

#define MSC_DESCES_LS_FS MSC_DEV_DESC, MSC_CFG_DESC, MSC_IFACE_DESCES, CONF_MSC_LANGUAGE_ID_STR_DESC, CONF_MSC_MANUFACTOR_STR_DESC, CONF_MSC_PRODUCT_STR_DESC

 

You're adding the string descriptors for language (required), manufacturer and product to the descriptor bundle. The default manufacturer is "Atmel HID" and the default product is "Mouse". You change that to whatever you like by redoing the definitions of the STR_DESC #defines in usbd_msc_config. The first byte is the overall length (so (strlen + 1)*2), the 3rd byte is "3" which means it's a string descriptor, then the UTF-16 characters of the string in LE (so an ASCII code followed by a zero if you don't want to get fancy).