diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/brightness_get b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/brightness_get index f948e0f..744481b 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/brightness_get +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/brightness_get @@ -1,6 +1,5 @@ #!/bin/sh -BRIGHTNESS_FILE=/etc/current_brightness BRIGHTNESS_DEFAULT_VALUE=100 # Check args @@ -9,20 +8,11 @@ if [ ${#} -ne 0 ]; then exit 1 fi -# Sanity check: File does not exist -if [ ! -f ${BRIGHTNESS_FILE} ]; then - rw - echo ${BRIGHTNESS_DEFAULT_VALUE} > ${BRIGHTNESS_FILE} - ro -fi - # Sanity check: Check if integer -brightness=$(cat ${BRIGHTNESS_FILE}) +brightness=$(fw_printenv | grep brightness= | cut -d'=' -f 2-) if ! [ ! "${brightness}" -ne "${brightness}" ] 2> /dev/null; then - rw - echo ${BRIGHTNESS_DEFAULT_VALUE} > ${BRIGHTNESS_FILE} - ro brightness=${BRIGHTNESS_DEFAULT_VALUE} + fw_setenv brightness ${brightness} fi echo ${brightness} exit 0 diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/brightness_set b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/brightness_set index 4792262..8d45575 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/brightness_set +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/brightness_set @@ -1,6 +1,5 @@ #!/bin/sh -BRIGHTNESS_FILE=/etc/current_brightness SYSTEM_BRIGHTNESS=/sys/class/backlight/backlight/brightness # Check args @@ -23,8 +22,6 @@ echo ${value} > ${SYSTEM_BRIGHTNESS} # Set new brightness value in brightness file if [ ${?} -eq 0 -a $(brightness_get) -ne ${brightness_percentage} ]; then - rw - echo ${brightness_percentage} > ${BRIGHTNESS_FILE} - ro + fw_setenv brightness ${brightness_percentage} fi exit 0 diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/ro b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/ro index 4501fa9..0cd6ddf 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/ro +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/ro @@ -1,3 +1,9 @@ #!/bin/sh +# Check that we are in RW +mount | grep -q "ext4 (rw" || exit 1 + +# Flush and mount in read only mount / -o remount,ro + +exit 0 diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/volume_get b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/volume_get index 563d9ef..c4be748 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/volume_get +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/volume_get @@ -1,6 +1,5 @@ #!/bin/sh -VOLUME_FILE=/etc/current_volume VOLUME_DEFAULT_VALUE=50 # Check args @@ -9,20 +8,11 @@ if [ ${#} -ne 0 ]; then exit 1 fi -# Sanity check: File does not exist -if [ ! -f ${VOLUME_FILE} ]; then - rw - echo ${VOLUME_DEFAULT_VALUE} > ${VOLUME_FILE} - ro -fi - # Sanity check: Check if integer -volume=$(cat "${VOLUME_FILE}") +volume=$(fw_printenv | grep volume= | cut -d'=' -f 2-) if ! [ ! "${volume}" -ne "${volume}" ] 2> /dev/null; then - rw - echo ${VOLUME_DEFAULT_VALUE} > ${VOLUME_FILE} - ro volume=${VOLUME_DEFAULT_VALUE} + fw_setenv volume ${volume} fi echo ${volume} exit 0 diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/volume_set b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/volume_set index 5a1d875..bebc413 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/volume_set +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/volume_set @@ -1,7 +1,5 @@ #!/bin/sh -VOLUME_FILE=/etc/current_volume - # Check args if [ ${#} -ne 1 ]; then echo "Usage: $(basename ${0}) new_volume_percentage" @@ -18,7 +16,7 @@ fi 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 +#echo $volume_scaled # Get current value current_volume=$(volume_get) @@ -35,8 +33,6 @@ amixer -q sset 'Headphone' ${volume_scaled} unmute # Change new volume value in volume file if [ ${?} -eq 0 -a ${current_volume} -ne ${volume_percent} ]; then - rw - echo ${volume_percent} > ${VOLUME_FILE} - ro + fw_setenv volume ${volume_percent} fi exit 0 diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/write_args_quick_load_file b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/write_args_quick_load_file index 1f886fe..e5e977f 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/write_args_quick_load_file +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/write_args_quick_load_file @@ -3,7 +3,6 @@ # Write quick load file args QUICK_LOAD_FILE=/mnt/quick_load_cmd -rw echo -n "" > $QUICK_LOAD_FILE for i in "$@"; do if $(echo "$i" | egrep -q '[[:space:]]'); then @@ -15,5 +14,5 @@ for i in "$@"; do fi done echo "" >> ${QUICK_LOAD_FILE} -ro + exit 0