diff --git a/manifest.xml b/manifest.xml index 26f64f09..664293d1 100755 --- a/manifest.xml +++ b/manifest.xml @@ -70,11 +70,6 @@ hwbinder @2.3::ISoundTriggerHw/default - - android.hardware.usb - hwbinder - @1.0::IUsb/default - android.hardware.tetheroffload.config hwbinder diff --git a/sdm660.mk b/sdm660.mk index 2dd86137..b6d0b175 100644 --- a/sdm660.mk +++ b/sdm660.mk @@ -584,7 +584,7 @@ PRODUCT_COPY_FILES += \ # USB PRODUCT_PACKAGES += \ - android.hardware.usb@1.0-service.xiaomi_sdm660 + android.hardware.usb@1.0-service.basic PRODUCT_PACKAGES += \ init.qcom.usb.rc \ diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index d341a2af..c2fb27b3 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -89,9 +89,6 @@ /data/vendor/thermal(/.*)? u:object_r:thermal_data_file:s0 /(vendor|system/vendor)/bin/hw/android\.hardware\.thermal@2\.0-service\.mock u:object_r:hal_thermal_default_exec:s0 -# USB -/(vendor|system/vendor)/bin/hw/android\.hardware\.usb@1\.0-service\.xiaomi_sdm660 u:object_r:hal_usb_default_exec:s0 - # Video4linux sysfs nodes /sys/devices/platform/soc/caa0000\.qcom,jpeg/video4linux/video1(/.*)? u:object_r:sysfs_graphics:s0 diff --git a/usb/Android.bp b/usb/Android.bp deleted file mode 100644 index 3a0d3cd2..00000000 --- a/usb/Android.bp +++ /dev/null @@ -1,21 +0,0 @@ -// -// Copyright (C) 2017 The LineageOS Project -// -// SPDX-License-Identifier: Apache-2.0 -// - -cc_binary { - name: "android.hardware.usb@1.0-service.xiaomi_sdm660", - relative_install_path: "hw", - init_rc: ["android.hardware.usb@1.0-service.xiaomi_sdm660.rc"], - srcs: ["service.cpp", "Usb.cpp"], - shared_libs: [ - "libbase", - "libcutils", - "libhidlbase", - "libutils", - "libhardware", - "android.hardware.usb@1.0", - ], - proprietary: true, -} diff --git a/usb/Usb.cpp b/usb/Usb.cpp deleted file mode 100644 index d9de9d6c..00000000 --- a/usb/Usb.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2017 The LineageOS 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. - */ -#include -#include -#include -#include - -#include -#include -#include - -#include "Usb.h" - -namespace android { -namespace hardware { -namespace usb { -namespace V1_0 { -namespace implementation { - -Return Usb::switchRole(const hidl_string &portName __unused, - const PortRole &newRole __unused) { - LOG(ERROR) << __func__ << ": Not supported"; - return Void(); -} - -Return Usb::queryPortStatus() { - hidl_vec currentPortStatus; - currentPortStatus.resize(1); - - currentPortStatus[0].portName = "otg_default"; - currentPortStatus[0].currentDataRole = PortDataRole::DEVICE; - currentPortStatus[0].currentPowerRole = PortPowerRole::SINK; - currentPortStatus[0].currentMode = PortMode::UFP; - currentPortStatus[0].canChangeMode = false; - currentPortStatus[0].canChangeDataRole = false; - currentPortStatus[0].canChangePowerRole = false; - currentPortStatus[0].supportedModes = PortMode::UFP; - - pthread_mutex_lock(&mLock); - if (mCallback != NULL) { - Return ret = - mCallback->notifyPortStatusChange(currentPortStatus, Status::SUCCESS); - if (!ret.isOk()) { - LOG(ERROR) << "queryPortStatus error " << ret.description(); - } - } else { - LOG(INFO) << "Notifying userspace skipped. Callback is NULL"; - } - pthread_mutex_unlock(&mLock); - - return Void(); -} - -Return Usb::setCallback(const sp &callback) { - pthread_mutex_lock(&mLock); - - mCallback = callback; - LOG(INFO) << "registering callback"; - - pthread_mutex_unlock(&mLock); - return Void(); -} - -} // namespace implementation -} // namespace V1_0 -} // namespace usb -} // namespace hardware -} // namespace android diff --git a/usb/Usb.h b/usb/Usb.h deleted file mode 100644 index 364da819..00000000 --- a/usb/Usb.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef ANDROID_HARDWARE_USB_V1_0_USB_H -#define ANDROID_HARDWARE_USB_V1_0_USB_H - -#include -#include -#include -#include - -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "android.hardware.usb@1.0-service.xiaomi_sdm660" -#define UEVENT_MSG_LEN 2048 - -namespace android { -namespace hardware { -namespace usb { -namespace V1_0 { -namespace implementation { - -using ::android::hardware::usb::V1_0::IUsb; -using ::android::hardware::usb::V1_0::IUsbCallback; -using ::android::hardware::usb::V1_0::PortRole; -using ::android::hidl::base::V1_0::IBase; -using ::android::hardware::hidl_array; -using ::android::hardware::hidl_memory; -using ::android::hardware::hidl_string; -using ::android::hardware::hidl_vec; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::sp; - -struct Usb : public IUsb { - Return switchRole(const hidl_string& portName, const PortRole& role) override; - Return setCallback(const sp& callback) override; - Return queryPortStatus() override; - - sp mCallback; - pthread_mutex_t mLock = PTHREAD_MUTEX_INITIALIZER; -}; - -} // namespace implementation -} // namespace V1_0 -} // namespace usb -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_USB_V1_0_USB_H diff --git a/usb/android.hardware.usb@1.0-service.xiaomi_sdm660.rc b/usb/android.hardware.usb@1.0-service.xiaomi_sdm660.rc deleted file mode 100644 index 6b61b8e3..00000000 --- a/usb/android.hardware.usb@1.0-service.xiaomi_sdm660.rc +++ /dev/null @@ -1,4 +0,0 @@ -service usb-hal-1-0 /vendor/bin/hw/android.hardware.usb@1.0-service.xiaomi_sdm660 - class hal - user system - group system diff --git a/usb/service.cpp b/usb/service.cpp deleted file mode 100644 index 862783df..00000000 --- a/usb/service.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2017 The LineageOS jProject - * - * 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. - */ - -#include -#include -#include "Usb.h" - -using android::sp; - -// libhwbinder: -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; - -// Generated HIDL files -using android::hardware::usb::V1_0::IUsb; -using android::hardware::usb::V1_0::implementation::Usb; - -int main() { - android::sp service = new Usb(); - - configureRpcThreadpool(1, true /*callerWillJoin*/); - android::status_t status = service->registerAsService(); - - if (status != android::OK) { - LOG(ERROR) << "Cannot register USB HAL service"; - return 1; - } - - LOG(INFO) << "USB HAL Ready."; - joinRpcThreadpool(); - // Under noraml cases, execution will not reach this line. - LOG(ERROR) << "USB HAL failed to join thread pool."; - return 1; -}