You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/04/30 14:04:20 UTC

[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2279: [RFC] TinyUSB integration

apache-mynewt-bot commented on pull request #2279:
URL: https://github.com/apache/mynewt-core/pull/2279#issuecomment-621873550


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### hw/usb/tinyusb/cdc_console/src/cdc_console.c
   <details>
   
   ```diff
   @@ -41,8 +41,9 @@
        written = tud_cdc_write_char(c);
        if (tud_cdc_write_available() == 0) {
            tud_cdc_write_flush();
   -        if (written == 0)
   +        if (written == 0) {
                tud_cdc_write_char(c);
   +        }
        }
    }
    
   ```
   
   </details>
   
   #### hw/usb/tinyusb/std_descriptors/include/tusb_config.h
   <details>
   
   ```diff
   @@ -37,7 +37,7 @@
    
    #include <tusb_hw.h>
    
   -// defined by compiler flags for flexibility
   +/* defined by compiler flags for flexibility */
    #ifndef CFG_TUSB_MCU
    #error CFG_TUSB_MCU must be defined
    #endif
   ```
   
   </details>
   
   #### hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
   <details>
   
   ```diff
   @@ -48,10 +48,10 @@
    #if MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD) || MYNEWT_VAL(USBD_HID_REPORT_ID_MOUSE)
    const uint8_t desc_hid_report[] = {
    #if MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD)
   -    TUD_HID_REPORT_DESC_KEYBOARD( MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD), ),
   +    TUD_HID_REPORT_DESC_KEYBOARD(MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD), ),
    #endif
    #if MYNEWT_VAL(USBD_HID_REPORT_ID_MOUSE)
   -    TUD_HID_REPORT_DESC_MOUSE   ( HID_REPORT_ID(REPORT_ID_MOUSE), )
   +    TUD_HID_REPORT_DESC_MOUSE   (HID_REPORT_ID(REPORT_ID_MOUSE), )
    #endif
    };
    #else
   @@ -108,33 +108,33 @@
    #endif /* CFG_TUD_HID */
    
    const tusb_desc_device_t desc_device = {
   -    .bLength            = sizeof(tusb_desc_device_t),
   -    .bDescriptorType    = TUSB_DESC_DEVICE,
   -    .bcdUSB             = 0x0200,
   +    .bLength = sizeof(tusb_desc_device_t),
   +    .bDescriptorType = TUSB_DESC_DEVICE,
   +    .bcdUSB = 0x0200,
    
    #if CFG_TUD_CDC
        /*
         * Use Interface Association Descriptor (IAD) for CDC
         * As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
         */
   -    .bDeviceClass       = TUSB_CLASS_MISC,
   -    .bDeviceSubClass    = MISC_SUBCLASS_COMMON,
   -    .bDeviceProtocol    = MISC_PROTOCOL_IAD,
   +    .bDeviceClass = TUSB_CLASS_MISC,
   +    .bDeviceSubClass = MISC_SUBCLASS_COMMON,
   +    .bDeviceProtocol = MISC_PROTOCOL_IAD,
    #else
   -    .bDeviceClass       = 0x00,
   -    .bDeviceSubClass    = 0x00,
   -    .bDeviceProtocol    = 0x00,
   -#endif
   -
   -    .bMaxPacketSize0    = CFG_TUD_ENDPOINT0_SIZE,
   -
   -    .idVendor           = MYNEWT_VAL(USBD_VID),
   -    .idProduct          = MYNEWT_VAL(USBD_PID),
   -    .bcdDevice          = USBD_PRODUCT_RELEASE_NUMBER,
   -
   -    .iManufacturer      = 0x02,
   -    .iProduct           = 0x03,
   -    .iSerialNumber      = 0x01,
   +    .bDeviceClass = 0x00,
   +    .bDeviceSubClass = 0x00,
   +    .bDeviceProtocol = 0x00,
   +#endif
   +
   +    .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
   +
   +    .idVendor = MYNEWT_VAL(USBD_VID),
   +    .idProduct = MYNEWT_VAL(USBD_PID),
   +    .bcdDevice = USBD_PRODUCT_RELEASE_NUMBER,
   +
   +    .iManufacturer = 0x02,
   +    .iProduct = 0x03,
   +    .iSerialNumber = 0x01,
    
        .bNumConfigurations = 0x01
    };
   @@ -146,12 +146,14 @@
    const uint8_t *
    tud_descriptor_device_cb(void)
    {
   -  return (const uint8_t *)&desc_device;
   -}
   -
   -//--------------------------------------------------------------------+
   -// Configuration Descriptor
   -//--------------------------------------------------------------------+
   +    return (const uint8_t *)&desc_device;
   +}
   +
   +/*
   +   --------------------------------------------------------------------+
   +   Configuration Descriptor
   +   --------------------------------------------------------------------+
   + */
    
    enum {
    #if CFG_TUD_CDC
   @@ -209,8 +211,7 @@
        return desc_configuration;
    }
    
   -const char *string_desc_arr[] =
   -{
   +const char *string_desc_arr[] = {
        MYNEWT_VAL(USBD_VENDOR_STRING),
        MYNEWT_VAL(USBD_PRODUCT_STRING),
        MYNEWT_VAL(USBD_CDC_DECRIPTOR_STRING),
   @@ -224,7 +225,8 @@
     * Invoked when received GET STRING DESCRIPTOR request
     * Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
     */
   -const uint16_t *tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   +const uint16_t *
   +tud_descriptor_string_cb(uint8_t index, uint16_t langid)
    {
        int char_num = 0;
        int i;
   ```
   
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org