From 666d813e7b427abb7cf277751390c4c991a0c980 Mon Sep 17 00:00:00 2001 From: gtxaspec Date: Sun, 19 Nov 2023 12:16:37 -0800 Subject: [PATCH] add package: ingenic-libimp-control (#1148) --- .../configs/t31_lite_defconfig | 1 + .../configs/t31_ultimate_defconfig | 1 + general/package/Config.in | 1 + .../package/ingenic-libimp-control/Config.in | 4 ++ .../ingenic-libimp-control.mk | 22 +++++++ .../ingenic-libimp-control/src/imp-control.sh | 57 +++++++++++++++++++ 6 files changed, 86 insertions(+) create mode 100644 general/package/ingenic-libimp-control/Config.in create mode 100644 general/package/ingenic-libimp-control/ingenic-libimp-control.mk create mode 100755 general/package/ingenic-libimp-control/src/imp-control.sh diff --git a/br-ext-chip-ingenic/configs/t31_lite_defconfig b/br-ext-chip-ingenic/configs/t31_lite_defconfig index 6cab2e90..885b6da3 100644 --- a/br-ext-chip-ingenic/configs/t31_lite_defconfig +++ b/br-ext-chip-ingenic/configs/t31_lite_defconfig @@ -93,6 +93,7 @@ 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 diff --git a/br-ext-chip-ingenic/configs/t31_ultimate_defconfig b/br-ext-chip-ingenic/configs/t31_ultimate_defconfig index 3c1afcf0..6d58df76 100644 --- a/br-ext-chip-ingenic/configs/t31_ultimate_defconfig +++ b/br-ext-chip-ingenic/configs/t31_ultimate_defconfig @@ -95,6 +95,7 @@ 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 diff --git a/general/package/Config.in b/general/package/Config.in index f39a4d43..2c0da1e9 100644 --- a/general/package/Config.in +++ b/general/package/Config.in @@ -108,3 +108,4 @@ source "$BR2_EXTERNAL_GENERAL_PATH/package/yaml-cli/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/zerotier-one/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/logcat-openipc/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/ingenic-pwm/Config.in" +source "$BR2_EXTERNAL_GENERAL_PATH/package/ingenic-libimp-control/Config.in" diff --git a/general/package/ingenic-libimp-control/Config.in b/general/package/ingenic-libimp-control/Config.in new file mode 100644 index 00000000..84f95490 --- /dev/null +++ b/general/package/ingenic-libimp-control/Config.in @@ -0,0 +1,4 @@ +config BR2_PACKAGE_INGENIC_LIBIMP_CONTROL + bool "libimp_control" + help + Library for on the fly adjustments to the IMP Library diff --git a/general/package/ingenic-libimp-control/ingenic-libimp-control.mk b/general/package/ingenic-libimp-control/ingenic-libimp-control.mk new file mode 100644 index 00000000..81713698 --- /dev/null +++ b/general/package/ingenic-libimp-control/ingenic-libimp-control.mk @@ -0,0 +1,22 @@ +################################################################################ +# +# ingenic-libimp-control +# +################################################################################ + +INGENIC_LIBIMP_CONTROL_VERSION = master +INGENIC_LIBIMP_CONTROL_SITE = $(call github,gtxaspec,libimp_control,$(INGENIC_LIBIMP_CONTROL_VERSION)) +INGENIC_LIBIMP_CONTROL_LICENSE = GPL-2.0 +INGENIC_LIBIMP_CONTROL_LICENSE_FILES = COPYING + +define INGENIC_LIBIMP_CONTROL_BUILD_CMDS + $(MAKE) CROSS_COMPILE=$(TARGET_CROSS) -C $(@D) +endef + +define INGENIC_LIBIMP_CONTROL_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/libimp_control.so $(TARGET_DIR)/usr/lib + $(INSTALL) -m 644 -t $(TARGET_DIR)/usr/sbin $(INGENIC_LIBIMP_CONTROL_PKGDIR)/src/imp-control.sh + +endef + +$(eval $(generic-package)) diff --git a/general/package/ingenic-libimp-control/src/imp-control.sh b/general/package/ingenic-libimp-control/src/imp-control.sh new file mode 100755 index 00000000..51633b14 --- /dev/null +++ b/general/package/ingenic-libimp-control/src/imp-control.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +# This script provides a control interface for the libimp_control library. +# It sends commands to the server listening on localhost port 4000. + +# Function to display the usage of the script +show_help() { + echo "Usage: imp-control.sh [command] [parameters]" + echo " Use without parameters to retrieve current values." + echo "Available commands:" + echo "Command Parameters Description" + echo "------- ---------- -----------" + echo "aihpf [on/off] High Pass Filter" + echo "aiagc [off/gainLevel compGaindB] Auto Gain Control" + echo "ains [off/0-3] Noise Suppression" + echo "aiaec [on/off] Echo Cancellation" + echo "aivol [-30-120] Audio Input Volume" + echo "aigain [0-31] Audio Input Gain" + echo "aialc [0-7] Audio Input ALC Gain" + echo "aovol [-30-120] Audio Output Volume" + echo "aogain [0-31] Audio Output Gain" + echo "contrast [0-255] Contrast" + echo "brightness [0-255] Brightness" + echo "saturation [0-255] Saturation" + echo "sharpness [0-255] Sharpness" + echo "sinter [0-255] Sinter Strength" + echo "temper [0-255] Temper Strength" + echo "aecomp [0-255] AE Compensation" + echo "aeitmax [value] AE Max parameters" + echo "backlightcomp [strength] Set Backlight Comp." + echo "dpc [0-255] DPC Strength" + echo "drc [0-255] DRC Strength" + echo "hilight [0-10] Highlight Intensity" + echo "again [value] Analog Gain" + echo "dgain [value] Digital Gain" + echo "hue [0-255] Hue" + echo "ispmode [0/1] ISP Mode (Day/Night)" + echo "flicker [0/1/2] Anti-Flicker" + echo "flip [normal/flip/mirror/flip_mirror] Image Flip" + echo "fps [fps_num] [fps_den] Set Sensor FPS" + echo "whitebalance [mode] [rgain] [bgain] Set White Balance" + echo "gamma Get Gamma Values" + echo "autozoom [ch] [scaler enable] [scale w] [scale h] [crop enable] [crop left] [crop top] [crop w] [crop h]" + echo " Set Auto Zoom" + echo "frontcrop [enable] [top] [left] [width] [height]" + echo " Set Front Crop" + echo "mask [ch] [enable] [top] [left] [width] [height] [green] [blue] [red]" + echo " Set Mask" +} + +# Check for no arguments and display help +if [ "$#" -eq 0 ]; then + show_help +else + # Send the command and parameters to the server + echo "imp_control $*" | nc localhost 4000 +fi