aidl: usb: gadget: Make gadget name configurable through soong
authorTim Zimmermann <tim@linux4.de>
Thu, 22 Feb 2024 05:40:02 +0000 (06:40 +0100)
committerJan Altensen (Stricted) <info@stricted.net>
Fri, 21 Jun 2024 04:02:30 +0000 (04:02 +0000)
Change-Id: Ic91598d8ddee0f9254354786b7598e9f7377008d

aidl/usb/gadget/Android.bp
aidl/usb/gadget/UsbGadget.h

index 76e5fa91cae473a388ebd5524360a80d70e01173..5b84ad67cfa0374437955dada15724511c2469ce 100644 (file)
 // 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: [
index 8ddd03a11daa13bba809203641f2cad07e4db4e8..8d46f69104e203e9adb4efe12557a4640a9e9722 100644 (file)
@@ -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);