File tree Expand file tree Collapse file tree 2 files changed +89
-6
lines changed Expand file tree Collapse file tree 2 files changed +89
-6
lines changed Original file line number Diff line number Diff line change 1+ [
2+ {
3+ "action" : " 背光设置" ,
4+ "type" : " group" ,
5+ "nodes" : [
6+ {
7+ "action" : " 背光熄灭" ,
8+ "type" : " command" ,
9+ "command_name" : " rlease_backlight" ,
10+ "result_messages" : [
11+ {
12+ "message" : " 执行成功" ,
13+ "code" : 0
14+ },
15+ {
16+ "message" : " 执行失败" ,
17+ "code" : -1
18+ }
19+ ]
20+ },
21+ {
22+ "action" : " 背光长亮" ,
23+ "type" : " command" ,
24+ "command_name" : " lock_backlight" ,
25+ "result_messages" : [
26+ {
27+ "message" : " 执行成功" ,
28+ "code" : 0
29+ },
30+ {
31+ "message" : " 执行失败" ,
32+ "code" : -1
33+ }
34+ ]
35+ }
36+ ]
37+ },
38+ {
39+ "action" : " 开启背光" ,
40+ "type" : " command" ,
41+ "command_name" : " backlight_on" ,
42+ "result_messages" : [
43+ {
44+ "message" : " 执行成功" ,
45+ "code" : 0
46+ },
47+ {
48+ "message" : " 执行失败" ,
49+ "code" : -1
50+ }
51+ ]
52+ },
53+ {
54+ "action" : " 关闭背光" ,
55+ "type" : " command" ,
56+ "command_name" : " backlight_off" ,
57+ "result_messages" : [
58+ {
59+ "message" : " 执行成功" ,
60+ "code" : 0
61+ },
62+ {
63+ "message" : " 执行失败" ,
64+ "code" : -1
65+ }
66+ ]
67+ }
68+ ]
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ PID_FILE="$CURWDIR/$PROGRAM_NAME.pid"
1717PKILL_BIN=" /usr/bin/pkill"
1818INSTALL_BIN=" /usr/bin/install"
1919REMOVE=" /bin/rm -f"
20+ LUA_BIN=" /system/bin/lua"
21+ LUA_SCRIPT_PATH=" /system/share/lua/5.1/tp_entry.lua"
2022
2123usage () {
2224 echo " ERROR: action missing"
@@ -53,14 +55,23 @@ uninstall() {
5355 $REMOVE " $LAUNCHER_CONFIG_FILE "
5456}
5557
56- relase_backlight () {
57- RC = $( lua /system/share/lua/5.1/tp_entry.lua sys_api.release_backlight)
58- echo $RC
58+ release_backlight () {
59+ RC= $( $LUA_BIN $LUA_SCRIPT_PATH sys_api.release_backlight)
60+ echo -n $RC
5961}
6062
6163lock_backlight () {
62- RC = $( lua /system/share/lua/5.1/tp_entry.lua sys_api.lock_backlight)
63- echo $RC
64+ RC=$( $LUA_BIN $LUA_SCRIPT_PATH sys_api.lock_backlight)
65+ echo -n $RC
66+ }
67+
68+ backlight_on () {
69+ RC=$( $LUA_BIN $LUA_SCRIPT_PATH sys_api.wakeup_backlight)
70+ echo -n $RC
71+ }
72+
73+ backlight_off () {
74+ echo -n ' {"msg": "falilure", "code": -1}'
6475}
6576
6677# main
@@ -84,9 +95,13 @@ case "$1" in
8495 " config" )
8596 config;;
8697 " release_backlight" )
87- relase_backlight ;;
98+ release_backlight ;;
8899 " lock_backlight" )
89100 lock_backlight;;
101+ " backlight_on" )
102+ backlight_on;;
103+ " backlight_off" )
104+ backlight_off;;
90105 * )
91106 usage ;;
92107esac
You can’t perform that action at this time.
0 commit comments