diff --git a/pcat-manager/Makefile b/pcat-manager/Makefile new file mode 100644 index 00000000..da2f02d8 --- /dev/null +++ b/pcat-manager/Makefile @@ -0,0 +1,47 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=pcat-manager +PKG_RELEASE:=1.0.16 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2023-03-17 +PKG_SOURCE_URL:=https://github.com/photonicat/rockchip_rk3568_pcat_manager +PKG_SOURCE_VERSION:=5b8d8e098205e92fe9587f03d8bc34f8383987b2 +PKG_MIRROR_HASH:=309ff9a0c73701af3428951d0df13e29525bcb5636262486b42f6a17eaebe2c0 + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/meson.mk + +define Package/pcat-manager + SECTION:=utils + CATEGORY:=Utilities + TITLE:=photonicat watchdog + URL:=https://photonicat.com + DEPENDS:=+glib2 +libgpiod +libjson-c +libusb-1.0 +endef + +define Package/pcat-manager/description + Photonicat Manager is a system service for + power management and modem controlling. +endef + +define Package/pcat-manager/install + $(INSTALL_DIR) $(1)/etc/ + $(INSTALL_CONF) ./files/pcat-manager.conf $(1)/etc + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/pcat-manager.init $(1)/etc/init.d/pcat-manager + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/pcat-manager \ + $(1)/usr/bin/pcat-manager +endef + +$(eval $(call BuildPackage,pcat-manager)) diff --git a/pcat-manager/files/pcat-manager.conf b/pcat-manager/files/pcat-manager.conf new file mode 100644 index 00000000..454e6bb8 --- /dev/null +++ b/pcat-manager/files/pcat-manager.conf @@ -0,0 +1,28 @@ +[Hardware] +GPIOModemPowerChip=gpiochip4 +GPIOModemPowerLine=18 +GPIOModemPowerActiveLow=0 +GPIOModemRFKillChip=gpiochip4 +GPIOModemRFKillLine=20 +GPIOModemRFKillActiveLow=1 +GPIOModemResetChip=gpiochip0 +GPIOModemResetLine=8 +GPIOModemResetActiveLow=0 + +[PowerManager] +SerialDevice=/dev/ttyS0 +SerialBaud=115200 +AutoShutdownVoltageGeneral=0 +AutoShutdownVoltageLTE=0 +AutoShutdownVoltage5G=3600 +LEDHighVoltage=0 +LEDMediumVoltage=0 +LEDLowVoltage=0 +LEDWorkLowVoltage=0 +StartupVoltage=0 +ChargerLimitVoltage=0 +ChargerFastVoltage=0 +BatteryFullThreshold=4100 +BatteryDischargeTableNormal=4100;4040;3980;3920;3870;3820;3790;3770;3740;3680;3450 +BatteryDischargeTable5G=4050;3980;3930;3890;3850;3815;3780;3740;3700;3655;3610 +BatteryChargeTable=4100;4085;4067;4040;4003;3942;3880;3825;3780;3725;3600 diff --git a/pcat-manager/files/pcat-manager.init b/pcat-manager/files/pcat-manager.init new file mode 100644 index 00000000..e6a6b382 --- /dev/null +++ b/pcat-manager/files/pcat-manager.init @@ -0,0 +1,24 @@ +#!/bin/sh /etc/rc.common + +START=45 +STOP=89 + +start() { + service_start /usr/bin/pcat-manager -D +} + +stop() { + service_stop /usr/bin/pcat-manager +} + +restart() { + killall -USR1 pcat-manager + stop + start +} + +shutdown() { + touch /tmp/pcat-manager-shutdown.tmp + stop + rfkill block wwan 2>/dev/null || true +}