aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspv <spv@spv.sh>2025-09-21 01:10:56 -0400
committerspv <spv@spv.sh>2025-09-21 01:10:56 -0400
commit123f27f0d256121ab3ea9278161c2147d7200af2 (patch)
tree14ff7a051ce8419fa7243f258c2c02aef7377780
parent02a74cc0b499f6a93c25ea8cd392af977298d60a (diff)
wip magisk module
-rw-r--r--Makefile26
-rw-r--r--README4
-rw-r--r--res/module.prop6
-rw-r--r--src/service.sh3
4 files changed, 34 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index def9342..78e2551 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
CC=arm-linux-gnueabi-gcc
-all: bin bin/kblightd
+all: bin bin/kblightd bin/kblightd_magisk.zip
clean:
rm -rf bin
@@ -11,16 +11,16 @@ bin:
bin/kblightd: src/main.c src/keypress_thread.c src/light_thread.c src/backlight.c
${CC} -static $^ -o $@
-run_prep:
+adb_prep:
adb root
-run: all run_prep
+run: all adb_prep
make kill
adb push bin/kblightd /sbin/
adb shell "nohup /sbin/kblightd > /dev/null &" &
-debug: all run_prep
+debug: all adb_prep
make kill
adb push bin/kblightd /sbin/
@@ -28,3 +28,21 @@ debug: all run_prep
kill: all
adb shell -x pkill kblightd
+
+bin/kblightd_magisk.zip: bin bin/kblightd src/service.sh res/module.prop
+ mkdir -p bin/magisk
+
+ cp -p bin/kblightd bin/magisk/
+ cp -p src/service.sh bin/magisk
+ cp -p res/module.prop bin/magisk
+
+ cd bin/magisk; zip -r ../../$@ .
+
+module: bin/kblightd_magisk.zip
+
+install: module adb_prep
+ adb push bin/kblightd_magisk.zip /sdcard/
+ adb shell magisk --install-module /sdcard/kblightd_magisk.zip
+ adb shell rm /sdcard/kblightd_magisk.zip
+
+ echo 'done!'
diff --git a/README b/README
index 6477482..cdf6344 100644
--- a/README
+++ b/README
@@ -12,7 +12,9 @@ roadmap
[x] signals for ipc
-[ ] magisk module
+[x] magisk module
+
+[ ] config file in /data/???
license
-------
diff --git a/res/module.prop b/res/module.prop
new file mode 100644
index 0000000..5bf6cb6
--- /dev/null
+++ b/res/module.prop
@@ -0,0 +1,6 @@
+id=sh.spv.kblightd
+name=kblightd
+version=1.0.0
+versionCode=0
+author=spv@spv.sh
+description=cat s22 kb light daemon
diff --git a/src/service.sh b/src/service.sh
new file mode 100644
index 0000000..e88e6b3
--- /dev/null
+++ b/src/service.sh
@@ -0,0 +1,3 @@
+cp data/adb/modules/sh.spv.kblightd/kblightd /sbin/kblightd
+chmod 700 /sbin/kblightd
+exec /sbin/kblightd