From 14452674e740cbc3389c69d459232f09ba2333d6 Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Sat, 10 Apr 2021 11:11:45 +0200 Subject: [PATCH] use fkgpiod in Recovery too Signed-off-by: Michel-FK --- Recovery/Config.in | 2 +- .../funkey/rootfs-overlay/etc/fkgpiod.conf | 25 +++++++ .../etc/funkey_gpio_mapping.conf | 67 ------------------- .../package/FunKey-GPIO-Mapping/Config.in | 5 -- .../FunKey-GPIO-Mapping.mk | 29 -------- .../etc/init.d/S11funkey-gpio-management | 36 ---------- Recovery/package/fkgpiod/Config.in | 5 ++ Recovery/package/fkgpiod/etc/init.d/S11gpio | 35 ++++++++++ Recovery/package/fkgpiod/fkgpiod.mk | 29 ++++++++ 9 files changed, 95 insertions(+), 138 deletions(-) create mode 100644 Recovery/board/funkey/rootfs-overlay/etc/fkgpiod.conf delete mode 100644 Recovery/board/funkey/rootfs-overlay/etc/funkey_gpio_mapping.conf delete mode 100644 Recovery/package/FunKey-GPIO-Mapping/Config.in delete mode 100644 Recovery/package/FunKey-GPIO-Mapping/FunKey-GPIO-Mapping.mk delete mode 100755 Recovery/package/FunKey-GPIO-Mapping/etc/init.d/S11funkey-gpio-management create mode 100644 Recovery/package/fkgpiod/Config.in create mode 100644 Recovery/package/fkgpiod/etc/init.d/S11gpio create mode 100644 Recovery/package/fkgpiod/fkgpiod.mk diff --git a/Recovery/Config.in b/Recovery/Config.in index a30956c..8e351a7 100644 --- a/Recovery/Config.in +++ b/Recovery/Config.in @@ -1 +1 @@ -source "$BR2_EXTERNAL_RECOVERY_PATH/package/FunKey-GPIO-Mapping/Config.in" +source "$BR2_EXTERNAL_RECOVERY_PATH/package/fkgpiod/Config.in" diff --git a/Recovery/board/funkey/rootfs-overlay/etc/fkgpiod.conf b/Recovery/board/funkey/rootfs-overlay/etc/fkgpiod.conf new file mode 100644 index 0000000..49ef00e --- /dev/null +++ b/Recovery/board/funkey/rootfs-overlay/etc/fkgpiod.conf @@ -0,0 +1,25 @@ +CLEAR +MAP FN TO KEY KEY_K +MAP START TO KEY KEY_S +MAP UP TO KEY KEY_U +MAP LEFT TO KEY KEY_L +MAP FN+LEFT TO KEY KEY_J +MAP DOWN TO KEY KEY_D +MAP FN+DOWN TO KEY KEY_H +MAP RIGHT TO KEY KEY_R +MAP FN+RIGHT TO KEY KEY_I +MAP R TO KEY KEY_N +MAP L TO KEY KEY_M +MAP A TO KEY KEY_A +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+L TO KEY KEY_V +MAP FN+R TO KEY KEY_O +MAP FN+L+R TO COMMAND display_notif_system_stats diff --git a/Recovery/board/funkey/rootfs-overlay/etc/funkey_gpio_mapping.conf b/Recovery/board/funkey/rootfs-overlay/etc/funkey_gpio_mapping.conf deleted file mode 100644 index e5cbd8d..0000000 --- a/Recovery/board/funkey/rootfs-overlay/etc/funkey_gpio_mapping.conf +++ /dev/null @@ -1,67 +0,0 @@ -################################## -# Funkey GPIO keymap config file # -################################## -# Format: -# -# - First all GPIO Pin numbers must be declared (integers separated by commas) -# By default, pins are declared active high, to declare them active low, add char '*' -# Example: 0,1,2,3,4,6,7,10*,11,12,13,14,15 -# -# - Then the mapping can be done as follows (one line per mapping): -# Pin_number[+Pin_number...], type_mapping, value, str_help_name_pin, str_help_fct_pin -# -# args: * Pin_number is the pin number concerned by the maping, -# add +Pin_number for multiple touch mapping (not limited in nb of pins) -# * type_mapping can be KEYBOARD or SHELL_COMMAND -# * value is : -# if type_mapping==KEYBOARD: the keycode from /usr/include/linux/input.h] -# if type_mapping==SHELL_COMMAND: the shell command to exec -# * str_help_name_pin is a sweet name for the pin (ex: PB5) -# * str_help_fct_pin is an help str to indicate the function of this mapping - - - -################################### -# Pins declaration: -0,1,2,3,4,6,7,10*,11,12,13,14,15 - - -################################### -# Mapping: -#7, KEYBOARD, KEY_F, KEY_F, Fn -#7+6, KEYBOARD, KEY_K, KEY_K, Select -7, KEYBOARD, KEY_K, KEY_K, Select -6, KEYBOARD, KEY_S, KEY_S, Start -3, KEYBOARD, KEY_U, KEY_U, Up -7+3, KEYBOARD, KEY_P, KEY_P, Quick Save -4, KEYBOARD, KEY_L, KEY_L, Left -7+4, KEYBOARD, KEY_J, KEY_J, Aspect ratio factor -- -1, KEYBOARD, KEY_D, KEY_D, Down -7+1, KEYBOARD, KEY_H, KEY_H, Aspect ratio mode change -0, KEYBOARD, KEY_R, KEY_R, Right -7+0, KEYBOARD, KEY_I, KEY_I, Aspect ratio factor ++ -15, KEYBOARD, KEY_N, KEY_N, R1 -7+15, KEYBOARD, KEY_O, KEY_O, R2 -2, KEYBOARD, KEY_M, KEY_M, L1 -7+2, KEYBOARD, KEY_V, KEY_V, L2 -12, KEYBOARD, KEY_A, KEY_A, A -14, KEYBOARD, KEY_B, KEY_B, B -13, KEYBOARD, KEY_Y, KEY_Y, Y -11, KEYBOARD, KEY_X, KEY_X, X - -7+6, SHELL_COMMAND, snap, Fn+Start, Snapshot -7+12, SHELL_COMMAND, quick_action_volume_up, Fn+Y, Volume++ -7+13, SHELL_COMMAND, quick_action_volume_down, Fn+A, Volume-- -7+11, SHELL_COMMAND, quick_action_bright_up, Fn+B, Brightness++ -7+14, SHELL_COMMAND, quick_action_bright_down, Fn+X, Brightness-- -10, SHELL_COMMAND, shutdown_funkey, N_OE, Poweroff because of N_OE -7+15+2, SHELL_COMMAND, display_notif_system_stats, Fn+L1+L2, display system cpu and ram usage - -#7+12, KEYBOARD, KEY_G, KEY_G, Brightness++ -#7+14, KEYBOARD, KEY_E, KEY_E, Volume-- -#7+13, KEYBOARD, KEY_W, KEY_W, Brightness-- -#7+11, KEYBOARD, KEY_C, KEY_C, Volume++ -#10, KEYBOARD, KEY_T, KEY_T, Should Poweroff because N_OE_received -#7+15, KEYBOARD, KEY_Q, 7+11, Launch menu - - diff --git a/Recovery/package/FunKey-GPIO-Mapping/Config.in b/Recovery/package/FunKey-GPIO-Mapping/Config.in deleted file mode 100644 index 455a4b8..0000000 --- a/Recovery/package/FunKey-GPIO-Mapping/Config.in +++ /dev/null @@ -1,5 +0,0 @@ -config BR2_PACKAGE_FUNKEY_GPIO_MAPPING - bool "FunKey GPIO Mapping" - default y - help - The FunKey GPIO mapping utility. diff --git a/Recovery/package/FunKey-GPIO-Mapping/FunKey-GPIO-Mapping.mk b/Recovery/package/FunKey-GPIO-Mapping/FunKey-GPIO-Mapping.mk deleted file mode 100644 index 36958ed..0000000 --- a/Recovery/package/FunKey-GPIO-Mapping/FunKey-GPIO-Mapping.mk +++ /dev/null @@ -1,29 +0,0 @@ -################################################################################ -# -# FunKey-GPIO-mapping -# -################################################################################ - -FUNKEY_GPIO_MAPPING_VERSION = e2b637f -FUNKEY_GPIO_MAPPING_SITE_METHOD = git -FUNKEY_GPIO_MAPPING_SITE = https://github.com/FunKey-Project/FunKey-GPIO-Mapping.git -FUNKEY_GPIO_MAPPING_SITE_LICENSE = GPL-2.1+ -FUNKEY_GPIO_MAPPING_SITE_LICENSE_FILES = COPYING - -define FUNKEY_GPIO_MAPPING_BUILD_CMDS - $(TARGET_MAKE_ENV) CROSS_COMPILE=$(TARGET_CROSS) \ - CC="$(TARGET_CC)" \ - $(MAKE) -C $(@D) \ - CFLAGS="$(TARGET_CFLAGS)" $(FUNKEY_GPIO_MAPPING_BUILD_TARGET) -endef - -define FUNKEY_GPIO_MAPPING_INSTALL_TARGET_CMDS - $(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/local/sbin - $(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) -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 - -$(eval $(generic-package)) diff --git a/Recovery/package/FunKey-GPIO-Mapping/etc/init.d/S11funkey-gpio-management b/Recovery/package/FunKey-GPIO-Mapping/etc/init.d/S11funkey-gpio-management deleted file mode 100755 index 1e2ee08..0000000 --- a/Recovery/package/FunKey-GPIO-Mapping/etc/init.d/S11funkey-gpio-management +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# -# Start/stop funkey_gpio_management -# - -DAEMON=/usr/local/sbin/funkey_gpio_management -PIDFILE=/var/run/funkey_gpio_management.pid - -case "$1" in - start) - echo -n "Starting funkey_gpio_management: " - start-stop-daemon -S -x ${DAEMON} -p ${PIDFILE} -m -b -- > /dev/null 2>&1 - if [ ${?} -eq 0 ]; then - echo "OK" - else - echo "ERROR" - fi - ;; - stop) - echo -n "Stopping funkey_gpio_management: " - start-stop-daemon -K -x ${DAEMON} -p ${PIDFILE} -o > /dev/null 2>&1 - if [ ${?} -eq 0 ]; then - echo "OK" - else - echo "ERROR" - fi - ;; - restart) - ${0} stop - sleep 1 # Prevent race condition: ensure funkey_gpio_management stops before start. - ${0} start - ;; - *) - echo "Usage: ${0} {start|stop|restart}" - exit 1 -esac diff --git a/Recovery/package/fkgpiod/Config.in b/Recovery/package/fkgpiod/Config.in new file mode 100644 index 0000000..4cdfe39 --- /dev/null +++ b/Recovery/package/fkgpiod/Config.in @@ -0,0 +1,5 @@ +config BR2_PACKAGE_FKGPIOD + bool "FunKey S GPIO daemon" + default y + help + The FunKey GPIO mapping utility. diff --git a/Recovery/package/fkgpiod/etc/init.d/S11gpio b/Recovery/package/fkgpiod/etc/init.d/S11gpio new file mode 100644 index 0000000..59bbcda --- /dev/null +++ b/Recovery/package/fkgpiod/etc/init.d/S11gpio @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Start/stop FunKey GPIO daemon +# + +DAEMON=/usr/local/sbin/fkgpiod + +case "$1" in + start) + echo -n "Starting FunKey GPIO daemon: " + ${DAEMON} -d /etc/fkgpiod.conf > /dev/null 2>&1 + if [ ${?} -eq 0 ]; then + echo "OK" + else + echo "ERROR" + fi + ;; + stop) + echo -n "Stopping FunKey GPIO daemon: " + ${DAEMON} -k > /dev/null 2>&1 + if [ ${?} -eq 0 ]; then + echo "OK" + else + echo "ERROR" + fi + ;; + restart) + ${0} stop + sleep 1 # Prevent race condition: ensure FunKey GPIO daemon stops before start. + ${0} start + ;; + *) + echo "Usage: ${0} {start|stop|restart}" + exit 1 +esac diff --git a/Recovery/package/fkgpiod/fkgpiod.mk b/Recovery/package/fkgpiod/fkgpiod.mk new file mode 100644 index 0000000..7a64daa --- /dev/null +++ b/Recovery/package/fkgpiod/fkgpiod.mk @@ -0,0 +1,29 @@ +################################################################################ +# +# fkgpiod +# +################################################################################ + +FKGPIOD_VERSION = 16b7a7b +FKGPIOD_SITE_METHOD = git +FKGPIOD_SITE = https://github.com/FunKey-Project/fkgpiod.git +FKGPIOD_SITE_LICENSE = GPL-2.1+ +FKGPIOD_SITE_LICENSE_FILES = COPYING + +define FKGPIOD_BUILD_CMDS + $(TARGET_MAKE_ENV) CROSS_COMPILE=$(TARGET_CROSS) \ + CC="$(TARGET_CC)" \ + $(MAKE) -C $(@D) \ + CFLAGS="$(TARGET_CFLAGS)" $(FKGPIOD_BUILD_TARGET) +endef + +define FKGPIOD_INSTALL_TARGET_CMDS + $(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/local/sbin + $(INSTALL) -m 0755 $(@D)/fkgpiod $(TARGET_DIR)/usr/local/sbin/fkgpiod + $(INSTALL) -m 0755 $(@D)/termfix $(TARGET_DIR)/usr/local/sbin/termfix + $(INSTALL) -d -m 0755 $(TARGET_DIR)/etc + $(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/init.d + $(INSTALL) -m 0755 $(FKGPIOD_PKGDIR)etc/init.d/S11gpio $(TARGET_DIR)/etc/init.d/S11gpio +endef + +$(eval $(generic-package))