Created
February 3, 2018 00:40
-
-
Save npjohnson/c4752fb7e43f04db889a55b6b080835e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From c89c0e55f900284842ed52fb7ab51b71869d2dbc Mon Sep 17 00:00:00 2001 | |
From: Nolen Johnson <johnsonnolen@gmail.com> | |
Date: Fri, 2 Feb 2018 19:35:49 -0500 | |
Subject: [PATCH] nash: Add Moto Mod hotplug support | |
* This is hackier than I'd like, but should do the job. | |
Change-Id: I7db290013782cfd280ab0fc2fae8dd17a29de186 | |
--- | |
rootdir/Android.mk | 8 ++++++++ | |
rootdir/bin/init.mods.sh | 8 ++++++++ | |
rootdir/etc/init.mods.rc | 14 ++++++++++++++ | |
3 files changed, 30 insertions(+) | |
create mode 100644 rootdir/bin/init.mods.sh | |
diff --git a/rootdir/Android.mk b/rootdir/Android.mk | |
index 6ba6fd1..9e27cf3 100644 | |
--- a/rootdir/Android.mk | |
+++ b/rootdir/Android.mk | |
@@ -20,6 +20,14 @@ LOCAL_VENDOR_MODULE := true | |
include $(BUILD_PREBUILT) | |
include $(CLEAR_VARS) | |
+LOCAL_MODULE := init.mods.sh | |
+LOCAL_MODULE_TAGS := optional eng | |
+LOCAL_MODULE_CLASS := EXECUTABLES | |
+LOCAL_SRC_FILES := bin/init.mods.sh | |
+LOCAL_VENDOR_MODULE := true | |
+include $(BUILD_PREBUILT) | |
+ | |
+include $(CLEAR_VARS) | |
LOCAL_MODULE := init.mmi.charge_only.rc | |
LOCAL_MODULE_TAGS := optional eng | |
LOCAL_MODULE_CLASS := ETC | |
diff --git a/rootdir/bin/init.mods.sh b/rootdir/bin/init.mods.sh | |
new file mode 100644 | |
index 0000000..e7d1dfb | |
--- /dev/null | |
+++ b/rootdir/bin/init.mods.sh | |
@@ -0,0 +1,8 @@ | |
+#!/vendor/bin/sh | |
+modconnection=$(getprop sys.mod.connected 2> /dev/null) | |
+ | |
+if [ "$modcopnnection" == "1" ] || [ "$modconnection" = "0" ]; then | |
+ killall com.motorola.modservice | |
+ return 0 | |
+fi | |
+ | |
diff --git a/rootdir/etc/init.mods.rc b/rootdir/etc/init.mods.rc | |
index ac690ed..7e47d0c 100644 | |
--- a/rootdir/etc/init.mods.rc | |
+++ b/rootdir/etc/init.mods.rc | |
@@ -17,3 +17,17 @@ service gbmodinstall /vendor/bin/init.gbmods.sh | |
oneshot | |
disabled | |
+service moddetect /vendor/bin/init.mods.sh | |
+ user root | |
+ oneshot | |
+ disabled | |
+ | |
+on property:sys.mod.connected=1 | |
+ write /sys/module/greybus/holders/gb_mods/drivers/platform:muc_svc/soc:muc_svc@0/forcedetect 1 | |
+ write /sys/module/greybus/holders/gb_mods/drivers/platform:muc_svc/soc:muc_svc@0/mods_interfaces/3/hotplug 1 | |
+ restart moddetect | |
+ | |
+on property:sys.mod.connected=0 | |
+ write /sys/module/greybus/holders/gb_mods/drivers/platform:muc_svc/soc:muc_svc@0/forcedetect 1 | |
+ write /sys/module/greybus/holders/gb_mods/drivers/platform:muc_svc/soc:muc_svc@0/mods_interfaces/3/hotplug 1 | |
+ restart moddetect | |
-- | |
2.7.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment