From 30de17a83029abeee44cbfd7aa5a3ac63d0ce65d Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 1 Aug 2019 13:20:00 +0700 Subject: clean up - remove TUD_WEBUSB_URL_DESCRIPTOR to avoid flexible array member (C++ forbid in strict mode) - remove unused TUD_DESC_STRLEN/TUD_DESC_STR_HEADER/TUD_DESC_STR_HEADER --- examples/device/cdc_msc_hid/src/usb_descriptors.c | 4 ++-- examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c | 4 ++-- examples/device/hid_generic_inout/src/usb_descriptors.c | 4 ++-- examples/device/midi_test/src/usb_descriptors.c | 4 ++-- examples/device/msc_dual_lun/src/usb_descriptors.c | 4 ++-- examples/device/webusb_serial/src/usb_descriptors.c | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'examples/device') diff --git a/examples/device/cdc_msc_hid/src/usb_descriptors.c b/examples/device/cdc_msc_hid/src/usb_descriptors.c index ee79f4ece..34f391dfb 100644 --- a/examples/device/cdc_msc_hid/src/usb_descriptors.c +++ b/examples/device/cdc_msc_hid/src/usb_descriptors.c @@ -209,8 +209,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index) } } - // first byte is len, second byte is string type - _desc_str[0] = TUD_DESC_STR_HEADER(chr_count); + // first byte is length (including header), second byte is string type + _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2); return _desc_str; } diff --git a/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c b/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c index 699067f73..5d93cc2f6 100644 --- a/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c +++ b/examples/device/cdc_msc_hid_freertos/src/usb_descriptors.c @@ -210,8 +210,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index) } } - // first byte is len, second byte is string type - _desc_str[0] = TUD_DESC_STR_HEADER(chr_count); + // first byte is length (including header), second byte is string type + _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2); return _desc_str; } diff --git a/examples/device/hid_generic_inout/src/usb_descriptors.c b/examples/device/hid_generic_inout/src/usb_descriptors.c index 7578a8b7f..c9493c4e6 100644 --- a/examples/device/hid_generic_inout/src/usb_descriptors.c +++ b/examples/device/hid_generic_inout/src/usb_descriptors.c @@ -162,8 +162,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index) } } - // first byte is len, second byte is string type - _desc_str[0] = TUD_DESC_STR_HEADER(chr_count); + // first byte is length (including header), second byte is string type + _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2); return _desc_str; } diff --git a/examples/device/midi_test/src/usb_descriptors.c b/examples/device/midi_test/src/usb_descriptors.c index 95d3cca25..7cebc6a15 100644 --- a/examples/device/midi_test/src/usb_descriptors.c +++ b/examples/device/midi_test/src/usb_descriptors.c @@ -149,8 +149,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index) } } - // first byte is len, second byte is string type - _desc_str[0] = TUD_DESC_STR_HEADER(chr_count); + // first byte is length (including header), second byte is string type + _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2); return _desc_str; } diff --git a/examples/device/msc_dual_lun/src/usb_descriptors.c b/examples/device/msc_dual_lun/src/usb_descriptors.c index 6064d8d7b..cab37cf1f 100644 --- a/examples/device/msc_dual_lun/src/usb_descriptors.c +++ b/examples/device/msc_dual_lun/src/usb_descriptors.c @@ -147,8 +147,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index) } } - // first byte is len, second byte is string type - _desc_str[0] = TUD_DESC_STR_HEADER(chr_count); + // first byte is length (including header), second byte is string type + _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2); return _desc_str; } diff --git a/examples/device/webusb_serial/src/usb_descriptors.c b/examples/device/webusb_serial/src/usb_descriptors.c index a61c62c93..a1d5cd9b9 100644 --- a/examples/device/webusb_serial/src/usb_descriptors.c +++ b/examples/device/webusb_serial/src/usb_descriptors.c @@ -230,8 +230,8 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index) } } - // first byte is len, second byte is string type - _desc_str[0] = TUD_DESC_STR_HEADER(chr_count); + // first byte is length (including header), second byte is string type + _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2); return _desc_str; } -- cgit v1.3.1