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/10/29 20:27:13 UTC

[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #878: Add support for NuttX

apache-mynewt-bot removed a comment on pull request #878:
URL: https://github.com/apache/mynewt-nimble/pull/878#issuecomment-716242792


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### nimble/transport/socket/src/ble_hci_socket.c
   <details>
   
   ```diff
   @@ -54,17 +54,17 @@
    #if 0/*MYNEWT_VAL(BLE_SOCK_USE_LINUX_BLUE)*/
    #include <sys/errno.h>
    #define BTPROTO_HCI 1
   -#define HCI_CHANNEL_RAW		0
   -#define HCI_CHANNEL_USER	1
   -#define HCIDEVUP	_IOW('H', 201, int)
   -#define HCIDEVDOWN	_IOW('H', 202, int)
   -#define HCIDEVRESET	_IOW('H', 203, int)
   -#define HCIGETDEVLIST	_IOR('H', 210, int)
   +#define HCI_CHANNEL_RAW     0
   +#define HCI_CHANNEL_USER    1
   +#define HCIDEVUP    _IOW('H', 201, int)
   +#define HCIDEVDOWN  _IOW('H', 202, int)
   +#define HCIDEVRESET _IOW('H', 203, int)
   +#define HCIGETDEVLIST   _IOR('H', 210, int)
    
    struct sockaddr_hci {
   -        sa_family_t    hci_family;
   -        unsigned short hci_dev;
   -        unsigned short hci_channel;
   +    sa_family_t hci_family;
   +    unsigned short hci_dev;
   +    unsigned short hci_channel;
    };
    #endif
    
   @@ -276,54 +276,54 @@
        }
        return 0;
    #else
   -  size_t len;
   -  uint8_t* buf;
   -  int i;
   -  struct os_mbuf *m;
   -  struct sockaddr_hci addr;
   -
   -  addr.hci_family = AF_BLUETOOTH;
   -  addr.hci_channel = HCI_CHANNEL_RAW;
   -  addr.hci_dev = 0;
   -
   -  memcpy(&addr, &addr, sizeof(struct sockaddr_hci));
   -
   -  len = 1;
   -
   -  for (m = om; m; m = SLIST_NEXT(m, om_next)) {
   -      len += m->om_len;
   -  }
   -
   -  buf = (uint8_t*)malloc(len);
   -
   -  buf[0] = BLE_HCI_UART_H4_ACL;
   -
   -  i = 1;
   -  for (m = om; m; m = SLIST_NEXT(m, om_next)) {
   -      memcpy(&buf[i], m->om_data, m->om_len);
   -      i += m->om_len;
   -  }
   -
   -  STATS_INC(hci_sock_stats, omsg);
   -  STATS_INC(hci_sock_stats, oacl);
   -  STATS_INCN(hci_sock_stats, obytes, OS_MBUF_PKTLEN(om) + 1);
   -
   -  i = sendto(ble_hci_sock_state.sock, buf, len, 0,
   -             (struct sockaddr *)&addr, sizeof(struct sockaddr_hci));
   -
   -  free(buf);
   -
   -  os_mbuf_free_chain(om);
   -  if (i != OS_MBUF_PKTLEN(om) + 1) {
   -      if (i < 0) {
   -          dprintf(1, "sendto() failed : %d\n", errno);
   -      } else {
   -          dprintf(1, "sendto() partial write: %d\n", i);
   -      }
   -      STATS_INC(hci_sock_stats, oerr);
   -      return BLE_ERR_MEM_CAPACITY;
   -  }
   -  return 0;
   +    size_t len;
   +    uint8_t * buf;
   +    int i;
   +    struct os_mbuf *m;
   +    struct sockaddr_hci addr;
   +
   +    addr.hci_family = AF_BLUETOOTH;
   +    addr.hci_channel = HCI_CHANNEL_RAW;
   +    addr.hci_dev = 0;
   +
   +    memcpy(&addr, &addr, sizeof(struct sockaddr_hci));
   +
   +    len = 1;
   +
   +    for (m = om; m; m = SLIST_NEXT(m, om_next)) {
   +        len += m->om_len;
   +    }
   +
   +    buf = (uint8_t *)malloc(len);
   +
   +    buf[0] = BLE_HCI_UART_H4_ACL;
   +
   +    i = 1;
   +    for (m = om; m; m = SLIST_NEXT(m, om_next)) {
   +        memcpy(&buf[i], m->om_data, m->om_len);
   +        i += m->om_len;
   +    }
   +
   +    STATS_INC(hci_sock_stats, omsg);
   +    STATS_INC(hci_sock_stats, oacl);
   +    STATS_INCN(hci_sock_stats, obytes, OS_MBUF_PKTLEN(om) + 1);
   +
   +    i = sendto(ble_hci_sock_state.sock, buf, len, 0,
   +               (struct sockaddr *)&addr, sizeof(struct sockaddr_hci));
   +
   +    free(buf);
   +
   +    os_mbuf_free_chain(om);
   +    if (i != OS_MBUF_PKTLEN(om) + 1) {
   +        if (i < 0) {
   +            dprintf(1, "sendto() failed : %d\n", errno);
   +        } else {
   +            dprintf(1, "sendto() partial write: %d\n", i);
   +        }
   +        STATS_INC(hci_sock_stats, oerr);
   +        return BLE_ERR_MEM_CAPACITY;
   +    }
   +    return 0;
    #endif
    }
    
   @@ -341,7 +341,7 @@
        memset(&msg, 0, sizeof(msg));
        memset(iov, 0, sizeof(iov));
    
   -    msg.msg_name = (void*)btaddr;
   +    msg.msg_name = (void *)btaddr;
        msg.msg_namelen = 6;
    
        msg.msg_iov = iov;
   @@ -377,49 +377,49 @@
            return BLE_ERR_MEM_CAPACITY;
        }
    #else
   -  uint8_t* buf;
   -  size_t len;
   -  struct sockaddr_hci addr;
   -  int i;
   -
   -  addr.hci_family = AF_BLUETOOTH;
   -  addr.hci_channel = HCI_CHANNEL_RAW;
   -  addr.hci_dev = 0;
   -
   -  memcpy(&addr, &addr, sizeof(struct sockaddr_hci));
   -
   -  if (h4_type == BLE_HCI_UART_H4_CMD) {
   -      len = sizeof(struct ble_hci_cmd) + hci_ev[2];
   -      STATS_INC(hci_sock_stats, ocmd);
   -  } else if (h4_type == BLE_HCI_UART_H4_EVT) {
   -      len = sizeof(struct ble_hci_ev) + hci_ev[1];
   -      STATS_INC(hci_sock_stats, oevt);
   -  } else {
   -      assert(0);
   -  }
   -
   -  STATS_INC(hci_sock_stats, omsg);
   -  STATS_INCN(hci_sock_stats, obytes, len + 1);
   -
   -  buf = (uint8_t*)malloc(len + 1);
   -
   -  buf[0] = h4_type;
   -  memcpy(&buf[1], hci_ev, len);
   -
   -  i = sendto(ble_hci_sock_state.sock, buf, len + 1, 0,
   -             (struct sockaddr *)&addr, sizeof(struct sockaddr_hci));
   -
   -  free(buf);
   -  ble_hci_trans_buf_free(hci_ev);
   -  if (i != len + 1) {
   -      if (i < 0) {
   -          dprintf(1, "sendto() failed : %d\n", errno);
   -      } else {
   -          dprintf(1, "sendto() partial write: %d\n", i);
   -      }
   -      STATS_INC(hci_sock_stats, oerr);
   -      return BLE_ERR_MEM_CAPACITY;
   -  }
   +    uint8_t * buf;
   +    size_t len;
   +    struct sockaddr_hci addr;
   +    int i;
   +
   +    addr.hci_family = AF_BLUETOOTH;
   +    addr.hci_channel = HCI_CHANNEL_RAW;
   +    addr.hci_dev = 0;
   +
   +    memcpy(&addr, &addr, sizeof(struct sockaddr_hci));
   +
   +    if (h4_type == BLE_HCI_UART_H4_CMD) {
   +        len = sizeof(struct ble_hci_cmd) + hci_ev[2];
   +        STATS_INC(hci_sock_stats, ocmd);
   +    } else if (h4_type == BLE_HCI_UART_H4_EVT) {
   +        len = sizeof(struct ble_hci_ev) + hci_ev[1];
   +        STATS_INC(hci_sock_stats, oevt);
   +    } else {
   +        assert(0);
   +    }
   +
   +    STATS_INC(hci_sock_stats, omsg);
   +    STATS_INCN(hci_sock_stats, obytes, len + 1);
   +
   +    buf = (uint8_t *)malloc(len + 1);
   +
   +    buf[0] = h4_type;
   +    memcpy(&buf[1], hci_ev, len);
   +
   +    i = sendto(ble_hci_sock_state.sock, buf, len + 1, 0,
   +               (struct sockaddr *)&addr, sizeof(struct sockaddr_hci));
   +
   +    free(buf);
   +    ble_hci_trans_buf_free(hci_ev);
   +    if (i != len + 1) {
   +        if (i < 0) {
   +            dprintf(1, "sendto() failed : %d\n", errno);
   +        } else {
   +            dprintf(1, "sendto() partial write: %d\n", i);
   +        }
   +        STATS_INC(hci_sock_stats, oerr);
   +        return BLE_ERR_MEM_CAPACITY;
   +    }
    #endif
    
        return 0;
   @@ -441,7 +441,7 @@
        }
        len = read(bhss->sock, bhss->rx_data + bhss->rx_off,
                   sizeof(bhss->rx_data) - bhss->rx_off);
   -    //printf("off: %i read len: %i\n", bhss->rx_off, len);
   +    /*printf("off: %i read len: %i\n", bhss->rx_off, len); */
        if (len < 0) {
            return -2;
        }
   @@ -487,14 +487,14 @@
                }
                len = 1 + sizeof(struct ble_hci_ev) + bhss->rx_data[2];
                if (bhss->rx_off < len) {
   -                //printf("expected len %i, got only %i\n", len, bhss->rx_off);
   +                /*printf("expected len %i, got only %i\n", len, bhss->rx_off); */
                    return -1;
                }
                STATS_INC(hci_sock_stats, imsg);
                STATS_INC(hci_sock_stats, ievt);
                data = ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_EVT_HI);
                if (!data) {
   -                //printf("failed EVT\n");
   +                /*printf("failed EVT\n"); */
                    STATS_INC(hci_sock_stats, ierr);
                    break;
                }
   @@ -514,16 +514,16 @@
                    return -1;
                }
                len = 1 + BLE_HCI_DATA_HDR_SZ + (bhss->rx_data[4] << 8) +
   -              bhss->rx_data[3];
   +                  bhss->rx_data[3];
                if (bhss->rx_off < len) {
   -                //printf("expected len %i, got only %i\n", len, bhss->rx_off);
   +                /*printf("expected len %i, got only %i\n", len, bhss->rx_off); */
                    return -1;
                }
                STATS_INC(hci_sock_stats, imsg);
                STATS_INC(hci_sock_stats, iacl);
                m = ble_hci_trans_acl_buf_alloc();
                if (!m) {
   -                //printf("failed ACL\n");
   +                /*printf("failed ACL\n"); */
                    STATS_INC(hci_sock_stats, imem);
                    break;
                }
   ```
   
   </details>
   
   #### porting/nimble/include/log_common/log_common.h
   <details>
   
   ```diff
   @@ -43,12 +43,12 @@
    #define LOG_LEVEL_MAX      (15)
    
    #define LOG_LEVEL_STR(level) \
   -    (LOG_LEVEL_DEBUG    == level ? "DEBUG"    :\
   -    (LOG_LEVEL_INFO     == level ? "INFO"     :\
   -    (LOG_LEVEL_WARN     == level ? "WARN"     :\
   -    (LOG_LEVEL_ERROR    == level ? "ERROR"    :\
   -    (LOG_LEVEL_CRITICAL == level ? "CRITICAL" :\
   -     "UNKNOWN")))))
   +    (LOG_LEVEL_DEBUG == level ? "DEBUG"    : \
   +     (LOG_LEVEL_INFO == level ? "INFO"     : \
   +      (LOG_LEVEL_WARN == level ? "WARN"     : \
   +       (LOG_LEVEL_ERROR == level ? "ERROR"    : \
   +        (LOG_LEVEL_CRITICAL == level ? "CRITICAL" : \
   +         "UNKNOWN")))))
    
    /* XXX: These module IDs are defined for backwards compatibility.  Application
     * code should use the syscfg settings directly.  These defines will be removed
   @@ -131,8 +131,8 @@
    
    /** @typdef log_notify_rotate_cb
     * @brief Callback that is executed each time we are about to rotate a log.
   - * 
   - * @param log                   The log that is about to rotate 
   + *
   + * @param log                   The log that is about to rotate
     */
    typedef void log_notify_rotate_cb(const struct log *log);
    
   ```
   
   </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