From cfc5f868621b6a550b3366efbb53b0352e1cf20e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 25 Apr 2018 10:13:59 -0600 Subject: [PATCH] net/udp: Minor update from review of 091e3f732e08dfd54359371150185cecbc1ca0e9. In connect(), AF_UNSPEC is used to disconnect UDP socket. However, initial commit lacked logic to mark the socket as disconnected. --- configs/stm32f4discovery/README.txt | 18 ++++++++++++++++++ net/inet/inet_sockif.c | 8 ++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/configs/stm32f4discovery/README.txt b/configs/stm32f4discovery/README.txt index 34de5faca44..536c9c74a6d 100644 --- a/configs/stm32f4discovery/README.txt +++ b/configs/stm32f4discovery/README.txt @@ -627,6 +627,18 @@ BT860 configure a new U[S]ART and/or modify the pin selections in include/board.h. +CC2564 +------ + + [To be provided] + + One confusing thing compared with the BT860 is in the naming of the pins + at the 4-pin RS232 TTL interface: The BT860 uses BT860-centric naming, + the Rx pin is for BT860 receive and needs to connect with the STM32 Tx + pin, the Tx pin is for BT860 transmit an needs to be connected with the + STM32 Rx pin, etc. The CC2564, on the hand, uses host-centric naming so + that the CC2564 Rx pin connects to the STM32 Rx pin, Tx to Tx pin, etc. + Troubleshooting --------------- @@ -1331,6 +1343,12 @@ Configuration Sub-directories pin 5 Module_TX_O USART3_RX PB11, P1 pin 35 pin 6 Module_CTS_I USART3_RTS PB14, P1 pin 38 + NOTICE that the BT860 uses BT860-centric naming, the Rx pin is for + BT860 receive and needs to connect with the STM32 Tx pin, the Tx pin + is for BT860 transmit an needs to be connected with the STM32 Rx pin, + etc. Other parts may use host-centric naming so that the HCI UART Rx + pin connects to the STM32 Rx pin, Tx to Tx pin, etc. + 3. Due to conflicts, USART3 many not be used if Ethernet is enabled with the STM32F4DIS-BB base board: diff --git a/net/inet/inet_sockif.c b/net/inet/inet_sockif.c index b2479d62749..4409680fd9d 100644 --- a/net/inet/inet_sockif.c +++ b/net/inet/inet_sockif.c @@ -707,15 +707,19 @@ static int inet_connect(FAR struct socket *psock, addr = NULL; } - /* Peform the connect/disconnect operation */ + /* Perform the connect/disconnect operation */ ret = udp_connect(psock->s_conn, addr); - if (ret < 0) + if (ret < 0 || addr == NULL) { + /* Failed to connect or explicitly disconnected */ + psock->s_flags &= ~_SF_CONNECTED; } else { + /* Successfully connected */ + psock->s_flags |= _SF_CONNECTED; }