tAdd powerkey. - droid4-sys - Droid4 tools
HTML git clone git://parazyd.org/droid4-sys.git | https://git.parazyd.org/droid4-sys
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
DIR commit 058568a127de947cfa15b46ea8acb3f45d043302
DIR parent abccab3a85f3d3ae63d56b8b09e58712153c9ef9
HTML Author: parazyd <parazyd@dyne.org>
Date: Wed, 22 May 2019 23:33:37 +0200
Add powerkey.
Diffstat:
M Makefile | 5 +++++
A powerkey | 15 +++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
---
DIR diff --git a/Makefile b/Makefile
t@@ -3,6 +3,7 @@
include config.mk
BIN = backlight
+SCR = powerkey
OBJ = $(BIN:=.o)
all: $(BIN)
t@@ -19,6 +20,10 @@ install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
chmod 4711 $(DESTDIR)$(PREFIX)/bin/$(BIN)
+ cp -f $(SCR) $(DESTDIR)$(PREFIX)/bin
+ for i in $(SCR); do \
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/$$i; \
+ done
uninstall:
rm -rf $(DESTDIR)$(PREFIX)/bin/$(BIN)
DIR diff --git a/powerkey b/powerkey
t@@ -0,0 +1,15 @@
+#!/bin/sh
+
+state="$(cat /tmp/droid4-status)"
+case "$state" in
+on)
+ backlight -l off
+ #backlight -k off
+ echo off > /tmp/droid4-status
+ ;;
+off)
+ backlight -l on
+ #backlight -k on
+ echo on > /tmp/droid4-status
+ ;;
+esac