usb: convert gadget hal to aidl

* Based on hardware/interfaces/usb/gadget/aidl/default.
This commit is contained in:
Konsta
2024-11-16 18:10:05 +02:00
parent a91af8e006
commit cab82fc38b
13 changed files with 191 additions and 218 deletions

View File

@@ -1,30 +1,10 @@
/*
* Copyright (C) 2020 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.
*/
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["hardware_interfaces_license"],
}
// Copyright (C) 2020 The Android Open Source Project
// Copyright (C) 2024 KonstaKANG
//
// SPDX-License-Identifier: Apache-2.0
cc_library_static {
name: "libusbconfigfs-2",
name: "libusbconfigfs-rpi",
vendor_available: true,
export_include_dirs: ["include"],
@@ -39,9 +19,7 @@ cc_library_static {
],
shared_libs: [
"android.hardware.usb.gadget@1.0",
"android.hardware.usb.gadget@1.1",
"android.hardware.usb.gadget@1.2",
"android.hardware.usb.gadget-V1-ndk",
"libbase",
"libcutils",
"libhidlbase",

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 The Android Open Source Project
* Copyright (C) 2024 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
#include "include/UsbGadgetCommon.h"
namespace aidl {
namespace android {
namespace hardware {
namespace usb {
@@ -267,3 +269,4 @@ void MonitorFfs::registerFunctionsAppliedCallback(void (*callback)(bool function
} // namespace usb
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 The Android Open Source Project
* Copyright (C) 2024 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
#include "include/UsbGadgetCommon.h"
namespace aidl {
namespace android {
namespace hardware {
namespace usb {
@@ -205,3 +207,4 @@ Status addAdb(MonitorFfs* monitorFfs, int* functionCount) {
} // namespace usb
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 The Android Open Source Project
* Copyright (C) 2024 KonstaKANG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +22,8 @@
#include <android-base/properties.h>
#include <android-base/unique_fd.h>
#include <android/hardware/usb/gadget/1.2/IUsbGadget.h>
#include <android/hardware/usb/gadget/1.2/types.h>
#include <aidl/android/hardware/usb/gadget/IUsbGadget.h>
#include <aidl/android/hardware/usb/gadget/GadgetFunction.h>
#include <dirent.h>
#include <fcntl.h>
@@ -41,6 +42,7 @@
#include <string>
#include <thread>
namespace aidl {
namespace android {
namespace hardware {
namespace usb {
@@ -79,8 +81,8 @@ using ::android::base::GetProperty;
using ::android::base::SetProperty;
using ::android::base::unique_fd;
using ::android::base::WriteStringToFile;
using ::android::hardware::usb::gadget::V1_0::Status;
using ::android::hardware::usb::gadget::V1_2::GadgetFunction;
using ::aidl::android::hardware::usb::gadget::GadgetFunction;
using ::aidl::android::hardware::usb::gadget::Status;
using ::std::lock_guard;
using ::std::move;
@@ -176,4 +178,5 @@ Status resetGadget();
} // namespace usb
} // namespace hardware
} // namespace android
} // namespace aidl
#endif