From 95dc5578a632dda159e4555b929bb9ad6cef3dd9 Mon Sep 17 00:00:00 2001 From: Vincent-FK Date: Mon, 16 Nov 2020 08:32:05 +0100 Subject: [PATCH] Removed ro in Recovery, mapping for low brightness working in recovery --- .../rootfs-overlay/etc/current_battery_percentage | 1 - .../funkey/rootfs-overlay/etc/current_brightness | 1 - .../board/funkey/rootfs-overlay/etc/current_volume | 1 - .../rootfs-overlay/etc/current_battery_percentage | 1 - .../funkey/rootfs-overlay/etc/current_brightness | 1 - Recovery/board/funkey/rootfs-overlay/etc/issue | 2 +- .../board/funkey/rootfs-overlay/etc/os-release | 6 +++--- .../board/funkey/rootfs-overlay/etc/sw-versions | 2 +- .../rootfs-overlay/usr/local/sbin/brightness_get | 14 ++------------ .../rootfs-overlay/usr/local/sbin/brightness_set | 7 ++----- .../funkey/rootfs-overlay/usr/local/sbin/menu | 2 +- .../board/funkey/rootfs-overlay/usr/local/sbin/ro | 6 ++++++ .../FunKey-GPIO-Mapping/FunKey-GPIO-Mapping.mk | 1 - 13 files changed, 16 insertions(+), 29 deletions(-) delete mode 100644 FunKey/board/funkey/rootfs-overlay/etc/current_battery_percentage delete mode 100644 FunKey/board/funkey/rootfs-overlay/etc/current_brightness delete mode 100644 FunKey/board/funkey/rootfs-overlay/etc/current_volume delete mode 100644 Recovery/board/funkey/rootfs-overlay/etc/current_battery_percentage delete mode 100644 Recovery/board/funkey/rootfs-overlay/etc/current_brightness diff --git a/FunKey/board/funkey/rootfs-overlay/etc/current_battery_percentage b/FunKey/board/funkey/rootfs-overlay/etc/current_battery_percentage deleted file mode 100644 index 29d6383..0000000 --- a/FunKey/board/funkey/rootfs-overlay/etc/current_battery_percentage +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/FunKey/board/funkey/rootfs-overlay/etc/current_brightness b/FunKey/board/funkey/rootfs-overlay/etc/current_brightness deleted file mode 100644 index 29d6383..0000000 --- a/FunKey/board/funkey/rootfs-overlay/etc/current_brightness +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/FunKey/board/funkey/rootfs-overlay/etc/current_volume b/FunKey/board/funkey/rootfs-overlay/etc/current_volume deleted file mode 100644 index 2bbd69c..0000000 --- a/FunKey/board/funkey/rootfs-overlay/etc/current_volume +++ /dev/null @@ -1 +0,0 @@ -70 diff --git a/Recovery/board/funkey/rootfs-overlay/etc/current_battery_percentage b/Recovery/board/funkey/rootfs-overlay/etc/current_battery_percentage deleted file mode 100644 index 29d6383..0000000 --- a/Recovery/board/funkey/rootfs-overlay/etc/current_battery_percentage +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/Recovery/board/funkey/rootfs-overlay/etc/current_brightness b/Recovery/board/funkey/rootfs-overlay/etc/current_brightness deleted file mode 100644 index 29d6383..0000000 --- a/Recovery/board/funkey/rootfs-overlay/etc/current_brightness +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/Recovery/board/funkey/rootfs-overlay/etc/issue b/Recovery/board/funkey/rootfs-overlay/etc/issue index 4546d94..133bd79 100644 --- a/Recovery/board/funkey/rootfs-overlay/etc/issue +++ b/Recovery/board/funkey/rootfs-overlay/etc/issue @@ -5,6 +5,6 @@ |___| |_____|__|__||__|\__||_____|___ | FUN ON A KEYCHAIN |_____| ----------------------------------------------------- - Version 0.99 (Recovery) + Version 0.991 (Recovery) ----------------------------------------------------- diff --git a/Recovery/board/funkey/rootfs-overlay/etc/os-release b/Recovery/board/funkey/rootfs-overlay/etc/os-release index 71ca240..e995ef6 100644 --- a/Recovery/board/funkey/rootfs-overlay/etc/os-release +++ b/Recovery/board/funkey/rootfs-overlay/etc/os-release @@ -1,9 +1,9 @@ NAME="FunKey-OS Recovery" -VERSION="0.99 (Khaki Kitten)" +VERSION="0.991 (Khaki Kitten)" ID=funkey-recovery ID_LIKE=buildroot -PRETTY_NAME="FunKey-OS Recovery 0.99" -VERSION_ID="0.99" +PRETTY_NAME="FunKey-OS Recovery 0.991" +VERSION_ID="0.991" HOME_URL="https://www.funkey-project.com/" SUPPORT_URL="https://www.funkey-project.com/" BUG_REPORT_URL="https://www.funkey-project.com/" diff --git a/Recovery/board/funkey/rootfs-overlay/etc/sw-versions b/Recovery/board/funkey/rootfs-overlay/etc/sw-versions index 6ab0e5d..28995c1 100644 --- a/Recovery/board/funkey/rootfs-overlay/etc/sw-versions +++ b/Recovery/board/funkey/rootfs-overlay/etc/sw-versions @@ -1 +1 @@ -Recovery 0.99 +Recovery 0.991 diff --git a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/brightness_get b/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/brightness_get index f948e0f..744481b 100755 --- a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/brightness_get +++ b/Recovery/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/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/brightness_set b/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/brightness_set index 6315245..8d45575 100755 --- a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/brightness_set +++ b/Recovery/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 @@ -22,9 +21,7 @@ let value/=10 echo ${value} > ${SYSTEM_BRIGHTNESS} # Set new brightness value in brightness file -if [ ${?} -eq 0 ]; then - rw - echo ${brightness_percentage} > ${BRIGHTNESS_FILE} - ro +if [ ${?} -eq 0 -a $(brightness_get) -ne ${brightness_percentage} ]; then + fw_setenv brightness ${brightness_percentage} fi exit 0 diff --git a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/menu b/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/menu index e20d2e7..f7ae3ee 100755 --- a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/menu +++ b/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/menu @@ -12,7 +12,7 @@ getkey() { menu_display () { local entry=${1} - clear_notif + #clear_notif case ${entry} in 0) diff --git a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/ro b/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/ro index 4501fa9..0cd6ddf 100755 --- a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/ro +++ b/Recovery/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/Recovery/package/FunKey-GPIO-Mapping/FunKey-GPIO-Mapping.mk b/Recovery/package/FunKey-GPIO-Mapping/FunKey-GPIO-Mapping.mk index 3e1b8e8..9d62057 100644 --- a/Recovery/package/FunKey-GPIO-Mapping/FunKey-GPIO-Mapping.mk +++ b/Recovery/package/FunKey-GPIO-Mapping/FunKey-GPIO-Mapping.mk @@ -23,7 +23,6 @@ define FUNKEY_GPIO_MAPPING_INSTALL_TARGET_CMDS $(INSTALL) -m 0755 $(@D)/funkey_gpio_management $(TARGET_DIR)/usr/local/sbin/funkey_gpio_management $(INSTALL) -m 0755 $(@D)/termfix $(TARGET_DIR)/usr/local/sbin/termfix $(INSTALL) -d -m 0755 $(TARGET_DIR)/etc - $(INSTALL) -m 0644 $(@D)/funkey_gpio_mapping.conf $(TARGET_DIR)/etc/funkey_gpio_mapping.conf $(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/init.d $(INSTALL) -m 0755 $(FUNKEY_GPIO_MAPPING_PKGDIR)etc/init.d/S11funkey-gpio-management $(TARGET_DIR)/etc/init.d/S11funkey-gpio-management endef