Ticket #1599: neosleep

File neosleep, 1.1 KB (added by paipai62, 6 years ago)
Line 
1#!/bin/sh
2# Pré and Post sleeping for Neo FreeRunner
3# Version: 0.5
4# By PaiPai62 rewriting by Tauop
5
6
7
8PULSE_AUDIO=/etc/init.d/pulseaudio
9ALSA_STATE=/etc/init.d/alsa-state
10XSERVER_NODM=/etc/init.d/xserver-nodm
11
12DEBUG_FILE=/home/root/test2
13
14brightness_vibrator() {
15  echo "$1" > /sys/class/leds/neo1973\:vibrator/brightnes
16}
17
18case "$1,$2" in
19    suspend,*) 
20                   echo $1, $2, $3         >> $DEBUG_FILE && brightness_vibrator 254
21                     && $PULSE_AUDIO  stop >> $DEBUG_FILE && brightness_vibrator 128
22                     && $ALSA_STATE   stop >> $DEBUG_FILE && brightness_vibrator 32
23                     && $XSERVER_NODM stop >> $DEBUG_FILE && brightness_vibrator 0
24        ;;
25    resume,suspend) 
26                   echo $1, $2, $3          >> $DEBUG_FILE && brightness_vibrator 254
27                     && sleep 1
28                     && $ALSA_STATE start   >> $DEBUG_FILE && brightness_vibrator 128
29                     && $PULSE_AUDIO start  >> $DEBUG_FILE && brightness_vibrator 32
30                     && $XSERVER_NODM start >> $DEBUG_FILE && brightness_vibrator 0
31        ;;
32esac