Add Wifi/BT config to Auto USB pass-through am: 5c5c7ca3d6
Original change: https://googleplex-android-review.googlesource.com/c/device/generic/car/+/20513918
Change-Id: I2d2ac77a68f84cf67f86a2e961d04c52c859a634
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/emulator/usbpt/BoardConfig.mk b/emulator/usbpt/BoardConfig.mk
index ea43a0b..cb12a62 100644
--- a/emulator/usbpt/BoardConfig.mk
+++ b/emulator/usbpt/BoardConfig.mk
@@ -14,3 +14,4 @@
#
include device/generic/car/emulator/usbpt/bluetooth/BoardConfig.mk
+include device/generic/car/emulator/usbpt/wifi/BoardConfig.mk
\ No newline at end of file
diff --git a/emulator/usbpt/bluetooth/bluetooth.mk b/emulator/usbpt/bluetooth/bluetooth.mk
index 935097f..de87874 100644
--- a/emulator/usbpt/bluetooth/bluetooth.mk
+++ b/emulator/usbpt/bluetooth/bluetooth.mk
@@ -21,7 +21,6 @@
PRODUCT_COPY_FILES += \
device/generic/car/emulator/usbpt/bluetooth/vendor.qemu.preferred.bt.service.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/vendor.qemu.preferred.bt.service.rc \
- device/generic/car/emulator/usbpt/bluetooth/modules.blocklist:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/lib/modules/modules.blocklist \
PRODUCT_SYSTEM_PROPERTIES += \
persist.bluetooth.enablenewavrcp=false \
diff --git a/emulator/usbpt/bluetooth/btusb/init.btusb.rc b/emulator/usbpt/bluetooth/btusb/init.btusb.rc
index 4603f83..55b5160 100644
--- a/emulator/usbpt/bluetooth/btusb/init.btusb.rc
+++ b/emulator/usbpt/bluetooth/btusb/init.btusb.rc
@@ -1,3 +1,17 @@
+# Copyright (C) 2022 The Android Open-Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
on early-init
write /sys/module/firmware_class/parameters/path /vendor/firmware/
diff --git a/emulator/usbpt/bluetooth/modules.blocklist b/emulator/usbpt/bluetooth/modules.blocklist
deleted file mode 100644
index 5816cd8..0000000
--- a/emulator/usbpt/bluetooth/modules.blocklist
+++ /dev/null
@@ -1,2 +0,0 @@
-# List of sub-device specific modules to not load automatically
-blocklist btusb.ko
diff --git a/emulator/usbpt/car_usbpt.mk b/emulator/usbpt/car_usbpt.mk
index 922c5b3..e0e24bc 100644
--- a/emulator/usbpt/car_usbpt.mk
+++ b/emulator/usbpt/car_usbpt.mk
@@ -16,7 +16,9 @@
$(call inherit-product, device/generic/car/emulator/usbpt/bluetooth/bluetooth.mk)
$(call inherit-product, device/generic/car/emulator/usbpt/protocan/protocan.mk)
$(call inherit-product, device/generic/car/emulator/usbpt/usbip-service/usbip-service.mk)
+$(call inherit-product, device/generic/car/emulator/usbpt/wifi/wifi.mk)
# Required for USB passthrough
PRODUCT_COPY_FILES += \
- frameworks/native/data/etc/android.hardware.usb.host.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.host.xml
+ frameworks/native/data/etc/android.hardware.usb.host.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.host.xml \
+ device/generic/car/emulator/usbpt/modules.blocklist:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/lib/modules/modules.blocklist \
diff --git a/emulator/usbpt/modules.blocklist b/emulator/usbpt/modules.blocklist
new file mode 100644
index 0000000..34559e0
--- /dev/null
+++ b/emulator/usbpt/modules.blocklist
@@ -0,0 +1,10 @@
+# List of sub-device specific modules to not load automatically
+blocklist btusb.ko
+blocklist mt76x2u.ko
+blocklist mt76x2_common.ko
+blocklist mt76x0u.ko
+blocklist mt76x02_usb.ko
+blocklist mt76x0_common.ko
+blocklist mt76x02_lib.ko
+blocklist mt76_usb.ko
+blocklist mt76.ko
diff --git a/emulator/usbpt/wifi/BoardConfig.mk b/emulator/usbpt/wifi/BoardConfig.mk
new file mode 100644
index 0000000..d9c4874
--- /dev/null
+++ b/emulator/usbpt/wifi/BoardConfig.mk
@@ -0,0 +1,34 @@
+# Copyright (C) 2022 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+#
+
+ifeq ($(TARGET_ARCH),x86_64)
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/x86-64/mt76x2u.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/x86-64/mt76x2-common.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/x86-64/mt76x0u.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/x86-64/mt76x02-usb.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/x86-64/mt76x0-common.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/x86-64/mt76x02-lib.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/x86-64/mt76-usb.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/x86-64/mt76.ko
+else ifeq ($(TARGET_ARCH),arm64)
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/arm64/mt76x2u.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/arm64/mt76x2u-common.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/arm64/mt76x0u.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/arm64/mt76x02-usb.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/arm64/mt76x0-common.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/arm64/mt76x02-lib.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/arm64/mt76-usb.ko
+BOARD_VENDOR_KERNEL_MODULES += kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/arm64/mt76.ko
+endif
diff --git a/emulator/usbpt/wifi/init.wifiusb.rc b/emulator/usbpt/wifi/init.wifiusb.rc
new file mode 100644
index 0000000..860a9b5
--- /dev/null
+++ b/emulator/usbpt/wifi/init.wifiusb.rc
@@ -0,0 +1,19 @@
+# Copyright (C) 2022 The Android Open-Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
+on early-init
+ write /sys/module/firmware_class/parameters/path /vendor/firmware/
+
+on boot
+ exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -a -d /vendor/lib/modules mt76x2u.ko mt76x2_common.ko mt76x0u.ko mt76x02_usb.ko mt76x0_common.ko mt76x02_lib.ko mt76_usb.ko mt76.ko
diff --git a/emulator/usbpt/wifi/wifi.mk b/emulator/usbpt/wifi/wifi.mk
new file mode 100644
index 0000000..e2da0f9
--- /dev/null
+++ b/emulator/usbpt/wifi/wifi.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2022 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
+PRODUCT_COPY_FILES += \
+ device/generic/car/emulator/usbpt/wifi/init.wifiusb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.wifiusb.rc \