unify brightness & volume scripts

Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
This commit is contained in:
Michel-FK 2021-05-02 22:39:29 +02:00
parent d5175b091c
commit 6e008cc539
39 changed files with 307 additions and 458 deletions

View File

@ -15,11 +15,11 @@ MAP B TO KEY KEY_B
MAP X TO KEY KEY_X
MAP Y TO KEY KEY_Y
MAP MENU TO KEY KEY_Q
MAP FN+UP TO COMMAND snap
MAP FN+A TO COMMAND quick_action_volume_up
MAP FN+Y TO COMMAND quick_action_volume_down
MAP FN+X TO COMMAND quick_action_bright_up
MAP FN+B TO COMMAND quick_action_bright_down
MAP FN+UP TO COMMAND snapshot
MAP FN+A TO COMMAND volume up
MAP FN+Y TO COMMAND volume down
MAP FN+X TO COMMAND brightness up
MAP FN+B TO COMMAND brightness down
MAP FN+L TO KEY KEY_V
MAP FN+R TO KEY KEY_O
MAP FN+L+R TO COMMAND display_notif_system_stats

View File

@ -44,18 +44,13 @@ resize() {
fi
}
# Restore saved volume
echo "Restore saved volume"
volume set $(volume get) >/dev/null 2>&1
# Start ampli
echo "Start audio amplifier"
start_audio_amp 1 >/dev/null 2>&1
# Force unmute sound card and reset volume
echo "Force unmute sound card and reset volume"
volume_set $(volume_get) >/dev/null 2>&1
# Reset saved brightness
echo "Reset saved brightness"
brightness_set $(brightness_get) >/dev/null 2>&1
# Restore saved brightness
echo "Restore saved brightness"
brightness set $(brightness get) >/dev/null 2>&1
# Start Assembly tests (blocking process)
assembly_tests >/dev/null 2>&1

View File

@ -0,0 +1,122 @@
#!/bin/sh
# Uncomment the following line to get debug info
#set -x
SELF="$(basename ${0})"
SYSTEM_BRIGHTNESS="/sys/class/backlight/backlight/brightness"
DEFAULT_BRIGHTNESS_VALUE=100
BRIGHTNESS_STEP=10
NOTIF_DURATION=2
usage() {
>&2 echo "Usage: ${SELF} get"
>&2 echo " ${SELF} set new_brightness_percentage"
exit 1
}
increase_brightness() {
# Get current value
local current_brightness=$(get_brightness)
# Compute new brightness value
local new_brightness=0
let new_brightness=${current_brightness}+${BRIGHTNESS_STEP}
if [ ${new_brightness} -gt 100 ]; then
new_brightness=100
fi
# Change brightness
if [ ${new_brightness} -ne ${current_brightness} ]; then
set_brightness ${new_brightness}
fi
# Notif
notif_set ${NOTIF_DURATION} " BRIGHTNESS: ${new_brightness}%%"
}
decrease_brightness() {
# Get current value
local current_brightness=$(get_brightness)
# Compute new brightness value
local new_brightness=0
if [ ${current_brightness} -gt ${BRIGHTNESS_STEP} ]; then
let new_brightness=${current_brightness}-${BRIGHTNESS_STEP}
fi
# Change brightness
if [ ${new_brightness} -ne ${current_brightness} ]; then
set_brightness ${new_brightness}
fi
# Notif
notif_set ${NOTIF_DURATION} " BRIGHTNESS: ${new_brightness}%%"
}
get_brightness() {
local brightness=$(fw_printenv -n brightness 2>/dev/null)
if ! [ ! "${brightness}" -ne "${brightness}" ] 2> /dev/null; then
brightness=${DEFAULT_BRIGHTNESS_VALUE}
fw_setenv brightness ${brightness}
fi
echo ${brightness}
}
set_brightness() {
# Set the new brightness percentage in the kernel driver
local brightness=${1}
local kernel_brightness
let kernel_brightness=${brightness}+10
let kernel_brightness/=10
echo ${kernel_brightness} > "${SYSTEM_BRIGHTNESS}"
# Set the new brightness value in a bootloader variable
if [ ${?} -eq 0 -a $(get_brightness) -ne ${brightness} ]; then
fw_setenv brightness ${brightness}
fi
}
# Check number of arguments
if [ ${#} -lt 1 -o ${#} -gt 2 ]; then
usage
fi
case ${1} in
up)
increase_brightness
;;
down)
decrease_brightness
;;
get)
if [ ${#} -ne 1 ]; then
usage
fi
get_brightness
;;
set)
if [ ${#} -ne 2 ]; then
usage
fi
# Make sure the argument is a positive number <= 100
if [ -n "${2}" ] && [ "${2}" -eq "${2}" ] 2>/dev/null && \
[ "${2}" -ge 0 ] && [ "${2}" -le 100 ]; then
set_brightness "${2}"
else
usage
fi
;;
*)
usage
;;
esac
exit 0

View File

@ -1,18 +0,0 @@
#!/bin/sh
BRIGHTNESS_DEFAULT_VALUE=100
# Check args
if [ ${#} -ne 0 ]; then
echo "Usage: $(basename ${0})"
exit 1
fi
# Sanity check: Check if integer
brightness=$(fw_printenv -n brightness 2>/dev/null)
if ! [ ! "${brightness}" -ne "${brightness}" ] 2> /dev/null; then
brightness=${BRIGHTNESS_DEFAULT_VALUE}
fw_setenv brightness ${brightness}
fi
echo ${brightness}
exit 0

View File

@ -1,13 +0,0 @@
#!/bin/sh
SYSTEM_BRIGHTNESS=/sys/class/backlight/backlight/brightness
# Check args
if [ ${#} -ne 0 ]; then
echo "Usage: $(basename ${0})"
exit 1
fi
let brightness=$(cat ${SYSTEM_BRIGHTNESS})*10-10
echo ${brightness}
exit 0

View File

@ -1,27 +0,0 @@
#!/bin/sh
SYSTEM_BRIGHTNESS=/sys/class/backlight/backlight/brightness
# Check args
if [ ${#} -ne 1 ]; then
echo "Usage: $(basename ${0}) new_brightness_percentage"
exit 1
fi
# Check value's range
if [ ${1} -gt 100 ]; then
echo "Usage: Wrong brightness percentage (${1}), must be between 0 and 100"
exit 1
fi
brightness_percentage=${1}
# Set new brightness percentage
let value=${1}+10
let value/=10
echo ${value} > ${SYSTEM_BRIGHTNESS}
# Set new brightness value in brightness file
if [ ${?} -eq 0 -a $(brightness_get) -ne ${brightness_percentage} ]; then
fw_setenv brightness ${brightness_percentage}
fi
exit 0

View File

@ -1,21 +0,0 @@
#!/bin/sh
SYSTEM_BRIGHTNESS=/sys/class/backlight/backlight/brightness
# Check args
if [ ${#} -ne 1 ]; then
echo "Usage: $(basename ${0}) new_brightness_percentage"
exit 1
fi
# Check value's range
if [ ${1} -gt 100 ]; then
echo "Usage: Wrong brightness percentage (${1}), must be between 0 and 100"
exit 1
fi
# Set new brightness percentage
let value=${1}+10
let value/=10
echo ${value} > ${SYSTEM_BRIGHTNESS}
exit 0

View File

@ -1,22 +0,0 @@
#!/bin/sh
STEP_BRIGHTNESS=10
NOTIF_DURATION=2
# Get current value
current_brightness=$(brightness_get)
# Compute new brightness value
new_brightness=0
if [ ${current_brightness} -gt ${STEP_BRIGHTNESS} ]; then
let new_brightness=${current_brightness}-${STEP_BRIGHTNESS}
fi
# Change brightness
if [ ${new_brightness} -ne ${current_brightness} ]; then
brightness_set ${new_brightness}
fi
# Notif
notif_set ${NOTIF_DURATION} " BRIGHTNESS: ${new_brightness}%%"
exit 0

View File

@ -1,22 +0,0 @@
#!/bin/sh
STEP_BRIGHTNESS=10
NOTIF_DURATION=2
# Get current value
current_brightness=$(brightness_get)
# Compute new brightness value
let new_brightness=${current_brightness}+${STEP_BRIGHTNESS}
if [ ${new_brightness} -gt 100 ]; then
new_brightness=100
fi
# Change brightness
if [ ${new_brightness} -ne ${current_brightness} ]; then
brightness_set ${new_brightness}
fi
# Notif
notif_set ${NOTIF_DURATION} " BRIGHTNESS: ${new_brightness}%%"
exit 0

View File

@ -1,22 +0,0 @@
#!/bin/sh
STEP_VOLUME=10
NOTIF_DURATION=2
# Get current value
current_volume=$(volume_get)
# Compute new volume value
new_volume=0
if [ ${current_volume} -gt ${STEP_VOLUME} ]; then
let new_volume=${current_volume}-${STEP_VOLUME}
fi
# Change volume
if [ ${new_volume} -ne ${current_volume} ]; then
volume_set ${new_volume}
fi
# Notif
notif_set ${NOTIF_DURATION} " VOLUME: ${new_volume}%%"
exit 0

View File

@ -1,22 +0,0 @@
#!/bin/sh
STEP_VOLUME=10
NOTIF_DURATION=2
# Get current value
current_volume=$(volume_get)
# Compute new volume value
let new_volume=${current_volume}+${STEP_VOLUME}
if [ ${new_volume} -gt 100 ]; then
new_volume=100
fi
# Change volume
if [ ${new_volume} -ne ${current_volume} ]; then
volume_set ${new_volume}
fi
# Notif
notif_set ${NOTIF_DURATION} " VOLUME: ${new_volume}%%"
exit 0

View File

@ -1,37 +1,45 @@
#!/bin/sh
SELF="$(basename ${0})"
SYSTEM_GPIO="/sys/class/gpio"
# Power Audio Amplifier enable GPIO
GPIO_PF6=166
usage() {
>2& echo "Usage: ${SELF} [1 for on, 0 for off]"
exit 1
}
# Check number of args
if [ ${#} -ne 1 ]; then
echo "Usage: $(basename ${0}) [1 for on, 0 for off]"
exit 1
usage
fi
# Check enable arg
enable=${1}
if [ ${enable} -eq 1 ]; then
if [ "${enable}" -eq 1 -o "${enable}" = "on" ]; then
# Turn ON only if volume is not null
if [ "$(volume_get)" -ne "0" ]; then
# Turn ON only if volume is not null
if [ "$(volume get)" -ne "0" ]; then
echo "Turning audio amplifier ON"
else
exit 0
fi
elif [ ${enable} -eq 0 ]; then
fi
enable=1
elif [ "${enable}" -eq 0 -o "${enable}" = "off" ]; then
echo "Turning audio amplifier OFF"
enable=0
else
echo "Usage: $(basename ${0}) [1 for on, 0 for off]"
exit 1
usage
fi
# PA enable GPIO
GPIO_PF6=166
# Export GPIO
if [ ! -d /sys/class/gpio/gpio${GPIO_PF6} ]; then
echo ${GPIO_PF6} > /sys/class/gpio/export
# Export the GPIO if necessary
if [ ! -d "${SYSTEM_GPIO}/gpio${GPIO_PF6}" ]; then
echo ${GPIO_PF6} > "${SYSTEM_GPIO}/export"
fi
# Enable/disable cmd
echo "out" > /sys/class/gpio/gpio${GPIO_PF6}/direction
echo ${enable} > /sys/class/gpio/gpio${GPIO_PF6}/value
# Enable/disable the pwoer audio amplifier
echo "out" > "${SYSTEM_GPIO}/gpio${GPIO_PF6}/direction"
echo ${enable} > "${SYSTEM_GPIO}/gpio${GPIO_PF6}/value"
exit 0

View File

@ -1,12 +0,0 @@
#!/bin/sh
LOCK_FILE=/var/lock/gpio_manager.lock
if [ -f ${LOCK_FILE} ]; then
echo "${LOCK_FILE} already exists"
exit 1
fi
touch ${LOCK_FILE}
funkey_gpio_management
rm "${LOCK_FILE}"
exit 0

View File

@ -0,0 +1,130 @@
#!/bin/sh
# Uncomment the following line to get debug info
#set -x
SELF="$(basename ${0})"
DEFAULT_VOLUME_VALUE=50
MINIMUM_VOLUME=16
VOLUME_STEP=10
NOTIF_DURATION=2
usage() {
>&2 echo "Usage: ${SELF} get"
>&2 echo " ${SELF} set new_volume_percentage"
exit 1
}
increase_volume() {
# Get current value
local current_volume=$(get_volume)
# Compute new volume value
local new_volume=0
let new_volume=${current_volume}+${VOLUME_STEP}
if [ ${new_volume} -gt 100 ]; then
new_volume=100
fi
# Change volume
if [ ${new_volume} -ne ${current_volume} ]; then
set_volume ${new_volume}
fi
# Notif
notif_set ${NOTIF_DURATION} " VOLUME: ${new_volume}%%"
}
decrease_volume() {
# Get current value
local current_volume=$(get_volume)
# Compute new volume value
local new_volume=0
if [ ${current_volume} -gt ${VOLUME_STEP} ]; then
let new_volume=${current_volume}-${VOLUME_STEP}
fi
# Change volume
if [ ${new_volume} -ne ${current_volume} ]; then
set_volume ${new_volume}
fi
# Notif
notif_set ${NOTIF_DURATION} " VOLUME: ${new_volume}%%"
}
get_volume() {
local volume=$(fw_printenv -n volume 2>/dev/null)
if ! [ ! "${volume}" -ne "${volume}" ] 2> /dev/null; then
volume=${DEFAULT_VOLUME_VALUE}
fw_setenv volume ${volume}
fi
echo ${volume}
}
set_volume() {
local current_volume=$(get_volume)
# Set the new volume value (from 0 to 63) into ALSA
local new_volume=${1}
local alsa_volume=$(echo "a = $new_volume * (63 - $MINIMUM_VOLUME) / 100 + \
$MINIMUM_VOLUME + 0.5; scale = 0; a / 1" | bc -l)
amixer -q sset 'Headphone' ${alsa_volume} unmute
# Set the new volume value in a bootloader variable
if [ ${?} -eq 0 -a ${current_volume} -ne ${new_volume} ]; then
fw_setenv volume ${new_volume}
fi
# Turn on/off audio amplifier if necessary
if [ ${current_volume} -eq 0 -a ${new_volume} -ne 0 ]; then
start_audio_amp 1
elif [ ${current_volume} -ne 0 -a ${new_volume} -eq 0 ]; then
start_audio_amp 0
fi
}
# Check number of arguments
if [ ${#} -lt 1 -o ${#} -gt 2 ]; then
usage
fi
case ${1} in
up)
increase_volume
;;
down)
decrease_volume
;;
get)
if [ ${#} -ne 1 ]; then
usage
fi
get_volume
;;
set)
if [ ${#} -ne 2 ]; then
usage
fi
# Make sure the argument is a positive number <= 100
if [ -n "${2}" ] && [ "${2}" -eq "${2}" ] 2>/dev/null && \
[ "${2}" -ge 0 ] && [ "${2}" -le 100 ]; then
set_volume "${2}"
else
usage
fi
;;
*)
usage
;;
esac
exit 0

View File

@ -1,18 +0,0 @@
#!/bin/sh
VOLUME_DEFAULT_VALUE=50
# Check args
if [ ${#} -ne 0 ]; then
echo "Usage: $(basename ${0})"
exit 1
fi
# Sanity check: Check if integer
volume=$(fw_printenv -n volume 2>/dev/null)
if ! [ ! "${volume}" -ne "${volume}" ] 2> /dev/null; then
volume=${VOLUME_DEFAULT_VALUE}
fw_setenv volume ${volume}
fi
echo ${volume}
exit 0

View File

@ -1,4 +0,0 @@
#!/bin/sh
amixer sget 'Headphone' | tail -1 | cut -d' ' -f7 | sed 's/[^0-9]//g'
exit 0

View File

@ -1,39 +0,0 @@
#!/bin/sh
# Check args
if [ ${#} -ne 1 ]; then
echo "Usage: $(basename ${0}) new_volume_percentage"
exit 1
fi
# Check value's range
if [ ${1} -gt 100 ]; then
echo "Usage: Wrong volume percentage (${1}), must be between 0 and 100"
exit 1
fi
# Scale new volume value between 0 and 63
volume_percent=${1}
vol_mini=16;
volume_scaled=$(echo "a = $volume_percent * (63 - $vol_mini) / 100 + $vol_mini + 0.5; scale = 0; a / 1" | bc -l)
#echo $volume_scaled
# Get current value
current_volume=$(volume_get)
# Set new volume
amixer -q sset 'Headphone' ${volume_scaled} unmute
# Change new volume value in volume file
if [ ${?} -eq 0 -a ${current_volume} -ne ${volume_percent} ]; then
fw_setenv volume ${volume_percent}
fi
# Turn on/off audio amplifier if necessary
if [ ${current_volume} -eq 0 -a ${volume_percent} -ne 0 ]; then
start_audio_amp 1
elif [ ${current_volume} -ne 0 -a ${volume_percent} -eq 0 ]; then
start_audio_amp 0
fi
exit 0

View File

@ -1,31 +0,0 @@
#!/bin/sh
# Check args
if [ ${#} -ne 1 ]; then
echo "Usage: ${0} new_volume_percentage"
exit 1
fi
# Check value's range
if [ ${1} -gt 100 ]; then
echo "Usage: Wrong volume percentage (${1}), must be between 0 and 100"
exit 1
fi
# Scale new volume value between 0 and 63
volume_percent=${1}
volume_scaled=$(echo "a = ${1} * 63 / 100 + 0.5; scale = 0; a / 1" | bc -l)
# Get current value
current_volume=$(volume_get)
# Turn on/off ampli if necessary
if [ ${current_volume} -eq 0 -a ${volume_scaled} -ne 0 ]; then
start_audio_amp 1
elif [ ${current_volume} -ne 0 -a ${volume_scaled} -eq 0 ]; then
start_audio_amp 0
fi
# Set new volume
amixer -q sset 'Headphone' ${volume_scaled} unmute
exit 0

View File

@ -4,7 +4,7 @@
#
################################################################################
FCEUX_VERSION = f492414
FCEUX_VERSION = eacbc9b
FCEUX_SITE_METHOD = git
FCEUX_SITE = https://github.com/FunKey-Project/fceux.git
FCEUX_LICENSE = GPL-2.0

View File

@ -4,7 +4,7 @@
#
################################################################################
PCSX_REARMED_VERSION = 0f104cb
PCSX_REARMED_VERSION = e418c99
PCSX_REARMED_SITE_METHOD = git
PCSX_REARMED_SITE = https://github.com/FunKey-Project/pcsx_rearmed.git
PCSX_REARMED_LICENSE = GPL-2.0

View File

@ -4,7 +4,7 @@
#
################################################################################
POCKETSNES_VERSION = 1d50e6a
POCKETSNES_VERSION = 7ced860
POCKETSNES_SITE_METHOD = git
POCKETSNES_SITE = https://github.com/FunKey-Project/PocketSNES.git
POCKETSNES_LICENSE = GPL-2.0

View File

@ -3,7 +3,7 @@
# commander
#
#############################################################
COMMANDER_VERSION = 34b8d40
COMMANDER_VERSION = 9ba64f0
COMMANDER_SITE_METHOD = git
COMMANDER_SITE = https://github.com/FunKey-Project/commander.git
COMMANDER_LICENSE = GPL-2.0

View File

@ -3,7 +3,7 @@
# gmenu2x
#
#############################################################
GMENU2X_VERSION = 1b1c251
GMENU2X_VERSION = de79b3b
GMENU2X_SITE_METHOD = git
GMENU2X_SITE = https://github.com/FunKey-Project/gmenu2x.git
GMENU2X_LICENSE = GPL-2.0

View File

@ -4,7 +4,7 @@
#
################################################################################
GNUBOY_VERSION = 444d2c7
GNUBOY_VERSION = dc763dc
GNUBOY_SITE_METHOD = git
GNUBOY_SITE = https://github.com/FunKey-Project/gnuboy.git
GNUBOY_LICENSE = GPL-2.0

View File

@ -4,7 +4,7 @@
#
################################################################################
GPSP_VERSION = a6d535d
GPSP_VERSION = 0c16af5
GPSP_SITE_METHOD = git
GPSP_SITE = https://github.com/FunKey-Project/gpsp.git
GPSP_LICENSE = GPL-2.0

View File

@ -4,7 +4,7 @@
#
################################################################################
MEDNAFEN_VERSION = f85ec22
MEDNAFEN_VERSION = 5064db7
MEDNAFEN_SITE_METHOD = git
MEDNAFEN_SITE = https://github.com/FunKey-Project/mednafen-git.git
MEDNAFEN_LICENSE = GPL-2.0+

View File

@ -4,7 +4,7 @@
#
################################################################################
PICODRIVE_VERSION = 49326b6
PICODRIVE_VERSION = 8fe4e96
PICODRIVE_SITE_METHOD = git
PICODRIVE_SITE = https://github.com/FunKey-Project/picodrive.git
PICODRIVE_LICENSE = MAME

View File

@ -4,7 +4,7 @@
#
################################################################################
RETROFE_VERSION = 829e59b
RETROFE_VERSION = 625207d
RETROFE_SITE_METHOD = git
RETROFE_SITE = https://github.com/FunKey-Project/RetroFE.git
RETROFE_DEPENDENCIES = gstreamer1 gst1-plugins-base sdl sdl_image sdl_mixer sdl_sound sdl_ttf libglib2 sqlite zlib

View File

@ -15,11 +15,11 @@ MAP B TO KEY KEY_B
MAP X TO KEY KEY_X
MAP Y TO KEY KEY_Y
MAP MENU TO KEY KEY_Q
MAP FN+UP TO COMMAND snap
MAP FN+A TO COMMAND quick_action_volume_up
MAP FN+Y TO COMMAND quick_action_volume_down
MAP FN+X TO COMMAND quick_action_bright_up
MAP FN+B TO COMMAND quick_action_bright_down
MAP FN+UP TO COMMAND snaphsot
MAP FN+A TO COMMAND volume up
MAP FN+Y TO COMMAND volume down
MAP FN+X TO COMMAND brightness up
MAP FN+B TO COMMAND brightness down
MAP FN+L TO KEY KEY_V
MAP FN+R TO KEY KEY_O
MAP FN+L+R TO COMMAND display_notif_system_stats

View File

@ -36,6 +36,6 @@ resize() {
fi
}
# Reset saved brightness
echo "Reset saved brightness"
brightness_set $(brightness_get) >/dev/null 2>&1
# Restore saved brightness
echo "Restore saved brightness"
brightness set $(brightness get) >/dev/null 2>&1

View File

@ -1,18 +0,0 @@
#!/bin/sh
BRIGHTNESS_DEFAULT_VALUE=100
# Check args
if [ ${#} -ne 0 ]; then
echo "Usage: $(basename ${0})"
exit 1
fi
# Sanity check: Check if integer
brightness=$(fw_printenv -n brightness 2>/dev/null)
if ! [ ! "${brightness}" -ne "${brightness}" ] 2> /dev/null; then
brightness=${BRIGHTNESS_DEFAULT_VALUE}
fw_setenv brightness ${brightness}
fi
echo ${brightness}
exit 0

View File

@ -1,13 +0,0 @@
#!/bin/sh
SYSTEM_BRIGHTNESS=/sys/class/backlight/backlight/brightness
# Check args
if [ ${#} -ne 0 ]; then
echo "Usage: $(basename ${0})"
exit 1
fi
let brightness=$(cat ${SYSTEM_BRIGHTNESS})*10-10
echo ${brightness}
exit 0

View File

@ -1,27 +0,0 @@
#!/bin/sh
SYSTEM_BRIGHTNESS=/sys/class/backlight/backlight/brightness
# Check args
if [ ${#} -ne 1 ]; then
echo "Usage: $(basename ${0}) new_brightness_percentage"
exit 1
fi
# Check value's range
if [ ${1} -gt 100 ]; then
echo "Usage: Wrong brightness percentage (${1}), must be between 0 and 100"
exit 1
fi
brightness_percentage=${1}
# Set new brightness percentage
let value=${1}+10
let value/=10
echo ${value} > ${SYSTEM_BRIGHTNESS}
# Set new brightness value in brightness file
if [ ${?} -eq 0 -a $(brightness_get) -ne ${brightness_percentage} ]; then
fw_setenv brightness ${brightness_percentage}
fi
exit 0

View File

@ -1,21 +0,0 @@
#!/bin/sh
SYSTEM_BRIGHTNESS=/sys/class/backlight/backlight/brightness
# Check args
if [ ${#} -ne 1 ]; then
echo "Usage: $(basename ${0}) new_brightness_percentage"
exit 1
fi
# Check value's range
if [ ${1} -gt 100 ]; then
echo "Usage: Wrong brightness percentage (${1}), must be between 0 and 100"
exit 1
fi
# Set new brightness percentage
let value=${1}+10
let value/=10
echo ${value} > ${SYSTEM_BRIGHTNESS}
exit 0

View File

@ -1,22 +0,0 @@
#!/bin/sh
STEP_BRIGHTNESS=10
NOTIF_DURATION=2
# Get current value
current_brightness=$(brightness_get)
# Compute new brightness value
new_brightness=0
if [ ${current_brightness} -gt ${STEP_BRIGHTNESS} ]; then
let new_brightness=${current_brightness}-${STEP_BRIGHTNESS}
fi
# Change brightness
if [ ${new_brightness} -ne ${current_brightness} ]; then
brightness_set ${new_brightness}
fi
# Notif
#notif_set ${NOTIF_DURATION} " BRIGHTNESS: ${new_brightness}%%"
exit 0

View File

@ -1,22 +0,0 @@
#!/bin/sh
STEP_BRIGHTNESS=10
NOTIF_DURATION=2
# Get current value
current_brightness=$(brightness_get)
# Compute new brightness value
let new_brightness=${current_brightness}+${STEP_BRIGHTNESS}
if [ ${new_brightness} -gt 100 ]; then
new_brightness=100
fi
# Change brightness
if [ ${new_brightness} -ne ${current_brightness} ]; then
brightness_set ${new_brightness}
fi
# Notif
#notif_set ${NOTIF_DURATION} " BRIGHTNESS: ${new_brightness}%%"
exit 0

View File

@ -1,12 +0,0 @@
#!/bin/sh
LOCK_FILE=/var/lock/gpio_manager.lock
if [ -f ${LOCK_FILE} ]; then
echo "${LOCK_FILE} already exists"
exit 1
fi
touch ${LOCK_FILE}
funkey_gpio_management
rm "${LOCK_FILE}"
exit 0