From: Tim Zimmermann Date: Thu, 22 Feb 2024 05:40:02 +0000 (+0100) Subject: aidl: usb: gadget: Make gadget name configurable through soong X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7e0a367d85322dd3cafab87220cd12716f70937c;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung.git aidl: usb: gadget: Make gadget name configurable through soong Change-Id: Ic91598d8ddee0f9254354786b7598e9f7377008d --- diff --git a/aidl/usb/gadget/Android.bp b/aidl/usb/gadget/Android.bp index 76e5fa9..5b84ad6 100644 --- a/aidl/usb/gadget/Android.bp +++ b/aidl/usb/gadget/Android.bp @@ -14,8 +14,26 @@ // See the License for the specific language governing permissions and // limitations under the License. +soong_config_module_type { + name: "gadget_name", + module_type: "cc_defaults", + config_namespace: "samsungUsbGadgetVars", + value_variables: ["gadget_name"], + properties: ["cppflags"], +} + +gadget_name { + name: "gadget_name_defaults", + soong_config_variables: { + gadget_name: { + cppflags: ["-DGADGET_NAME=\"%s\""], + }, + }, +} + cc_binary { name: "android.hardware.usb.gadget-service.samsung", + defaults: ["gadget_name_defaults"], relative_install_path: "hw", init_rc: ["android.hardware.usb.gadget-service.samsung.rc"], vintf_fragments: [ diff --git a/aidl/usb/gadget/UsbGadget.h b/aidl/usb/gadget/UsbGadget.h index 8ddd03a..8d46f69 100644 --- a/aidl/usb/gadget/UsbGadget.h +++ b/aidl/usb/gadget/UsbGadget.h @@ -67,9 +67,9 @@ using ::ndk::ScopedAStatus; using ::std::shared_ptr; using ::std::string; -constexpr char kGadgetName[] = "10c00000.dwc3"; +constexpr char kGadgetName[] = GADGET_NAME; #ifndef UDC_PATH -#define UDC_PATH "/sys/class/udc/10c00000.dwc3/" +#define UDC_PATH "/sys/class/udc/" GADGET_NAME "/" #endif static MonitorFfs monitorFfs(kGadgetName);