Skip to content

luci-mod-battstatus: Add photonicat support#585

Merged
1715173329 merged 1 commit intoimmortalwrt:masterfrom
rbqvq:battstatus-pcat
Sep 9, 2025
Merged

luci-mod-battstatus: Add photonicat support#585
1715173329 merged 1 commit intoimmortalwrt:masterfrom
rbqvq:battstatus-pcat

Conversation

@rbqvq
Copy link
Contributor

@rbqvq rbqvq commented Sep 2, 2025

Add photonicat support with pcat-mgr

Add photonicat support with pcat-mgr

Signed-off-by: Coia Prant <coiaprant@gmail.com>
@1715173329 1715173329 self-assigned this Sep 5, 2025
Comment on lines +13 to +14
board=$(cat /tmp/sysinfo/board_name)
model=$(cat /tmp/sysinfo/model)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
board=$(cat /tmp/sysinfo/board_name)
model=$(cat /tmp/sysinfo/model)
board="$(cat /tmp/sysinfo/board_name)"
model="$(cat /tmp/sysinfo/model)"

Comment on lines +21 to +22
json_add_boolean charging $(cat /sys/class/power_supply/pcat-charger/online)
json_add_int percentage $(cat /sys/class/power_supply/pcat-battery/capacity)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
json_add_boolean charging $(cat /sys/class/power_supply/pcat-charger/online)
json_add_int percentage $(cat /sys/class/power_supply/pcat-battery/capacity)
json_add_boolean charging "$(cat /sys/class/power_supply/pcat-charger/online)"
json_add_int percentage "$(cat /sys/class/power_supply/pcat-battery/capacity)"

hootoo,ht-tm05)
if [ -f /usr/sbin/i2cset ] && [ -f /usr/sbin/i2cget ]; then
json_add_boolean valid 1
if [ $(i2cset -y 0 0x0a 0x0a 0x01 && i2cget -y 0 0x0a 0x0a) = 0x40 ]; then
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if [ $(i2cset -y 0 0x0a 0x0a 0x01 && i2cget -y 0 0x0a 0x0a) = 0x40 ]; then
if [ "$(i2cset -y 0 0x0a 0x0a 0x01 && i2cget -y 0 0x0a 0x0a)" = "0x40" ]; then

else
json_add_boolean charging 0
fi
json_add_int percentage $(i2cset -y 0 0x0a 0x0a 0x10 && i2cget -y 0 0x0a 0x0a | xargs printf %d)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
json_add_int percentage $(i2cset -y 0 0x0a 0x0a 0x10 && i2cget -y 0 0x0a 0x0a | xargs printf %d)
json_add_int percentage "$(i2cset -y 0 0x0a 0x0a 0x10 && i2cget -y 0 0x0a 0x0a | xargs printf "%d")"

json_add_string message "Need i2cset"
;;
hootoo,ht-tm05)
if [ -f /usr/sbin/i2cset ] && [ -f /usr/sbin/i2cget ]; then
Copy link
Member

Choose a reason for hiding this comment

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

maybe use -x instead?

else
json_add_string message "Need i2cget"
json_add_boolean valid 0
if [ ! -f /usr/sbin/i2cset ]; then
Copy link
Member

Choose a reason for hiding this comment

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

same here

@1715173329 1715173329 merged commit bca90ef into immortalwrt:master Sep 9, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments