Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #45 from tdz/bug-1257872
Browse files Browse the repository at this point in the history
Bug 1257872
  • Loading branch information
tdz committed Mar 21, 2016
2 parents 25f74a9 + 924eb15 commit 6c9cebe
Show file tree
Hide file tree
Showing 14 changed files with 241 additions and 735 deletions.
7 changes: 4 additions & 3 deletions src/Android.mk
Expand Up @@ -17,7 +17,6 @@ bluetoothd_SRC_FILES_22 := $(bluetoothd_SRC_FILES_21)
bluetoothd_SRC_FILES := $(bluetoothd_SRC_FILES_$(PLATFORM_SDK_VERSION)) \
bt-io.c \
bt-proto.c \
bt-pdubuf.c \
core.c \
core-io.c \
main.c \
Expand All @@ -31,7 +30,8 @@ endif
ANDROID_VERSION_CONST := $(shell echo $(PLATFORM_VERSION) | awk -F. '{ printf "0x%02d%02d%02d",$$1,$$2,$$3 }')

LOCAL_SRC_FILES := $(bluetoothd_SRC_FILES)
LOCAL_C_INCLUDES := system/libfdio/include
LOCAL_C_INCLUDES := system/libfdio/include \
system/libpdu/include
LOCAL_CFLAGS := -DANDROID_VERSION=$(PLATFORM_SDK_VERSION) \
-DANDROID_VERSION_CONST=$(ANDROID_VERSION_CONST) \
-Wall -Werror
Expand All @@ -40,7 +40,8 @@ ifeq ($(strip $(BOARD_BLUETOOTH_BDROID_USE_CAF_EXTENSIONS)),true)
LOCAL_CFLAGS += -DQ_BLUETOOTH=1
endif

LOCAL_SHARED_LIBRARIES := libfdio \
LOCAL_SHARED_LIBRARIES := libpdu \
libfdio \
libhardware \
libhardware_legacy \
libcutils \
Expand Down
14 changes: 7 additions & 7 deletions src/bt-av-io.c
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2014-2015 Mozilla Foundation
* Copyright (C) 2014-2016 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,10 +18,10 @@
#include <fdio/task.h>
#include <hardware/bluetooth.h>
#include <hardware/bt_av.h>
#include <pdu/pdubuf.h>
#include "compiler.h"
#include "log.h"
#include "bt-proto.h"
#include "bt-pdubuf.h"
#include "bt-core-io.h"
#include "bt-av-io.h"

Expand Down Expand Up @@ -75,7 +75,7 @@ connection_state_cb(btav_connection_state_t state, bt_bdaddr_t* bd_addr)

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
}

static void
Expand All @@ -99,7 +99,7 @@ audio_state_cb(btav_audio_state_t state, bt_bdaddr_t* bd_addr)

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
}

#if ANDROID_VERSION >= 21
Expand All @@ -126,7 +126,7 @@ audio_config_cb(bt_bdaddr_t* bd_addr, uint32_t sample_rate,

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
}
#endif

Expand Down Expand Up @@ -160,7 +160,7 @@ opcode_connect(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_btav_interface_connect:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -190,7 +190,7 @@ opcode_disconnect(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_btav_interface_disconnect:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down
66 changes: 33 additions & 33 deletions src/bt-core-io.c
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2014-2015 Mozilla Foundation
* Copyright (C) 2014-2016 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,12 +19,12 @@
#include <fdio/timer.h>
#include <hardware/bluetooth.h>
#include <hardware_legacy/power.h>
#include <pdu/pdubuf.h>
#include <pthread.h>
#include <stdlib.h>
#include <sys/epoll.h>
#include <sys/queue.h>
#include "bt-proto.h"
#include "bt-pdubuf.h"
#include "bt-core-io.h"
#include "compiler.h"
#include "log.h"
Expand Down Expand Up @@ -341,7 +341,7 @@ adapter_state_changed_cb(bt_state_t state)

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
}

static int
Expand Down Expand Up @@ -414,7 +414,7 @@ adapter_properties_cb(bt_status_t status, int num_properties,

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
cleanup_properties:
free(aligned_properties);
}
Expand Down Expand Up @@ -460,7 +460,7 @@ remote_device_properties_cb(bt_status_t status,

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
cleanup_properties:
free(aligned_properties);
}
Expand Down Expand Up @@ -495,7 +495,7 @@ device_found_cb(int num_properties, bt_property_t* properties)

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
cleanup_properties:
free(aligned_properties);
}
Expand All @@ -520,7 +520,7 @@ discovery_state_changed_cb(bt_discovery_state_t state)

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
}

#ifdef Q_BLUETOOTH
Expand Down Expand Up @@ -555,7 +555,7 @@ pin_request_cb(bt_bdaddr_t* remote_bd_addr, bt_bdname_t* bd_name,

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
}

static void
Expand Down Expand Up @@ -588,7 +588,7 @@ ssp_request_cb(bt_bdaddr_t* remote_bd_addr, bt_bdname_t* bd_name,

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
}

static void
Expand Down Expand Up @@ -617,7 +617,7 @@ bond_state_changed_cb(bt_status_t status, bt_bdaddr_t* remote_bd_addr,

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
}

static void
Expand Down Expand Up @@ -646,7 +646,7 @@ acl_state_changed_cb(bt_status_t status, bt_bdaddr_t* remote_bd_addr,

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
}

static void
Expand Down Expand Up @@ -676,7 +676,7 @@ dut_mode_recv_cb(uint16_t opcode, uint8_t* buf, uint8_t len)

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
}

#if ANDROID_VERSION >= 18
Expand All @@ -701,7 +701,7 @@ le_test_mode_cb(bt_status_t status, uint16_t num_packets)

return;
cleanup:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
}
#endif

Expand Down Expand Up @@ -827,7 +827,7 @@ enable(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_enable:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand All @@ -853,7 +853,7 @@ disable(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_disable:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand All @@ -879,7 +879,7 @@ get_adapter_properties(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_get_adapter_properties:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -909,7 +909,7 @@ get_adapter_property(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_get_adapter_property:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -943,7 +943,7 @@ set_adapter_property(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_set_adapter_property:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
err_create_pdu_wbuf:
free(property.val);
return status;
Expand Down Expand Up @@ -975,7 +975,7 @@ get_remote_device_properties(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_get_remote_device_properties:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -1010,7 +1010,7 @@ get_remote_device_property(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_get_remote_device_property:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -1049,7 +1049,7 @@ set_remote_device_property(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_set_remote_device_property:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
err_create_pdu_wbuf:
free(property.val);
return status;
Expand Down Expand Up @@ -1095,7 +1095,7 @@ get_remote_service_record(const struct pdu* cmd)
err_bt_interface_get_remote_service_record:
remove_get_remote_service_record_params(params);
err_store_get_remote_service_record_params:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -1125,7 +1125,7 @@ get_remote_services(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_get_remote_services:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand All @@ -1151,7 +1151,7 @@ start_discovery(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_start_discovery:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand All @@ -1177,7 +1177,7 @@ cancel_discovery(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_cancel_discovery:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -1221,7 +1221,7 @@ create_bond(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_create_bond:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -1251,7 +1251,7 @@ remove_bond(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_remove_bond:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -1281,7 +1281,7 @@ cancel_bond(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_cancel_bond:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -1321,7 +1321,7 @@ pin_reply(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_pin_reply:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -1358,7 +1358,7 @@ ssp_reply(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_ssp_reply:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -1388,7 +1388,7 @@ dut_mode_configure(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_dut_mode_configure:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -1424,7 +1424,7 @@ dut_mode_send(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_interface_dut_mode_send:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}

Expand Down Expand Up @@ -1458,7 +1458,7 @@ le_test_mode(const struct pdu* cmd)

return BT_STATUS_SUCCESS;
err_bt_core_le_test_mode:
cleanup_pdu_wbuf(wbuf);
destroy_pdu_wbuf(wbuf);
return status;
}
#endif
Expand Down

0 comments on commit 6c9cebe

Please sign in to comment.