diff options
Diffstat (limited to 'system/stack/rfcomm/port_api.cc')
-rw-r--r-- | system/stack/rfcomm/port_api.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/system/stack/rfcomm/port_api.cc b/system/stack/rfcomm/port_api.cc index 862b731624..f49129d197 100644 --- a/system/stack/rfcomm/port_api.cc +++ b/system/stack/rfcomm/port_api.cc @@ -711,11 +711,18 @@ int PORT_ReadData(uint16_t handle, char* p_data, uint16_t max_len, return (PORT_NOT_OPENED); } + if (p_port->state == PORT_STATE_OPENING) { + LOG_WARN("Trying to read a port in PORT_STATE_OPENING state"); + } + if (p_port->line_status) { return (PORT_LINE_ERR); } - if (fixed_queue_is_empty(p_port->rx.queue)) return (PORT_SUCCESS); + if (fixed_queue_is_empty(p_port->rx.queue)) { + LOG_WARN("Read on empty input queue"); + return (PORT_SUCCESS); + } count = 0; @@ -1024,6 +1031,10 @@ int PORT_WriteData(uint16_t handle, const char* p_data, uint16_t max_len, return (PORT_NOT_OPENED); } + if (p_port->state == PORT_STATE_OPENING) { + LOG_WARN("Write data received but port is in OPENING state"); + } + if (!max_len || !p_port->peer_mtu) { RFCOMM_TRACE_ERROR("PORT_WriteData() peer_mtu:%d", p_port->peer_mtu); return (PORT_UNKNOWN_ERROR); |