ERR("Outgoing connection failed for app_id:%d, send event", conn_info->app_id);
/* Send channel_connect callback with status: disconnected and fd = -1 */
- __hdp_send_conn_event(conn_info, BTHL_CONN_STATE_DISCONNECTED);
+ if (event_cb)
+ __hdp_send_conn_event(conn_info, BTHL_CONN_STATE_DISCONNECTED);
+
app->conn_list = g_slist_remove(app->conn_list, conn_info);
__hdp_free_conn_info(conn_info);
}
}
/* Send channel_connect callback with status: success */
- __hdp_send_conn_event(conn_info, BTHL_CONN_STATE_DESTROYED);
+ if (event_cb)
+ __hdp_send_conn_event(conn_info, BTHL_CONN_STATE_DESTROYED);
app = __get_hdp_app_by_id(conn_info->app_id);
app->conn_list = g_slist_remove(app->conn_list, conn_info);
g_clear_error(&err);
}
/* Send channel_connect callback with status: disconnected and fd = -1 */
- __hdp_send_conn_event(conn_info, BTHL_CONN_STATE_DISCONNECTED);
+ if (event_cb)
+ __hdp_send_conn_event(conn_info, BTHL_CONN_STATE_DISCONNECTED);
__hdp_free_conn_info(conn_info);
return;
}
unsigned char buff[BT_HAL_RFCOMM_MAX_BUFFER_SIZE];
GError *err = NULL;
int fd;
+ char err_msg[256] = {0, };
DBG("+");
fd = g_io_channel_unix_get_fd(io);
/* Send data to remote device */
sent = write_all(conn_info->stack_fd, buff, len);
if (sent < 0) {
- ERR("write(): %s", strerror(errno));
+ strerror_r(errno, err_msg, sizeof(err_msg));
+ ERR("write(): %s", err_msg);
goto fail;
}
unsigned char buff[BT_HAL_RFCOMM_MAX_BUFFER_SIZE];
GError *err = NULL;
int fd;
+ char err_msg[256] = {0, };
DBG("+");
/* Send data to application */
sent = write_all(conn_info->hal_fd, buff, len);
if (sent < 0) {
- ERR("write(): %s", strerror(errno));
+ strerror_r(errno, err_msg, sizeof(err_msg));
+ ERR("write(): %s", err_msg);
goto fail;
}
GIOCondition cond;
int len;
GIOChannel *io;
+ char err_msg[256] = {0, };
/* TODO: Temperary, later need to fill correct channel form correct place */
int chan = 0;
ev.status = BT_STATUS_SUCCESS;
len = write_all(conn_info->hal_fd, (unsigned char *)&ev, sizeof(ev));
if (len < 0) {
- ERR("%s", strerror(errno));
+ strerror_r(errno, err_msg, sizeof(err_msg));
+ ERR("%s", err_msg);
goto fail;
}
{
int fds[2] = {-1, -1};
rfcomm_conn_info_t *conn;
+ char err_msg[256] = {0, };
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
- ERR("socketpair(): %s", strerror(errno));
+ strerror_r(errno, err_msg, sizeof(err_msg));
+ ERR("socketpair(): %s", err_msg);
*sock = -1;
return NULL;
}
struct cmsghdr *cmsg;
struct iovec iov;
char cmsg_buf[CMSG_SPACE(sizeof(int))];
+ char err_msg[256] = {0, };
if (sock_fd == -1 || send_fd == -1)
return -1;
msg.msg_iovlen = 1;
ret = sendmsg(sock_fd, &msg, MSG_NOSIGNAL);
- if (ret < 0)
+ if (ret < 0) {
+ strerror_r(errno, err_msg, sizeof(err_msg));
ERR("sendmsg(): sock_fd %d send_fd %d: %s",
- sock_fd, send_fd, strerror(errno));
+ sock_fd, send_fd, err_msg);
+ }
return ret;
}
char *path;
int fds[2] = {-1, -1};
rfcomm_server_data_t *data;
+ char err_msg[256] = {0, };
DBG("+");
}
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
- ERR("socketpair(): %s", strerror(errno));
+ strerror_r(errno, err_msg, sizeof(err_msg));
+ ERR("socketpair(): %s", err_msg);
__free_rfcomm_server_data(data);
*sock = -1;
return NULL;