commit f2bb12973675d86526cdf5e815b9314b8d51a3e0
Author: Nicklas Ekstrand
Date: Tue Jun 7 22:04:49 2016 +0200
Added serivce nicklas
Change-Id: I4eff38d220b5d8bcab7f59ebcede7e7ffe90b02c
diff --git a/rootdir/init.rc b/rootdir/init.rc
index ea2b009..172d02e 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -639,3 +639,9 @@ service pre-recovery /system/bin/uncrypt
class main
disabled
oneshot
+
+service nicklas /system/bin/nicklas
+ class main
+ enabled
+ oneshot
nicklas.c:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void mywrite (int x)
{
FILE *fp = fopen("/sys/class/leds/led3/brightness","w");
if (fp != NULL)
{
fprintf(fp, "%d",x);
fclose(fp);
}
}
int main (int argc, char* argv[])
{
printf ("Nicklas!\n");
while (1){
mywrite(255);
usleep(100000);
mywrite(0);
usleep(100000);
}
return 0;
}
Compile:
~/android/my64/bin/aarch64-linux-android-gcc -Wall -pedantic nicklas.c -o nicklas -static
No comments:
Post a Comment