This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
msm7x30_check_pin.patch
59 lines (58 loc) · 1.9 KB
/
msm7x30_check_pin.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
diff --git a/combinedroot/init.sh b/combinedroot/init.sh
index e4dda96..e3862c6 100644
--- a/combinedroot/init.sh
+++ b/combinedroot/init.sh
@@ -52,15 +52,41 @@ busybox sleep 3
# android ramdisk
load_image=/sbin/ramdisk.cpio
+# setup pincode
+busybox mkdir -p /cache/pin
+busybox chmod -R 770 /cache/pin
+busybox chown -R root:system /cache/pin
+
+# offline charging?
+charging=0
+bootreason=`busybox cat /proc/cmdline | busybox tr ' ' '\n' | busybox grep startup | busybox awk -F '=' {'print $2'}`
+if [ "${bootreason}" = "0x00000020" ]; then
+ charging=1
+fi
+busybox echo "${charging}" >/cache/pin/charging
+
+# pincode check?
+checkpin=N
+if [ -e /cache/pin/code -a ! -e /cache/pin/ok -a "${charging}" = "0" ]; then
+ checkpin=Y
+fi
+
# boot decision
-if [ -s /dev/keycheck -o -e /cache/recovery/boot ]
+if [ -s /dev/keycheck -o -e /cache/recovery/boot -o "${checkpin}" = "Y" ]
then
busybox echo 'RECOVERY BOOT' >>boot.txt
busybox rm -fr /cache/recovery/boot
- # trigger blue led
- busybox echo 0 > ${BOOTREC_LED_RED}/brightness
- busybox echo 0 > ${BOOTREC_LED_GREEN}/brightness
- busybox echo 255 > ${BOOTREC_LED_BLUE}/brightness
+ if [ "${checkpin}" = "Y" ]; then
+ # trigger red led
+ busybox echo 255 > ${BOOTREC_LED_RED}/brightness
+ busybox echo 0 > ${BOOTREC_LED_GREEN}/brightness
+ busybox echo 0 > ${BOOTREC_LED_BLUE}/brightness
+ else
+ # trigger blue led
+ busybox echo 0 > ${BOOTREC_LED_RED}/brightness
+ busybox echo 0 > ${BOOTREC_LED_GREEN}/brightness
+ busybox echo 255 > ${BOOTREC_LED_BLUE}/brightness
+ fi
busybox echo 0 > ${BOOTREC_LED_BUTTONS}/brightness
busybox echo 0 > ${BOOTREC_LED_BUTTONS2}/brightness
# framebuffer fix
@@ -69,6 +95,7 @@ then
load_image=/sbin/ramdisk-recovery.cpio
else
busybox echo 'ANDROID BOOT' >>boot.txt
+ busybox rm -f /cache/pin/ok
# poweroff LED & button-backlight
busybox echo 0 > ${BOOTREC_LED_RED}/brightness
busybox echo 0 > ${BOOTREC_LED_GREEN}/brightness