esp32-s2_dfu/examples/device/cdc_msc_hid/src/tusb_descriptors.c

87 lines
2.7 KiB
C
Raw Normal View History

/*
* The MIT License (MIT)
*
* Copyright (c) 2018, hathach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* This file is part of the TinyUSB stack.
*/
2018-07-01 10:45:04 +02:00
#include "tusb.h"
//--------------------------------------------------------------------+
// STRING DESCRIPTORS
//--------------------------------------------------------------------+
// array of pointer to string descriptors
uint16_t const * const string_desc_arr [] =
{
2018-07-12 17:11:37 +02:00
// 0: is supported language = English
TUD_DESC_STRCONV(0x0409),
2018-07-12 17:11:37 +02:00
// 1: Manufacturer
TUD_DESC_STRCONV('t', 'i', 'n', 'y', 'u', 's', 'b', '.', 'o', 'r', 'g'),
2018-07-12 17:11:37 +02:00
// 2: Product
TUD_DESC_STRCONV('t', 'i', 'n', 'y', 'u', 's', 'b', ' ', 'd', 'e', 'v', 'i', 'c', 'e'),
2018-07-12 17:11:37 +02:00
// 3: Serials TODO use chip ID
TUD_DESC_STRCONV('1', '2', '3', '4', '5', '6'),
2018-07-23 10:25:45 +02:00
#if CFG_TUD_CDC
2018-07-12 17:11:37 +02:00
// 4: CDC Interface
TUD_DESC_STRCONV('t','u','s','b',' ','c','d','c'),
2018-07-23 10:25:45 +02:00
#endif
2018-07-23 10:25:45 +02:00
#if CFG_TUD_MSC
2018-07-12 17:11:37 +02:00
// 5: MSC Interface
TUD_DESC_STRCONV('t','u','s','b',' ','m','s','c'),
2018-07-23 10:25:45 +02:00
#endif
2018-07-23 11:00:07 +02:00
#if CFG_TUD_HID_KEYBOARD
// 6: Keyboard
TUD_DESC_STRCONV('t','u','s','b',' ','k','e','y','b','o','a','r','d'),
#endif
#if CFG_TUD_HID_MOUSE
// 7: Mouse
TUD_DESC_STRCONV('t','u','s','b',' ','m', 'o','u','s','e'),
#endif
};
// tud_desc_set is required by tinyusb stack
// since CFG_TUD_DESC_AUTO is enabled, we only need to set string_arr
tud_desc_set_t tud_desc_set =
{
.device = NULL,
.config = NULL,
.string_arr = (uint8_t const **) string_desc_arr,
.string_count = sizeof(string_desc_arr)/sizeof(string_desc_arr[0]),
2018-07-23 10:25:45 +02:00
.hid_report =
{
.generic = NULL,
2018-07-23 10:25:45 +02:00
.boot_keyboard = NULL,
.boot_mouse = NULL
}
};