Add compat for old wcnss_filter

* New one has "vendor." prefix for all it's props.

Change-Id: I4fa29aa68ce946c5368e22d9042762bc7ae869bb
diff --git a/libbt-vendor/Android.mk b/libbt-vendor/Android.mk
index a7161ab..091dfec 100644
--- a/libbt-vendor/Android.mk
+++ b/libbt-vendor/Android.mk
@@ -96,6 +96,9 @@
 ifeq ($(QCOM_BT_READ_ADDR_FROM_PROP),true)
 LOCAL_CFLAGS += -DREAD_BT_ADDR_FROM_PROP
 endif
+ifeq ($(QCOM_BT_USE_OLD_WCNSS_FILTER),true)
+LOCAL_CFLAGS += -DUSE_OLD_WCNSS_FILTER
+endif
 
 #include $(LOCAL_PATH)/vnd_buildcfg.mk
 
diff --git a/libbt-vendor/src/bt_vendor_qcom.c b/libbt-vendor/src/bt_vendor_qcom.c
index 83e943f..b855723 100644
--- a/libbt-vendor/src/bt_vendor_qcom.c
+++ b/libbt-vendor/src/bt_vendor_qcom.c
@@ -50,9 +50,15 @@
 #define STOP_WCNSS_FILTER 0xDD
 #define STOP_WAIT_TIMEOUT   1000
 
-#define SOC_INIT_PROPERTY "vendor.wc_transport.soc_initialized"
+#ifndef USE_OLD_WCNSS_FILTER
+#define PREFIX "vendor."
+#else
+#define PREFIX ""
+#endif
 
-#define BT_VND_FILTER_START "vendor.wc_transport.start_hci"
+#define SOC_INIT_PROPERTY PREFIX "wc_transport.soc_initialized"
+
+#define BT_VND_FILTER_START PREFIX "wc_transport.start_hci"
 
 #define CMD_TIMEOUT  0x22
 
@@ -233,7 +239,7 @@
     char inProgress[PROPERTY_VALUE_MAX] = {'\0'};
     int value, ret;
 
-    property_get("vendor.wc_transport.ref_count", ref_count, "0");
+    property_get(PREFIX "wc_transport.ref_count", ref_count, "0");
 
     value = atoi(ref_count);
     ALOGV("%s: ref_count: %s\n",__func__,  ref_count);
@@ -272,7 +278,7 @@
     snprintf(ref_count, 3, "%d", value);
     ALOGV("%s: updated ref_count is: %s", __func__, ref_count);
 
-    ret  = property_set("vendor.wc_transport.ref_count", ref_count);
+    ret  = property_set(PREFIX "wc_transport.ref_count", ref_count);
     if (ret < 0) {
         ALOGE("%s: Error while updating property: %d\n", __func__, ret);
         return false;
@@ -289,7 +295,7 @@
 
        ALOGV("%s: Entry ", __func__);
 
-       property_get("vendor.wc_transport.hci_filter_status", value, "0");
+       property_get(PREFIX "wc_transport.hci_filter_status", value, "0");
        if (strcmp(value, "0") == 0) {
            ALOGI("%s: hci_filter has been stopped already", __func__);
        }
@@ -341,8 +347,8 @@
            //Filter should have been started OR in the process of initializing
            //Make sure of hci_filter_status and return the state based on it
        } else {
-           property_set("vendor.wc_transport.clean_up","0");
-           property_set("vendor.wc_transport.hci_filter_status", "0");
+           property_set(PREFIX "wc_transport.clean_up","0");
+           property_set(PREFIX "wc_transport.hci_filter_status", "0");
            property_set(BT_VND_FILTER_START, "true");
            ALOGV("%s: %s set to true ", __func__, BT_VND_FILTER_START );
        }
@@ -352,7 +358,7 @@
          comesup and ready to accept the connections */
        //sched_yield();
        for(i=0; i<45; i++) {
-          property_get("vendor.wc_transport.hci_filter_status", value, "0");
+          property_get(PREFIX "wc_transport.hci_filter_status", value, "0");
           if (strcmp(value, "1") == 0) {
                init_success = 1;
                break;
@@ -476,7 +482,7 @@
     }
     if (!memcmp(enable_ldo, "true", 4)) {
         ALOGI("External LDO has been configured");
-        ret = property_set("vendor.wc_transport.extldo", "enabled");
+        ret = property_set(PREFIX "wc_transport.extldo", "enabled");
         if (ret < 0) {
             ALOGI("%s: Not able to set property vendor.wc_transport.extldo\n", __func__);
         }
@@ -486,7 +492,7 @@
     if(on == '0'){
         ALOGE("Stopping HCI filter as part of CTRL:OFF");
         stop_hci_filter();
-        property_set("vendor.wc_transport.soc_initialized", "0");
+        property_set(PREFIX "wc_transport.soc_initialized", "0");
     }
 
     if (q->soc_type >= BT_SOC_CHEROKEE && q->soc_type < BT_SOC_RESERVED) {
@@ -636,7 +642,7 @@
     snprintf(prop, sizeof(prop), "%02x:%02x:%02x:%02x:%02x:%02x",
              temp->bdaddr[0], temp->bdaddr[1], temp->bdaddr[2],
              temp->bdaddr[3], temp->bdaddr[4], temp->bdaddr[5]);
-    ret = property_set("vendor.wc_transport.stack_bdaddr", prop);
+    ret = property_set(PREFIX "wc_transport.stack_bdaddr", prop);
     if (ret < 0) {
         ALOGE("Failed to set vendor.wc_transport.stack_bdaddr prop, ret = %d", ret);
         ret = -BT_STATUS_PROP_FAILURE;
@@ -903,7 +909,7 @@
                             property_get("ro.vendor.bluetooth.emb_wp_mode", emb_wp_mode, false);
                             if (!is_soc_initialized()) {
                                 char* dlnd_inprog = is_ant_req ? "ant" : "bt";
-                                if (property_set("vendor.wc_transport.patch_dnld_inprog", dlnd_inprog) < 0) {
+                                if (property_set(PREFIX "wc_transport.patch_dnld_inprog", dlnd_inprog) < 0) {
                                     ALOGE("%s: Failed to set dnld_inprog %s", __FUNCTION__, dlnd_inprog);
                                 }
 
@@ -926,7 +932,7 @@
                                     }
                                 }
                                 ALOGV("rome_soc_init is started");
-                                property_set("vendor.wc_transport.soc_initialized", "0");
+                                property_set(PREFIX "wc_transport.soc_initialized", "0");
 #ifdef READ_BT_ADDR_FROM_PROP
                                 /*Give priority to read BD address from boot property*/
                                 ignore_boot_prop = FALSE;
@@ -975,21 +981,21 @@
                                     retval = -1;
                                 } else {
                                     ALOGV("rome_soc_init is completed");
-                                    property_set("vendor.wc_transport.soc_initialized", "1");
+                                    property_set(PREFIX "wc_transport.soc_initialized", "1");
                                     skip_init = false;
                                 }
                             }
-                            if (property_set("vendor.wc_transport.patch_dnld_inprog", "null") < 0) {
+                            if (property_set(PREFIX "wc_transport.patch_dnld_inprog", "null") < 0) {
                                 ALOGE("%s: Failed to set property", __FUNCTION__);
                             }
 
-                            property_set("vendor.wc_transport.clean_up","0");
+                            property_set(PREFIX "wc_transport.clean_up","0");
                             if (retval != -1) {
                                 retval = start_hci_filter();
                                 if (retval < 0) {
                                     ALOGE("%s: WCNSS_FILTER wouldn't have started in time\n", __func__);
-                                    property_set("vendor.wc_transport.hci_filter_status", "-1");
-                                    property_set("vendor.wc_transport.start_hci", "false");
+                                    property_set(PREFIX "wc_transport.hci_filter_status", "-1");
+                                    property_set(PREFIX "wc_transport.start_hci", "false");
                                     bt_powerup(0);
                                 } else {
 #ifdef ENABLE_ANT
@@ -1054,8 +1060,8 @@
                                  Set the following property to -1 so that the SSR cleanup routine
                                  can reset SOC.
                                  */
-                                property_set("vendor.wc_transport.hci_filter_status", "-1");
-                                property_set("vendor.wc_transport.start_hci", "false");
+                                property_set(PREFIX "wc_transport.hci_filter_status", "-1");
+                                property_set(PREFIX "wc_transport.start_hci", "false");
                                 bt_powerup(0);
                             } else {
 #ifdef ENABLE_ANT
@@ -1112,7 +1118,7 @@
         case BT_VND_OP_ANT_USERIAL_CLOSE:
             {
                 ALOGI("bt-vendor : BT_VND_OP_ANT_USERIAL_CLOSE");
-                property_set("vendor.wc_transport.clean_up","1");
+                property_set(PREFIX "wc_transport.clean_up","1");
                 if (q->ant_fd != -1) {
                     ALOGE("closing ant_fd");
                     close(q->ant_fd);
@@ -1125,7 +1131,7 @@
         case BT_VND_OP_FM_USERIAL_CLOSE:
             {
                 ALOGI("bt-vendor : BT_VND_OP_FM_USERIAL_CLOSE");
-                property_set("vendor.wc_transport.clean_up","1");
+                property_set(PREFIX "wc_transport.clean_up","1");
                 if (q->fm_fd != -1) {
                     ALOGE("closing fm_fd");
                     close(q->fm_fd);
@@ -1146,7 +1152,7 @@
                     case BT_SOC_AR3K:
                     case BT_SOC_CHEROKEE:
                     {
-                        property_set("vendor.wc_transport.clean_up","1");
+                        property_set(PREFIX "wc_transport.clean_up","1");
                         userial_vendor_close();
                         break;
                     }
@@ -1254,7 +1260,7 @@
                   case BT_SOC_ROME:
                        {
                            char value[PROPERTY_VALUE_MAX] = {'\0'};
-                           property_get("vendor.wc_transport.hci_filter_status", value, "0");
+                           property_get(PREFIX "wc_transport.hci_filter_status", value, "0");
                            if(is_soc_initialized()&& (strcmp(value,"1") == 0))
                            {
                               __hw_epilog_process();
@@ -1336,7 +1342,7 @@
         ALOGE("ssr_cleanup called with NULL context");
         goto out;
     }
-    if (property_set("vendor.wc_transport.patch_dnld_inprog", "null") < 0) {
+    if (property_set(PREFIX "wc_transport.patch_dnld_inprog", "null") < 0) {
         ALOGE("Failed to set property");
     }
 
@@ -1404,7 +1410,7 @@
     ALOGV("%s:", __FUNCTION__);
     char inProgress[PROPERTY_VALUE_MAX] = {'\0'};
     while (1) {
-        property_get("vendor.wc_transport.patch_dnld_inprog", inProgress, "null");
+        property_get(PREFIX "wc_transport.patch_dnld_inprog", inProgress, "null");
 
         if(is_ant_req && !(strcmp(inProgress,"bt"))) {
            //ANT request, wait for BT to finish
@@ -1436,7 +1442,7 @@
     {
         case BT_SOC_ROME:
             ALOGI("%s: ROME case", __func__);
-            property_get("vendor.wc_transport.patch_dnld_inprog", inProgress, "null");
+            property_get(PREFIX "wc_transport.patch_dnld_inprog", inProgress, "null");
             if(strcmp(inProgress,"null") == 0) {
                 retval = false;
             } else {
@@ -1463,7 +1469,7 @@
     enabled = true;
 #endif
 
-    ret = property_get("vendor.wc_transport.force_special_byte", value, NULL);
+    ret = property_get(PREFIX "wc_transport.force_special_byte", value, NULL);
 
     if (ret) {
         enabled = (strcmp(value, "false") ==0) ? false : true;