Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions utils/k3screenctrl/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=k3screenctrl
PKG_VERSION:=1.0
PKG_RELEASE:=1

PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=COPYING
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/kazutoiris/k3screenctrl/archive/refs/tags/v$(PKG_VERSION).tar.gz?

@BKPepe BKPepe Aug 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use https://github.com/lwz322/k3screenctrl ? Your repository is only 2 commits ahead of that repository and there is no pull request to the upstream repository.

Also ping @zxlhhyccc who created https://github.com/zxlhhyccc/Hill-98-k3screenctrl

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since most of the authors/modifiers are no longer reachable, I currently use the Phicomm K3 and will continue to maintain it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 days ago. Hmm, still I would like to see pull request there.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the most recent commit for lwz322/k3screenctrl was made 3 years ago, and zxlhhyccc/Hill-98-k3screenctrl was made 7 years ago, many maintainers have abandoned the Phicomm K3. Of course, if you are willing to wait, I don't mind.

PKG_HASH:=cc9927f324ce7e221a2ac3351ec78156719195662cc5bafd5424d340c170cd39
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already default, so it can be dropped.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that only PKG_BUILD_DIR matches the default value.

https://github.com/openwrt/archive/blob/af7e7ab684d5dd89a3072ad7b29a81a2669ef54f/include/package.mk#L14

While PKG_SOURCE, PKG_SOURCE_URL, and PKG_HASH all differ from it.

https://github.com/openwrt/openwrt/blob/5384f53a604be35d1f745e17cfd4d62f564cefe7/include/download.mk#L11-L17

Am I misunderstanding something?

PKG_MAINTAINER:=Kazuto Iris <hitomi@apache.org>, Hamster Tian <haotia@gmail.com>
PKG_BUILD_DEPENDS:=automake
PKG_FIXUP:=autoreconf
Comment on lines +14 to +15

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: PKG_BUILD_DEPENDS:=automake has no effect — automake is not a package, it is a host tool under tools/ that is always built before any package, and PKG_FIXUP:=autoreconf invokes it from $(STAGING_DIR_HOST)/bin on its own. No other Makefile in this feed or in openwrt.git sets it. Optional, non-blocking.

Suggested change
PKG_BUILD_DEPENDS:=automake
PKG_FIXUP:=autoreconf
PKG_FIXUP:=autoreconf

Generated by Claude Code


include $(INCLUDE_DIR)/package.mk

TARGET_CFLAGS+= -D_GNU_SOURCE

define Package/k3screenctrl
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+coreutils +coreutils-od +bash +curl @TARGET_bcm53xx_generic_DEVICE_phicomm_k3

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TARGET_bcm53xx_generic_DEVICE_phicomm_k3 only exists in the single-device "Target Profile" choice. That choice defaults to TARGET_MULTI_PROFILE on buildbots (target-metadata.pl:218-220), and under multi-profile the per-device symbol is generated with a TARGET_DEVICE_ prefix instead (menuconfig TARGET_DEVICE_$conf_$id at line 314 vs config TARGET_$conf_$id at line 255). As written the symbol is n in every SDK/buildbot config, so the package would never be built for the feed and users would still have to compile it themselves — the opposite of the motivation stated in the PR body.

The one in-tree precedent, mox-pkcs11 Makefile:25, uses the same non-TARGET_DEVICE_ form, so I can't tell whether that one is knowingly build-it-yourself-only or just carries the same problem. Is the gate meant to hide the package from other targets in menuconfig, or to actually restrict what gets built? If it is only about visibility, @TARGET_bcm53xx (or no gate at all) would still get a binary into the feed.

Separately, +coreutils is redundant: coreutils-od already carries DEPENDS:=+coreutils.


Generated by Claude Code

TITLE:=LCD screen controller on PHICOMM K3
URL:=https://github.com/kazutoiris/k3screenctrl.git
endef

define Package/k3screenctrl/description
K3 Screen Controller (k3screenctrl) is a program utilizing the LCD screen on PHICOMM K3 to display some stats.
endef

define Package/k3screenctrl/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/lib/k3screenctrl
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/lib/k3screenctrl/oui
$(INSTALL_DIR) $(1)/etc/config

$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/k3screenctrl $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/wan.sh $(1)/lib/k3screenctrl/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/wifi.sh $(1)/lib/k3screenctrl/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/port.sh $(1)/lib/k3screenctrl/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/basic.sh $(1)/lib/k3screenctrl/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/host.sh $(1)/lib/k3screenctrl/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/weather.sh $(1)/lib/k3screenctrl/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/oui/oui.txt $(1)/lib/k3screenctrl/oui/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oui.txt is a data file, not an executable — installing it with $(INSTALL_BIN) ships it mode 0755. Use $(INSTALL_DATA) (0644).

Suggested change
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/oui/oui.txt $(1)/lib/k3screenctrl/oui/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/k3screenctrl/oui/oui.txt $(1)/lib/k3screenctrl/oui/

(The .sh files above are fine as $(INSTALL_BIN) if the daemon execs them rather than sourcing them.)


Generated by Claude Code


$(INSTALL_BIN) ./files/k3screenctrl.init $(1)/etc/init.d/k3screenctrl
$(INSTALL_CONF) ./files/k3screenctrl.config $(1)/etc/config/k3screenctrl
endef

define Package/k3screenctrl/conffiles
/etc/config/k3screenctrl
endef

$(eval $(call BuildPackage,k3screenctrl))
9 changes: 9 additions & 0 deletions utils/k3screenctrl/files/k3screenctrl.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

config general
Comment on lines +1 to +2

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: stray leading blank line at the top of the file. Optional, non-blocking.

Suggested change
config general
config general

Generated by Claude Code

option screen_time '30'
option refresh_time '2'
option pawd_hide '1'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: pawd_hide reads like a typo for pswd_hide / passwd_hide. If the upstream /lib/k3screenctrl/*.sh scripts really read it under this exact spelling then it has to stay, but this file is registered in conffiles, so the option name is effectively frozen once the package ships — worth confirming now rather than needing a migration later.

Also, of the seven options here only screen_time and refresh_time are consumed by the init script. If the other five are read by the installed shell scripts that is fine; if any are leftovers from an older fork, better to drop them from the shipped default config.


Generated by Claude Code

option psk_hide '0'
option showmore '1'
option city_checkip '0'
option update_time '0'
28 changes: 28 additions & 0 deletions utils/k3screenctrl/files/k3screenctrl.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh /etc/rc.common

START=99
STOP=99

USE_PROCD=1
PROG=/usr/bin/k3screenctrl

start_service() {
local m d
m=$(uci -q get k3screenctrl.@general[0].screen_time)
d=$(uci -q get k3screenctrl.@general[0].refresh_time)
[ -z "$m" ] && m=10
[ -z "$d" ] && d=2
[ "$m" -lt 10 ] 2>/dev/null && m=10
[ "$d" -lt 1 ] 2>/dev/null && d=1
Comment on lines +13 to +16

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clamp fails open on non-numeric input. With option screen_time 'abc', [ "abc" -lt 10 ] exits 2 (the error message is swallowed by 2>/dev/null), so && m=10 never runs and abc is passed straight through to k3screenctrl -m. Same for refresh_time. Validating the string first covers both the empty and the garbage case:

Suggested change
[ -z "$m" ] && m=10
[ -z "$d" ] && d=2
[ "$m" -lt 10 ] 2>/dev/null && m=10
[ "$d" -lt 1 ] 2>/dev/null && d=1
case "$m" in ''|*[!0-9]*) m=10 ;; esac
case "$d" in ''|*[!0-9]*) d=2 ;; esac
[ "$m" -lt 10 ] && m=10
[ "$d" -lt 1 ] && d=1

Generated by Claude Code


procd_open_instance
procd_set_param command "$PROG" -m "$m" -d "$d"
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}

service_triggers() {
procd_add_config_trigger "config.change" "k3screenctrl" /etc/init.d/k3screenctrl reload
}
Loading