Skip to content

Commit

Permalink
load imp-config preset settings using init script (#1254)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtxaspec authored Jan 14, 2024
1 parent 1cbfe74 commit 38a1f57
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 18 deletions.
1 change: 0 additions & 1 deletion br-ext-chip-ingenic/configs/t10_lite_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ BR2_PACKAGE_INGENIC_PWM=y
BR2_PACKAGE_LOGCAT_OPENIPC=y
# BR2_PACKAGE_HOST_GDB is not set
# BR2_PACKAGE_GDB is not set
BR2_PACKAGE_INGENIC_LIBIMP_CONTROL=y

# CCACHE
BR2_CCACHE=y
Expand Down
1 change: 0 additions & 1 deletion br-ext-chip-ingenic/configs/t20_lite_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_YAML_CLI=y
BR2_PACKAGE_QUIRC_OPENIPC=y
# BR2_PACKAGE_AUTONIGHT is not set
BR2_PACKAGE_INGENIC_LIBIMP_CONTROL=y

# WiFi
BR2_PACKAGE_WIRELESS_TOOLS=y
Expand Down
1 change: 0 additions & 1 deletion br-ext-chip-ingenic/configs/t20_ultimate_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_YAML_CLI=y
BR2_PACKAGE_QUIRC_OPENIPC=y
# BR2_PACKAGE_AUTONIGHT is not set
BR2_PACKAGE_INGENIC_LIBIMP_CONTROL=y

# WiFi
BR2_PACKAGE_WIRELESS_TOOLS=y
Expand Down
1 change: 0 additions & 1 deletion br-ext-chip-ingenic/configs/t21_lite_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_YAML_CLI=y
BR2_PACKAGE_QUIRC_OPENIPC=y
# BR2_PACKAGE_AUTONIGHT is not set
BR2_PACKAGE_INGENIC_LIBIMP_CONTROL=y

# WiFi
BR2_PACKAGE_WIRELESS_TOOLS=y
Expand Down
1 change: 0 additions & 1 deletion br-ext-chip-ingenic/configs/t21_ultimate_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_YAML_CLI=y
BR2_PACKAGE_QUIRC_OPENIPC=y
# BR2_PACKAGE_AUTONIGHT is not set
BR2_PACKAGE_INGENIC_LIBIMP_CONTROL=y

# WiFi
BR2_PACKAGE_WIRELESS_TOOLS=y
Expand Down
1 change: 0 additions & 1 deletion br-ext-chip-ingenic/configs/t30_lite_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_YAML_CLI=y
BR2_PACKAGE_QUIRC_OPENIPC=y
# BR2_PACKAGE_AUTONIGHT is not set
BR2_PACKAGE_INGENIC_LIBIMP_CONTROL=y

# WiFi
BR2_PACKAGE_WIRELESS_TOOLS=y
Expand Down
1 change: 0 additions & 1 deletion br-ext-chip-ingenic/configs/t31_lite_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_YAML_CLI=y
BR2_PACKAGE_QUIRC_OPENIPC=y
# BR2_PACKAGE_AUTONIGHT is not set
BR2_PACKAGE_INGENIC_LIBIMP_CONTROL=y

# WiFi
BR2_PACKAGE_WIRELESS_TOOLS=y
Expand Down
1 change: 0 additions & 1 deletion br-ext-chip-ingenic/configs/t31_ultimate_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_YAML_CLI=y
BR2_PACKAGE_QUIRC_OPENIPC=y
# BR2_PACKAGE_AUTONIGHT is not set
BR2_PACKAGE_INGENIC_LIBIMP_CONTROL=y

# WiFi
BR2_PACKAGE_WIRELESS_TOOLS=y
Expand Down
1 change: 0 additions & 1 deletion br-ext-chip-ingenic/configs/t40_lite_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_YAML_CLI=y
BR2_PACKAGE_QUIRC_OPENIPC=y
# BR2_PACKAGE_AUTONIGHT is not set
BR2_PACKAGE_INGENIC_LIBIMP_CONTROL=y

# WiFi
BR2_PACKAGE_WIRELESS_TOOLS=y
Expand Down
1 change: 0 additions & 1 deletion br-ext-chip-ingenic/configs/t40_ultimate_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_YAML_CLI=y
BR2_PACKAGE_QUIRC_OPENIPC=y
# BR2_PACKAGE_AUTONIGHT is not set
BR2_PACKAGE_INGENIC_LIBIMP_CONTROL=y

# WiFi
BR2_PACKAGE_WIRELESS_TOOLS=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ endef
define INGENIC_LIBIMP_CONTROL_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0755 $(@D)/libimp_control.so $(TARGET_DIR)/usr/lib
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/sbin $(INGENIC_LIBIMP_CONTROL_PKGDIR)/src/imp-control.sh
$(INSTALL) -m 755 -d $(TARGET_DIR)/etc/init.d
$(INSTALL) -m 755 -t $(TARGET_DIR)/etc/init.d $(INGENIC_LIBIMP_CONTROL_PKGDIR)/src/S96impconfig
endef

$(eval $(generic-package))
32 changes: 32 additions & 0 deletions general/package/ingenic-libimp-control/src/S96impconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

start() {
[ ! -f "/etc/imp.conf" ] && return

echo -n "Restoring IMP Configuration: "
while read -r line; do
imp-control.sh $line
done < /etc/imp.conf
echo "OK"
}

stop() {
:
}

restart() {
start
}

reload() {
start
}

case "$1" in
start|stop|restart|reload)
"$1"
;;
*)
echo "Usage: $0 {start|restart|reload}"
exit 1
esac
1 change: 1 addition & 0 deletions general/package/majestic/Config.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config BR2_PACKAGE_MAJESTIC
bool "Majestic streamer"
select BR2_PACKAGE_INGENIC_LIBIMP_CONTROL if BR2_OPENIPC_SOC_VENDOR="ingenic"
default n
help
Tiny but powerful IPC streaming software
Expand Down
13 changes: 5 additions & 8 deletions general/package/majestic/files/S95majestic
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

DAEMON="majestic"
DAEMON_PATH="/usr/bin"
PIDFILE="/var/run/$DAEMON.pid"

DAEMON_ARGS="-s"
Expand All @@ -10,7 +11,7 @@ DAEMON_ARGS="-s"

load_majestic() {
printf 'Starting %s: ' "$DAEMON"
[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, "
[ -f $DAEMON_PATH/$DAEMON ] || echo -en "DISABLED, "
# shellcheck disable=SC2086 # we need the word splitting
[ -f /etc/coredump.conf ] && . /etc/coredump.conf
if [ "$coredump_enabled" ]; then
Expand All @@ -20,13 +21,9 @@ load_majestic() {

if [ "ingenic" = "$(ipcinfo -v)" ]; then
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x /usr/bin/env -- \
LD_PRELOAD=/usr/lib/libimp_control.so /usr/bin/$DAEMON $DAEMON_ARGS
sleep 2
if [ -f "/tmp/imp.conf" ]; then
while read -r line; do imp-control.sh $line; done < /tmp/imp.conf
fi
LD_PRELOAD=/usr/lib/libimp_control.so $DAEMON_PATH/$DAEMON $DAEMON_ARGS
else
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" -- $DAEMON_ARGS
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON_PATH/$DAEMON" -- $DAEMON_ARGS
fi

status=$?
Expand All @@ -47,7 +44,7 @@ start() {

stop() {
printf 'Stopping %s: ' "$DAEMON"
[ -f /usr/bin/$DAEMON ] || echo -en "DISABLED, "
[ -f $DAEMON_PATH/$DAEMON ] || echo -en "DISABLED, "
start-stop-daemon -K -q -p "$PIDFILE"
status=$?
if [ "$status" -eq 0 ]; then
Expand Down

0 comments on commit 38a1f57

Please sign in to comment.