*
*
***********************************************************************************/
-#include <hardware/bluetooth.h>
-#include <hardware/bt_pan.h>
+
+#define LOG_TAG "bt_btif_pan"
+
#include <assert.h>
-#include <string.h>
-#include <signal.h>
#include <ctype.h>
-#include <sys/select.h>
-#include <sys/poll.h>
-#include <sys/ioctl.h>
-#include <netinet/in.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <linux/if_ether.h>
+#include <linux/if_tun.h>
+#include <linux/sockios.h>
+#include <net/if.h>
#include <netdb.h>
+#include <netinet/in.h>
+#include <signal.h>
#include <stdio.h>
#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/poll.h>
+#include <sys/prctl.h>
+#include <sys/select.h>
#include <sys/socket.h>
#include <sys/wait.h>
-#include <net/if.h>
-#include <linux/sockios.h>
-#include <sys/prctl.h>
-#include <linux/if_tun.h>
-#include <linux/if_ether.h>
+#include <unistd.h>
-#define LOG_TAG "bt_btif_pan"
-#include "btif_common.h"
-#include "btif_util.h"
-#include "btm_api.h"
-#include "btcore/include/bdaddr.h"
-#include "device/include/controller.h"
+#include <hardware/bluetooth.h>
+#include <hardware/bt_pan.h>
#include "bta_api.h"
#include "bta_pan_api.h"
+#include "btcore/include/bdaddr.h"
+#include "btif_common.h"
+#include "btif_pan_internal.h"
#include "btif_sock_thread.h"
#include "btif_sock_util.h"
-#include "btif_pan_internal.h"
+#include "btif_util.h"
+#include "btm_api.h"
+#include "device/include/controller.h"
#include "gki.h"
-#include "osi/include/osi.h"
#include "osi/include/log.h"
+#include "osi/include/osi.h"
#define FORWARD_IGNORE 1
#define FORWARD_SUCCESS 0
btpan_cb.flow = enable;
if (enable) {
btsock_thread_add_fd(pan_pth, btpan_cb.tap_fd, 0, SOCK_THREAD_FD_RD, 0);
- bta_dmexecutecallback(btu_exec_tap_fd_read, (void *)btpan_cb.tap_fd);
+ bta_dmexecutecallback(btu_exec_tap_fd_read, INT_TO_PTR(btpan_cb.tap_fd));
}
}
memcpy(packet, ð_hdr, sizeof(tETH_HDR));
if (len > TAP_MAX_PKT_WRITE_LEN)
{
- LOG_ERROR("btpan_tap_send eth packet size:%d is exceeded limit!", len);
+ LOG_ERROR(LOG_TAG, "btpan_tap_send eth packet size:%d is exceeded limit!", len);
return -1;
}
memcpy(packet + sizeof(tETH_HDR), buf, len);
bt_status_t status;
btpan_conn_t *conn = btpan_find_conn_handle(p_data->open.handle);
- LOG_VERBOSE("%s pan connection open status: %d", __func__, p_data->open.status);
+ LOG_VERBOSE(LOG_TAG, "%s pan connection open status: %d", __func__, p_data->open.status);
if (p_data->open.status == BTA_PAN_SUCCESS)
{
state = BTPAN_STATE_CONNECTED;
}
case BTA_PAN_CLOSE_EVT:
{
+ LOG_INFO(LOG_TAG, "%s: event = BTA_PAN_CLOSE_EVT handle %d", __FUNCTION__, p_data->close.handle);
btpan_conn_t* conn = btpan_find_conn_handle(p_data->close.handle);
-
- LOG_INFO("%s: event = BTA_PAN_CLOSE_EVT handle %d", __FUNCTION__, p_data->close.handle);
btpan_close_conn(conn);
if (conn && conn->handle >= 0)
#define IS_EXCEPTION(e) ((e) & (POLLHUP | POLLRDHUP | POLLERR | POLLNVAL))
static void btu_exec_tap_fd_read(void *p_param) {
struct pollfd ufd;
- int fd = (int)p_param;
+ int fd = PTR_TO_INT(p_param);
if (fd == INVALID_FD || fd != btpan_cb.tap_fd)
return;
btpan_tap_close(fd);
btif_pan_close_all_conns();
} else if (flags & SOCK_THREAD_FD_RD)
- bta_dmexecutecallback(btu_exec_tap_fd_read, (void *)fd);
+ bta_dmexecutecallback(btu_exec_tap_fd_read, INT_TO_PTR(fd));
}