diff options
author | Steve Kondik <steve@cyngn.com> | 2016-06-14 15:13:44 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-06-14 15:13:44 -0700 |
commit | e024328cac2c92fb32882e05d4e558d31968812b (patch) | |
tree | a89cd365ad7b9c85b1f8d52e971c0c549295e110 | |
parent | dec5d09d04c991a41c6c085ae05ae8c28bb05549 (diff) | |
parent | 415c8db54a4b7b3d01f1189393e6962bb49d0559 (diff) | |
download | android_hardware_qcom_bt-stable/cm-13.0-caf-ZNH5Y.tar.gz android_hardware_qcom_bt-stable/cm-13.0-caf-ZNH5Y.tar.bz2 android_hardware_qcom_bt-stable/cm-13.0-caf-ZNH5Y.zip |
Merge branch 'bt.lnx.1.0.c1-rel' of git://codeaurora.org/platform/hardware/qcom/bt into HEADHEADstable/cm-13.0-caf-ZNH5Ycm-13.0-caf
Change-Id: Ic28c7b826fa14c7ca7f26fc9b33a1e0f87eca3ea
-rwxr-xr-x | libbt-vendor/gen-buildcfg.sh | 25 | ||||
-rw-r--r-- | libbt-vendor/src/bt_vendor_qcom.c | 62 | ||||
-rw-r--r-- | libbt-vendor/src/hci_uart.c | 6 | ||||
-rw-r--r-- | libbt-vendor/src/hw_ar3k.c | 6 | ||||
-rw-r--r-- | libbt-vendor/src/hw_rome.c | 7 | ||||
-rw-r--r-- | libbt-vendor/vnd_buildcfg.mk | 2 |
6 files changed, 76 insertions, 32 deletions
diff --git a/libbt-vendor/gen-buildcfg.sh b/libbt-vendor/gen-buildcfg.sh new file mode 100755 index 0000000..40c01f4 --- /dev/null +++ b/libbt-vendor/gen-buildcfg.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +if [[ "" == "$2" ]] +then + echo "Usage: $0 <in-file> <out-file>" + exit 1 +fi + +if [ ! -f "$1" ] +then + echo "Error: Can't find input file $1..." + exit 2 +fi + +DATE=`/usr/bin/env date` +BASE=`basename $2` +BASE=`echo ${BASE} | tr "[:lower:]" "[:upper:]"` +BASE=`echo ${BASE} | sed -e "s/\\./_/"` +PROTECT="_${BASE}" + +echo "/* Auto-generated from $1 on ${DATE} */" > $2 +echo "#ifndef ${PROTECT}" >> $2 +echo "#define ${PROTECT}" >> $2 +sed -e '/^#/d' -e '/^$$/d' -e '/# Makefile only$$/d' -e 's/^/#define /' -e 's/=/ /' $1 >> $2 +echo "#endif" >> $2 diff --git a/libbt-vendor/src/bt_vendor_qcom.c b/libbt-vendor/src/bt_vendor_qcom.c index aa81c94..1841b92 100644 --- a/libbt-vendor/src/bt_vendor_qcom.c +++ b/libbt-vendor/src/bt_vendor_qcom.c @@ -332,7 +332,7 @@ static int bt_powerup(int en ) { char rfkill_type[64], *enable_ldo_path = NULL; char type[16], enable_ldo[6]; - int fd, size, i, ret, fd_ldo; + int fd = 0, size, i, ret, fd_ldo; char disable[PROPERTY_VALUE_MAX]; char state; @@ -436,14 +436,17 @@ static int bt_powerup(int en ) ALOGE("Write %c to rfkill\n", on); /* Write value to control rfkill */ - if ((size = write(fd, &on, 1)) < 0) { - ALOGE("write(%s) failed: %s (%d)",rfkill_state, strerror(errno),errno); + if(fd >= 0) { + if ((size = write(fd, &on, 1)) < 0) { + ALOGE("write(%s) failed: %s (%d)",rfkill_state, strerror(errno),errno); #ifdef WIFI_BT_STATUS_SYNC - bt_semaphore_release(lock_fd); - bt_semaphore_destroy(lock_fd); + bt_semaphore_release(lock_fd); + bt_semaphore_destroy(lock_fd); #endif - return -1; + return -1; + } } + #ifdef BT_SOC_TYPE_ROME if(on == '0'){ ALOGE("Stopping HCI filter as part of CTRL:OFF"); @@ -646,9 +649,10 @@ static int op(bt_vendor_opcode_t opcode, void *param) char* tok; #endif bool skip_init = true; + int opcode_init = opcode; ALOGV("bt-vendor : op for %d", opcode); - switch(opcode) + switch(opcode_init) { case BT_VND_OP_POWER_CTRL: { @@ -723,12 +727,11 @@ static int op(bt_vendor_opcode_t opcode, void *param) is_ant_req = true; //fall through #endif - #endif case BT_VND_OP_USERIAL_OPEN: { int (*fd_array)[] = (int (*)[]) param; - int idx, fd; + int idx, fd = -1, fd_filter = -1; ALOGI("bt-vendor : BT_VND_OP_USERIAL_OPEN"); switch(btSocType) { @@ -841,16 +844,12 @@ static int op(bt_vendor_opcode_t opcode, void *param) ALOGI("Failed to read BD address. Use the one from bluedroid stack/ftm"); } #endif - if(rome_soc_init(fd,vnd_local_bd_addr)<0) { + if(rome_soc_init(fd, (char*)vnd_local_bd_addr)<0) { retval = -1; - userial_clock_operation(fd, USERIAL_OP_CLK_OFF); } else { ALOGV("rome_soc_init is completed"); property_set("wc_transport.soc_initialized", "1"); - userial_clock_operation(fd, USERIAL_OP_CLK_OFF); skip_init = false; - /*Close the UART port*/ - close(fd); } } } @@ -864,40 +863,46 @@ static int op(bt_vendor_opcode_t opcode, void *param) start_hci_filter(); if (is_ant_req) { ALOGV("connect to ant channel"); - ant_fd = fd = connect_to_local_socket("ant_sock"); + ant_fd = fd_filter = connect_to_local_socket("ant_sock"); } else #endif { ALOGV("connect to bt channel"); - vnd_userial.fd = fd = connect_to_local_socket("bt_sock"); + vnd_userial.fd = fd_filter = connect_to_local_socket("bt_sock"); } - if (fd != -1) { + if (fd_filter != -1) { ALOGV("%s: received the socket fd: %d is_ant_req: %d\n", - __func__, fd, is_ant_req); + __func__, fd_filter, is_ant_req); if((strcmp(emb_wp_mode, "true") == 0) && !is_ant_req) { if (rome_ver >= ROME_VER_3_0) { /* get rome supported feature request */ ALOGE("%s: %x08 %0x", __FUNCTION__,rome_ver, ROME_VER_3_0); - rome_get_addon_feature_list(fd); + rome_get_addon_feature_list(fd_filter); } } if (!skip_init) { /*Skip if already sent*/ - enable_controller_log(fd, is_ant_req); + enable_controller_log(fd_filter, is_ant_req); skip_init = true; } - for (idx=0; idx < CH_MAX; idx++) - (*fd_array)[idx] = fd; - retval = 1; + + for (idx=0; idx < CH_MAX; idx++) { + (*fd_array)[idx] = fd_filter; } + + retval = 1; + } else { retval = -1; } - } else { - if (fd >= 0) - close(fd); + } + + if (fd >= 0) { + userial_clock_operation(fd, USERIAL_OP_CLK_OFF); + /*Close the UART port*/ + close(fd); } } break; @@ -944,10 +949,11 @@ static int op(bt_vendor_opcode_t opcode, void *param) break; case BT_VND_OP_GET_LPM_IDLE_TIMEOUT: - if (btSocType == BT_SOC_AR3K) { + { uint32_t *timeout_ms = (uint32_t *) param; *timeout_ms = 1000; } + break; case BT_VND_OP_LPM_SET_MODE: @@ -1078,7 +1084,7 @@ static void ssr_cleanup(int reason) { if ((btSocType = get_bt_soc_type()) < 0) { ALOGE("%s: Failed to detect BT SOC Type", __FUNCTION__); - return -1; + return; } if (btSocType == BT_SOC_ROME) { diff --git a/libbt-vendor/src/hci_uart.c b/libbt-vendor/src/hci_uart.c index 8c636cf..92afdf0 100644 --- a/libbt-vendor/src/hci_uart.c +++ b/libbt-vendor/src/hci_uart.c @@ -49,6 +49,8 @@ #define VNDUSERIALDBG(param, ...) {} #endif +#define RESERVED(p) if(p) ALOGI( "%s: reserved param", __FUNCTION__); + /****************************************************************************** ** Global variables ******************************************************************************/ @@ -391,7 +393,7 @@ int userial_vendor_get_baud(void) *******************************************************************************/ int userial_vendor_ioctl(userial_vendor_ioctl_op_t op, int *p_data) { - int err; + int err = -1; switch(op) { @@ -442,6 +444,8 @@ int userial_vendor_ioctl(userial_vendor_ioctl_op_t op, int *p_data) *******************************************************************************/ int userial_set_port(char *p_conf_name, char *p_conf_value, int param) { + RESERVED(p_conf_name); + RESERVED(param); strlcpy(vnd_userial.port_name, p_conf_value, VND_PORT_NAME_MAXLEN); return 0; diff --git a/libbt-vendor/src/hw_ar3k.c b/libbt-vendor/src/hw_ar3k.c index 2f6da66..b1d50ab 100644 --- a/libbt-vendor/src/hw_ar3k.c +++ b/libbt-vendor/src/hw_ar3k.c @@ -96,6 +96,8 @@ struct ps_cfg_entry ps_list[MAX_TAGS]; } #endif +#define RESERVED(p) if(p) ALOGI( "%s: reserved param", __FUNCTION__); + /***************************************************************************** ** Functions *****************************************************************************/ @@ -874,6 +876,8 @@ static int set_patch_ram(int dev, char *patch_loc, int len) uint8_t *event; uint8_t *loc_ptr = &cmd[7]; + RESERVED(len); + if (!patch_loc) return -1; @@ -1387,6 +1391,8 @@ void lpm_set_ar3k(uint8_t pio, uint8_t action, uint8_t polarity) ALOGI("lpm mode: %d action: %d", pio, action); + RESERVED(polarity); + switch (pio) { case UPIO_LPM_MODE: diff --git a/libbt-vendor/src/hw_rome.c b/libbt-vendor/src/hw_rome.c index 3df11ba..08291ad 100644 --- a/libbt-vendor/src/hw_rome.c +++ b/libbt-vendor/src/hw_rome.c @@ -60,6 +60,8 @@ extern "C" { } #endif +#define RESERVED(p) if(p) ALOGI( "%s: reserved param", __FUNCTION__); + int read_vs_hci_event(int fd, unsigned char* buf, int size); /****************************************************************************** @@ -971,7 +973,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc int rome_tlv_dnld_req(int fd, int tlv_size) { int total_segment, remain_size, i, err = -1; - unsigned char wait_cc_evt; + unsigned char wait_cc_evt = TRUE; total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\ @@ -1687,7 +1689,7 @@ int check_embedded_mode(int fd) { return wipower_flag; } -int rome_get_addon_feature_list(fd) { +int rome_get_addon_feature_list(int fd) { int err = 0; /* Get addon features that are supported by FW */ @@ -1798,6 +1800,7 @@ int rome_soc_init(int fd, char *bdaddr) int err = -1, size = 0; dnld_fd = fd; ALOGI(" %s ", __FUNCTION__); + RESERVED(bdaddr); /* If wipower charging is going on in embedded mode then start hand off req */ if (wipower_flag == WIPOWER_IN_EMBEDDED_MODE && wipower_handoff_ready != NON_WIPOWER_MODE) diff --git a/libbt-vendor/vnd_buildcfg.mk b/libbt-vendor/vnd_buildcfg.mk index 9b161d2..4ae0586 100644 --- a/libbt-vendor/vnd_buildcfg.mk +++ b/libbt-vendor/vnd_buildcfg.mk @@ -26,7 +26,7 @@ ifeq (,$(wildcard $(SRC))) SRC := $(call my-dir)/include/vnd_generic.txt endif GEN := $(intermediates)/vnd_buildcfg.h -TOOL := $(TOP_DIR)hardware/qcom/bt/libbt-vendor/gen-buildcfg.sh +TOOL := $(LOCAL_PATH)/gen-buildcfg.sh $(GEN): PRIVATE_PATH := $(call my-dir) $(GEN): PRIVATE_CUSTOM_TOOL = $(TOOL) $< $@ |