Hello,
thanks for your reply. I tried it with a pointer to a pointer which points to g_languages. It change the reset behavior but the strings and language id specifier dont work.
Kernel Log:
[ 5755.340863] usb 1-1.4: new full-speed USB device number 57 using ehci-pci
[ 5755.452991] usb 1-1.4: language id specifier not provided by device, defaulting to English
[ 5755.454724] usb 1-1.4: New USB device found, idVendor=22b5, idProduct=0850, bcdDevice= 0.02
[ 5755.454727] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 5755.455642] hid-generic 0003:22B5:0850.0006: hiddev1,hidraw3: USB HID v1.00 Device [HID 22b5:0850] on usb-0000:00:1a.0-1.4/input0
Sourcecode:
#define USB_STRING_DESCRIPTOR 0x03
const uint8_t USB_STR_0[4] = {0x02,0x03,0x09,0x04}; /* RM 14.4.5.2 */
__attribute__((section(".usb_str"))) usb_strings_t usb_str = {
//Länge, +utf16 string
.vendor = { 18,USB_STRING_DESCRIPTOR,'T',0,'Y',0,'R',0,'A',0,'C',0,'O',0,'N',0,'T',0 },
.product_description = { 12,USB_STRING_DESCRIPTOR,'V',0,'D',0,'8',0,'5',0,'0',0},
.serial_nr = { 18,USB_STRING_DESCRIPTOR,'1',0,'2',0,'3',0,'4',0,'5',0,'6',0,'7',0,'8',0 },
.str_size = {sizeof(USB_STR_0),18,12,18},
};
__attribute__ ((section(".after_vectors.reset")))
const uint8_t * const g_string_descriptors[4] =
{
USB_STR_0,
usb_str.vendor,
usb_str.product_description,
usb_str.serial_nr,
};
__attribute__ ((section(".after_vectors.reset")))
const uint8_t * const g_strPtr = (uint8_t *)&g_string_descriptors;
__attribute__ ((section(".after_vectors.reset")))
const Languages_desc_t g_languages =
{
.STR0_ptr = USB_STR_0,
.Size = sizeof(USB_STR_0),
.Num = (uint16_t) 0x0409,
.StringDescriptors = &g_strPtr,
.Sizes = usb_str.str_size,
};
__attribute__ ((section(".after_vectors.reset")))
const uint8_t * const g_langPtr = (uint8_t *)&g_languages;
__attribute__((section(".cfg_section"))) volatile const bootloader_config_t bcfg = {
.tag = 0x6766636B, //!< Magic Number
.crcStartAddress = 0xFFFFFFFF, //!< Disable CRC check
.crcByteCount = 0xFFFFFFFF, //!< Disable CRC check
.crcExpectedValue = 0xFFFFFFFF, //!< Disable CRC check
.enabledPeripherals = ENABLE_PERIPHERAL_USB_HID,
.i2cSlaveAddress = 0x10, //!< Use default I2C address(0x10)
.peripheralDetectionTimeoutMs = 10000, //!< Use user-defined timeout(ms)
.usbVid = 0x22B5, //!< Use default Vendor ID(0x15A2)
.usbPid = 0x0850, //!< Use default Product ID(0x0073)
.usbStringsPointer = &g_langPtr,
.clockFlags = 0xFE, //!< 0 bit cleared: Enable High speed mode. NOTE: Enabling high speed mode makes UART connection worse, requires pull-up on UART RX line!
.clockDivider = 0xff, //!< Use clock divider(0)
.mmcauPtr = 0x410,
.FOPTConfig = {0x45FFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF3DFE},
};