Merge tag 'LA.VENDOR.1.0.r1-23800-WAIPIO.QSSI14.0' of https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/usb into lineage-21.0

"LA.VENDOR.1.0.r1-23800-WAIPIO.QSSI14.0"

* tag 'LA.VENDOR.1.0.r1-23800-WAIPIO.QSSI14.0' of https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/usb:
  Add minimal USB init RC for QMAA
  USB GADGET HAL: Update HAL to version 1.2
  init.qcom.usb.sh: Configure RNDIS to be identified by Windows
  init.qti.debug.sh: Add support to enable NCM functionality
  USB: HAL: Add AUDIO_ACCESSORY as one of the supported modes
  init.qti.usb.debug: Remove unwanted events from usb instance
  USB: HAL: handling readFile failure on device path
  USB: Solving path traversal issue in USB HAL AppendNodeMapper
  init.qcom.usb: Set default composition to 90DB for Ravelin
  init.qcom.usb.sh: do not set vendor.usb.rndis.func.name on Anorak
  init.qti.usb.debug: Enable readl/writel ftraces of dwc3
  UsbGadgetHal: Add null check in getCurrentUsbFunctions()
  USB: Use SW path for QDSS over USB
  USB: Enable USB Gadget HAL for Anorak
  init.qti.debug.sh: Add support to enable ftraces for xhci on usb
  init.qcom.usb.sh: Set default composition to 9060 for Anorak
  init.qti.usb.debug: Enable RPM ftrace with dwc3 msm device
  init.qcom.usb.sh: Set default composition to 9060 for Neo
  init.qcom.usb.rc: Add support for diag_cnss comp for non IPA targets
  USBGadgetHAL: Add diag,diag_cnss,adb to supported composition list
  USB: Enable USBGadget HAL for Parrot
  init.qcom.usb: Set default composition to 90DB for parrot
  USB: Use SW path for QDSS over USB
  USB: Enable USBGadget HAL for Neo
  USB: Use USB QDSS data over SW path on Neo
  init.qcom.usb.sh: Pass blank MSM serial number for virtual Android
  USB: Use USB QDSS data over SW path on parrot
  init.qcom.usb.rc: Add uvc declarations under a trigger in rc
  init.qti.usb.debug.sh: Enable DWC3 core runtime resume/suspend ftrace
  USBGadgetHAL: Read supported compositions from file
  USB HAL: Bind UDC to ConfigFS when re-added
  USB: Set sys.usb.mtp.batchcancel for targets using mtp over ffs
  USB: Enable USBGadget HAL for kalama
  Revert "USB: Enable USBGadget HAL for Taro"

 Conflicts:
	etc/init.qcom.usb.rc
	etc/init.qcom.usb.sh
	etc/init.qti.usb.debug.sh
	etc/init.qti.usb.qmaa.rc
	hal/Usb.cpp
	hal/usb_compositions.conf
	vendor_product.mk

Change-Id: I72263ede3b2f5eb5b8526a2a1a591af13b7667b8
diff --git a/etc/init.qcom.usb.rc b/etc/init.qcom.usb.rc
index 0f4cb0c..f22df65 100644
--- a/etc/init.qcom.usb.rc
+++ b/etc/init.qcom.usb.rc
@@ -27,32 +27,8 @@
 #
 
 # Changes from Qualcomm Innovation Center are provided under the following license:
-# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above
-#       copyright notice, this list of conditions and the following
-#       disclaimer in the documentation and/or other materials provided
-#       with the distribution.
-#     * Neither the name of The Linux Foundation nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-# ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause-Clear
 #
 
 on charger
@@ -114,7 +90,7 @@
     mkdir /config/usb_gadget/g1/functions/rmnet_bam.dpl
     mkdir /config/usb_gadget/g1/functions/rmnet_bam.rmnet_bam_dmux
     mkdir /config/usb_gadget/g1/functions/rmnet_bam.dpl_bam_dmux
-    mkdir /config/usb_gadget/g1/functions/ncm.0
+    mkdir /config/usb_gadget/g1/functions/ncm.gs6
     mkdir /config/usb_gadget/g1/functions/ccid.ccid
     mkdir /config/usb_gadget/g1/functions/uac2.0
     mkdir /config/usb_gadget/g1/functions/uvc.0
@@ -753,7 +729,7 @@
     rm /config/usb_gadget/g1/configs/b.1/f9
     write /config/usb_gadget/g1/idVendor 0x05C6
     write /config/usb_gadget/g1/idProduct 0xA4A1
-    symlink /config/usb_gadget/g1/functions/ncm.0 /config/usb_gadget/g1/configs/b.1/f1
+    symlink /config/usb_gadget/g1/functions/ncm.gs6 /config/usb_gadget/g1/configs/b.1/f1
     write /config/usb_gadget/g1/UDC ${sys.usb.controller}
     setprop sys.usb.state ${sys.usb.config}
 
@@ -774,7 +750,7 @@
     symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
     write /config/usb_gadget/g1/idVendor 0x05C6
     write /config/usb_gadget/g1/idProduct 0x908C
-    symlink /config/usb_gadget/g1/functions/ncm.0 /config/usb_gadget/g1/configs/b.1/f1
+    symlink /config/usb_gadget/g1/functions/ncm.gs6 /config/usb_gadget/g1/configs/b.1/f1
     symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
     write /config/usb_gadget/g1/UDC ${sys.usb.controller}
     setprop sys.usb.state ${sys.usb.config}
@@ -1502,6 +1478,31 @@
     write /config/usb_gadget/g1/UDC ${sys.usb.controller}
     setprop sys.usb.state ${sys.usb.config}
 
+
+on property:sys.usb.config=diag,diag_cnss,adb && property:sys.usb.configfs=1
+    start adbd
+
+on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,diag_cnss,adb && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_cnss_adb"
+    rm /config/usb_gadget/g1/configs/b.1/f1
+    rm /config/usb_gadget/g1/configs/b.1/f2
+    rm /config/usb_gadget/g1/configs/b.1/f3
+    rm /config/usb_gadget/g1/configs/b.1/f4
+    rm /config/usb_gadget/g1/configs/b.1/f5
+    rm /config/usb_gadget/g1/configs/b.1/f6
+    rm /config/usb_gadget/g1/configs/b.1/f7
+    rm /config/usb_gadget/g1/configs/b.1/f8
+    rm /config/usb_gadget/g1/configs/b.1/f9
+    symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
+    write /config/usb_gadget/g1/idVendor 0x05C6
+    write /config/usb_gadget/g1/idProduct 0x90D9
+    write /config/usb_gadget/g1/functions/diag.diag/pid 0x90d9
+    symlink /config/usb_gadget/g1/functions/${vendor.usb.diag.func.name}.diag /config/usb_gadget/g1/configs/b.1/f1
+    symlink /config/usb_gadget/g1/functions/${vendor.usb.diag.func.name}.diag_mdm2 /config/usb_gadget/g1/configs/b.1/f2
+    symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f3
+    write /config/usb_gadget/g1/UDC ${sys.usb.controller}
+    setprop sys.usb.state ${sys.usb.config}
+
 on property:sys.usb.ffs.ready=1 && property:sys.usb.config=diag,diag_mdm,diag_mdm2,qdss,qdss_mdm,serial_cdev,dpl,rmnet && property:sys.usb.configfs=1
     write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "diag_diag_mdm_diag_mdm2_qdss_qdss_mdm_dun_dpl_rmnet"
     rm /config/usb_gadget/g1/configs/b.1/f1
diff --git a/etc/init.qcom.usb.sh b/etc/init.qcom.usb.sh
index 451296f..6488772 100644
--- a/etc/init.qcom.usb.sh
+++ b/etc/init.qcom.usb.sh
@@ -28,6 +28,11 @@
 #
 #
 
+# Changes from Qualcomm Innovation Center are provided under the following license:
+# Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause-Clear
+#
+
 # Set platform variables
 soc_hwplatform=`cat /sys/devices/soc0/hw_platform 2> /dev/null`
 soc_machine=`cat /sys/devices/soc0/machine 2> /dev/null`
@@ -53,7 +58,11 @@
     else
 	  case "$(getprop ro.baseband)" in
 	      "apq")
-	          setprop persist.vendor.usb.config diag,adb
+	        if [ "$target" == "neo" ] || [ "$target" == "anorak" ]; then
+			setprop persist.vendor.usb.config diag,qdss,adb
+		else
+			setprop persist.vendor.usb.config diag,adb
+		fi
 	      ;;
 	      *)
 	      case "$soc_hwplatform" in
@@ -103,7 +112,7 @@
 	              "sdm845" | "sdm710")
 		          setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,adb
 		      ;;
-	              "msmnile" | "sm6150" | "trinket" | "lito" | "atoll" | "bengal" | "lahaina" | "holi" | "taro" | "kalama" | "crow")
+	              "msmnile" | "sm6150" | "trinket" | "lito" | "atoll" | "bengal" | "lahaina" | "holi" | "taro" | "parrot" | "ravelin" | "kalama" | "crow")
 			  setprop persist.vendor.usb.config diag,serial_cdev,rmnet,dpl,qdss,adb
 		      ;;
 	              *)
@@ -192,3 +201,27 @@
 if [ -d /config/usb_gadget/g1/functions/uac2.0 ]; then
 	setprop vendor.usb.uac2.function.init 1
 fi
+
+# enable ncm
+case "$target" in
+"neo" | "anorak")
+	if [ -d /config/usb_gadget/g1/functions/ncm.gs6 ]; then
+		cd /config/usb_gadget/g1/functions/ncm.gs6
+
+		echo WINNCM > os_desc/interface.ncm/compatible_id
+	fi
+    ;;
+esac
+
+#Configure class, subclass, protocol for RNDIS SW path to be detected by Windows
+case "$target" in
+"anorak")
+	if [ -d /config/usb_gadget/g1/functions/rndis.rndis ]; then
+		cd /config/usb_gadget/g1/functions/rndis.rndis
+
+		echo ef > class
+		echo 4 > subclass
+		echo 1 > protocol
+	fi
+    ;;
+esac
diff --git a/hal/Android.bp b/hal/Android.bp
index 7916bae..854319f 100644
--- a/hal/Android.bp
+++ b/hal/Android.bp
@@ -33,21 +33,22 @@
 }
 
 cc_binary {
-    name: "android.hardware.usb.gadget@1.1-service-qti",
+    name: "android.hardware.usb.gadget@1.2-service-qti",
     defaults: ["qti_usb_hal_defaults"],
     shared_libs: [
         "android.hardware.usb.gadget@1.0",
         "android.hardware.usb.gadget@1.1",
+        "android.hardware.usb.gadget@1.2",
     ],
     static_libs: [
-        "libusbconfigfs"
+        "libusbconfigfs-2"
     ],
     srcs: [
         "UsbGadget.cpp",
     ],
 
-    init_rc: ["android.hardware.usb.gadget@1.1-service-qti.rc"],
-    vintf_fragments: ["android.hardware.usb.gadget@1.1-service.xml"],
+    init_rc: ["android.hardware.usb.gadget@1.2-service-qti.rc"],
+    vintf_fragments: ["android.hardware.usb.gadget@1.2-service.xml"],
 }
 
 prebuilt_etc {
diff --git a/hal/UsbGadget.cpp b/hal/UsbGadget.cpp
index cf2f789..d2c2e67 100644
--- a/hal/UsbGadget.cpp
+++ b/hal/UsbGadget.cpp
@@ -15,12 +15,17 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
  */
 
-#define LOG_TAG "android.hardware.usb.gadget@1.1-service-qti"
+#define LOG_TAG "android.hardware.usb.gadget@1.2-service-qti"
 
 #include <android-base/file.h>
 #include <android-base/properties.h>
+#include <android-base/strings.h>
 #include <functional>
 #include <map>
 #include <tuple>
@@ -51,7 +56,7 @@
 namespace hardware {
 namespace usb {
 namespace gadget {
-namespace V1_1 {
+namespace V1_2 {
 namespace implementation {
 
 using ::android::sp;
@@ -59,9 +64,10 @@
 using ::android::base::SetProperty;
 using ::android::base::WriteStringToFile;
 using ::android::base::ReadFileToString;
+using ::android::base::Trim;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::hardware::usb::gadget::V1_0::GadgetFunction;
+using ::android::hardware::usb::gadget::V1_2::GadgetFunction;
 using ::android::hardware::usb::gadget::V1_0::Status;
 using ::android::hardware::usb::gadget::addAdb;
 using ::android::hardware::usb::gadget::kDisconnectWaitUs;
@@ -69,6 +75,31 @@
 using ::android::hardware::usb::gadget::resetGadget;
 using ::android::hardware::usb::gadget::setVidPid;
 using ::android::hardware::usb::gadget::unlinkFunctions;
+using ::android::hardware::usb::gadget::V1_2::UsbSpeed;
+
+static std::map<std::string, std::tuple<std::string, std::string, std::string> >
+supported_compositions;
+
+static void createCompositionsMap(std:: string fileName) {
+  std::ifstream compositions(fileName);
+  std::string line;
+
+  while (std::getline(compositions, line)) {
+    std::string prop;
+    std::tuple<std::string, std::string, std::string> vpa;
+    // Ignore comments in the file
+    auto pos = line.find('#');
+    if (pos != std::string::npos)
+      line.erase(pos);
+
+    std::stringstream words(line);
+
+    words >> prop >> std::get<0>(vpa) >> std::get<1>(vpa) >> std::get<2>(vpa);
+    // If we get vpa[1], we have the three minimum values needed. Or else we skip
+    if (!std::get<1>(vpa).empty())
+      supported_compositions.insert_or_assign(prop, vpa);
+  }
+}
 
 static std::map<std::string, std::tuple<std::string, std::string, std::string> >
 supported_compositions;
@@ -120,6 +151,36 @@
   return Void();
 }
 
+Return<void> UsbGadget::getUsbSpeed
+	(const sp<V1_2::IUsbGadgetCallback>& callback)
+{
+  if (!callback) return Void();
+
+  std::string gadgetName = GetProperty(USB_CONTROLLER_PROP, "");
+  std::string current_speed;
+
+ if (ReadFileToString("/sys/class/udc/" + gadgetName + "/current_speed",
+			&current_speed)) {
+      current_speed = Trim(current_speed);
+
+      UsbSpeed speed = UsbSpeed::UNKNOWN;
+      if (current_speed == "low-speed")
+        speed = UsbSpeed::LOWSPEED;
+      else if (current_speed == "full-speed")
+        speed = UsbSpeed::FULLSPEED;
+      else if (current_speed == "high-speed")
+        speed = UsbSpeed::HIGHSPEED;
+      else if (current_speed == "super-speed")
+        speed = UsbSpeed::SUPERSPEED;
+      else if (current_speed == "super-speed-plus")
+        speed = UsbSpeed::SUPERSPEED_10Gb;
+
+      callback->getUsbSpeedCb(speed);
+  }
+
+  return Void();
+}
+
 Return<Status> UsbGadget::reset() {
   if (!WriteStringToFile("none", PULLUP_PATH)) {
     ALOGE("reset(): unable to clear pullup");
@@ -172,7 +233,7 @@
   { "dpl",              [](){ return GetProperty(RMNET_FUNC_NAME_PROP, "gsi") + "." + GetProperty(DPL_INST_NAME_PROP, "dpl"); } },
   { "mass_storage",     [](){ return "mass_storage.0"; } },
   { "mtp",              [](){ return "ffs.mtp"; } },
-  { "ncm",              [](){ return "ncm.0"; } },
+  { "ncm",              [](){ return "ncm.gs6"; } },
   { "ptp",              [](){ return "ffs.ptp"; } },
   { "qdss",             [](){ return qdssFuncname("0"); } },
   { "qdss_debug",       [](){ return qdssFuncname("1"); } },
@@ -269,6 +330,12 @@
     case GadgetFunction::ADB | GadgetFunction::MIDI:
       ret = setVidPid("0x18d1", "0x4ee9");
       break;
+    case static_cast<uint64_t>(GadgetFunction::NCM):
+      ret = setVidPid("0x18d1", "0x4eeb");
+      break;
+    case GadgetFunction::ADB | GadgetFunction::NCM:
+      ret = setVidPid("0x05c6", "0x908c");
+      break;
     case static_cast<uint64_t>(GadgetFunction::ACCESSORY):
       ret = setVidPid("0x18d1", "0x2d00");
       break;
@@ -445,7 +512,7 @@
   return Void();
 }
 }  // namespace implementation
-}  // namespace V1_1
+}  // namespace V1_2
 }  // namespace gadget
 }  // namespace usb
 }  // namespace hardware
@@ -455,8 +522,8 @@
   using android::base::GetProperty;
   using android::hardware::configureRpcThreadpool;
   using android::hardware::joinRpcThreadpool;
-  using android::hardware::usb::gadget::V1_1::IUsbGadget;
-  using android::hardware::usb::gadget::V1_1::implementation::UsbGadget;
+  using android::hardware::usb::gadget::V1_2::IUsbGadget;
+  using android::hardware::usb::gadget::V1_2::implementation::UsbGadget;
 
   std::string gadgetName = GetProperty("persist.vendor.usb.controller",
       GetProperty(USB_CONTROLLER_PROP, ""));
diff --git a/hal/UsbGadget.h b/hal/UsbGadget.h
index 769da99..7e7e43a 100644
--- a/hal/UsbGadget.h
+++ b/hal/UsbGadget.h
@@ -15,12 +15,16 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
  */
 
-#ifndef ANDROID_HARDWARE_USB_GADGET_V1_1_USBGADGET_H
-#define ANDROID_HARDWARE_USB_GADGET_V1_1_USBGADGET_H
+#ifndef ANDROID_HARDWARE_USB_GADGET_V1_2_USBGADGET_H
+#define ANDROID_HARDWARE_USB_GADGET_V1_2_USBGADGET_H
 
-#include <android/hardware/usb/gadget/1.1/IUsbGadget.h>
+#include <android/hardware/usb/gadget/1.2/IUsbGadget.h>
 #include <hidl/Status.h>
 #include <mutex>
 
@@ -28,7 +32,7 @@
 namespace hardware {
 namespace usb {
 namespace gadget {
-namespace V1_1 {
+namespace V1_2 {
 namespace implementation {
 
 using ::android::hardware::Return;
@@ -46,6 +50,7 @@
 
   Return<Status> reset() override;
 
+  Return<void> getUsbSpeed(const sp<V1_2::IUsbGadgetCallback>& callback) override;
 private:
   V1_0::Status tearDownGadget();
   V1_0::Status setupFunctions(uint64_t functions,
@@ -63,10 +68,10 @@
 };
 
 }  // namespace implementation
-}  // namespace V1_1
+}  // namespace V1_2
 }  // namespace gadget
 }  // namespace usb
 }  // namespace hardware
 }  // namespace android
 
-#endif  // ANDROID_HARDWARE_USB_V1_1_USBGADGET_H
+#endif  // ANDROID_HARDWARE_USB_V1_2_USBGADGET_H
diff --git a/hal/android.hardware.usb.gadget@1.1-service-qti.rc b/hal/android.hardware.usb.gadget@1.1-service-qti.rc
deleted file mode 100644
index 1226d67..0000000
--- a/hal/android.hardware.usb.gadget@1.1-service-qti.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-service vendor.usbgadget-hal-1-1 /vendor/bin/hw/android.hardware.usb.gadget@1.1-service-qti
-    class hal
-    user root
-    group root system mtp
diff --git a/hal/android.hardware.usb.gadget@1.2-service-qti.rc b/hal/android.hardware.usb.gadget@1.2-service-qti.rc
new file mode 100644
index 0000000..ab7df95
--- /dev/null
+++ b/hal/android.hardware.usb.gadget@1.2-service-qti.rc
@@ -0,0 +1,7 @@
+# Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause-Clear
+#
+service vendor.usbgadget-hal-1-2 /vendor/bin/hw/android.hardware.usb.gadget@1.2-service-qti
+    class hal
+    user root
+    group root system mtp
diff --git a/hal/android.hardware.usb.gadget@1.1-service.xml b/hal/android.hardware.usb.gadget@1.2-service.xml
similarity index 86%
rename from hal/android.hardware.usb.gadget@1.1-service.xml
rename to hal/android.hardware.usb.gadget@1.2-service.xml
index b03c6df..5ae9e0f 100644
--- a/hal/android.hardware.usb.gadget@1.1-service.xml
+++ b/hal/android.hardware.usb.gadget@1.2-service.xml
@@ -24,16 +24,20 @@
 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Changes from Qualcomm Innovation Center are provided under the following license:
+Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+SPDX-License-Identifier: BSD-3-Clause-Clear
 -->
 <manifest version="1.0" type="device">
     <hal format="hidl">
         <name>android.hardware.usb.gadget</name>
         <transport>hwbinder</transport>
-        <version>1.1</version>
+        <version>1.2</version>
         <interface>
             <name>IUsbGadget</name>
             <instance>default</instance>
         </interface>
-        <fqname>@1.1::IUsbGadget/default</fqname>
+        <fqname>@1.2::IUsbGadget/default</fqname>
     </hal>
 </manifest>
diff --git a/hal/usb_compositions.conf b/hal/usb_compositions.conf
index 211faaf..89b7840 100644
--- a/hal/usb_compositions.conf
+++ b/hal/usb_compositions.conf
@@ -61,6 +61,7 @@
 rndis,diag,qdss,serial_cdev,dpl						0x05C6	0x90E8
 rndis,diag,qdss,serial_cdev,dpl,adb					0x05C6	0x90E9
 diag,diag_mdm,adb							0x05C6	0x90D9
+diag,diag_cnss,adb							0x05C6  0x90D9  diag,diag_mdm2,adb
 diag,diag_mdm,diag_mdm2,qdss,qdss_mdm,serial_cdev,dpl,rmnet		0x05C6	0x90F6
 diag,diag_mdm,diag_mdm2,qdss,qdss_mdm,serial_cdev,dpl,rmnet,adb		0x05C6	0x90F7
 rndis,diag,diag_mdm,diag_mdm2,qdss,qdss_mdm,serial_cdev,dpl		0x05C6	0x90F8
@@ -70,4 +71,4 @@
 diag,qdss,dpl,adb							0x05C6	0x9104
 diag,dpl								0x05C6	0x9105
 diag,diag_cnss,serial_cdev,rmnet,dpl,qdss,adb				0x05C6	0x9110
-diag,diag_cnss,serial_cdev,rmnet,dpl,qdss				0x05C6	0x9111
\ No newline at end of file
+diag,diag_cnss,serial_cdev,rmnet,dpl,qdss				0x05C6	0x9111
diff --git a/vendor_product.mk b/vendor_product.mk
index adfad21..674cf8b 100644
--- a/vendor_product.mk
+++ b/vendor_product.mk
@@ -2,7 +2,12 @@
 # Default property overrides for various function configurations
 # These can be further overridden at runtime in init*.rc files as needed
 #
+ifneq ($(filter anorak,$(TARGET_BOARD_PLATFORM)),)
+PRODUCT_PROPERTY_OVERRIDES += vendor.usb.rndis.func.name=rndis
+else
 PRODUCT_PROPERTY_OVERRIDES += vendor.usb.rndis.func.name=gsi
+endif
+
 PRODUCT_PROPERTY_OVERRIDES += vendor.usb.rmnet.func.name=gsi
 PRODUCT_PROPERTY_OVERRIDES += vendor.usb.rmnet.inst.name=rmnet
 PRODUCT_PROPERTY_OVERRIDES += vendor.usb.dpl.inst.name=dpl
@@ -19,7 +24,7 @@
 endif
 
 # QDSS uses SW path on these targets
-ifneq ($(filter lahaina taro bengal kalama monaco kona crow trinket,$(TARGET_BOARD_PLATFORM)),)
+ifneq ($(filter lahaina taro parrot neo anorak ravelin bengal kalama monaco kona crow trinket,$(TARGET_BOARD_PLATFORM)),)
   PRODUCT_PROPERTY_OVERRIDES += vendor.usb.qdss.inst.name=qdss_sw
 else
   PRODUCT_PROPERTY_OVERRIDES += vendor.usb.qdss.inst.name=qdss
@@ -57,9 +62,9 @@
   # USB Gadget HAL is enabled on newer targets and takes the place
   # of the init-based configfs rules for setting USB compositions
   #
-  ifneq ($(filter taro kalama bengal monaco kona crow trinket,$(TARGET_BOARD_PLATFORM)),)
+  ifneq ($(filter taro kalama neo parrot anorak bengal monaco kona crow trinket,$(TARGET_BOARD_PLATFORM)),)
     PRODUCT_PROPERTY_OVERRIDES += vendor.usb.use_gadget_hal=1
-    PRODUCT_PACKAGES += android.hardware.usb.gadget@1.1-service-qti
+    PRODUCT_PACKAGES += android.hardware.usb.gadget@1.2-service-qti
     PRODUCT_PACKAGES += usb_compositions.conf
   else
     PRODUCT_PROPERTY_OVERRIDES += vendor.usb.use_gadget_hal=0