GENERIC_GPIO(8)

πŸ“¦
version 2.8.2 Β· 3 versions
, in opensuse-leap 16.0

🌈 generic_gpio(8) β€” NUT Manual 🌈

πŸ’– NAME πŸ’–

generic_gpio β€” driver for GPIO connected UPSes. That's the whole vibe: a UPS hanging off GPIO pins, living its best life. πŸ¦‹

✨ SYNOPSIS ✨

generic_gpio -h

generic_gpio -a gpiochip0 [OPTIONS]
πŸ“ Note, bestie: this man page only documents the specific features of the generic_gpio driver. For info about the core driver, see nutupsdrv(8). πŸ’…

πŸ”Œ SUPPORTED HARDWARE πŸ”Œ

This is the driver for GPIO attached UPS devices. No cap.

The driver has been tested against CyberPower CyberShield CSN27U12V attached to Orange Pi Zero GPIO. Iconic combo, honestly. πŸ‘‘

More information about this UPS can be found here: https://www.cyberpowersystems.com/resources/csn27u12v-um/

πŸŽ›οΈ EXTRA ARGUMENTS πŸŽ›οΈ

This driver supports the following optional settings in the ups.conf(5) file:

🧠 Driver control: 🧠

  • rules=value β€” a string consisting of sub-strings. Each sub-string describes a GPIO line states conversion formula for a specific NUT state, like nut_state=[^]line_num[logical_operation[^]line_num]...;. The logical operations supported for now are not (^), and (&), and or (|). nut_state should correspond to a NUT state, and line_num to the GPIO line number connected to the UPS open collector pin.

CyberShield CSN27U12V describes pins as battery state / state details / GPIO line:

  • ON BATTERY β€” GPIO line 0
    • Low when operating from utility line
    • Open when operating from battery
  • REPLACE BATTERY β€” GPIO line 1
    • Low when battery is charged
    • Open when battery fails the Self Test
  • BATTERY MISSING β€” GPIO line 6
    • Low when battery is present
    • Open when battery is missing
  • LOW BATTERY β€” GPIO line 3
    • Low when battery is near full charge capacity
    • Open when operating from a battery with < 20% capacity

and rules might be defined as

rules = "OL=^0;OB=0;LB=3;RB=1;DISCHRG=0&^6;BYPASS=6;"

assuming battery pin connection to GPIO lines as listed in table. Expecting simple formula to be used for each state, extra may increase state reliability and may need to be checked on each specific UPS.

πŸ”‹ Battery Charge: πŸ”‹

  • default.battery.charge.low=value β€” an integer specifying the battery charge level reported in LB case.

βš™οΈ CONFIGURATION βš™οΈ

Here is an example of GPIO driver configuration in ups.conf file:

[CyberPower12v]
  driver = GENERIC_GPIO
  port = gpiochip0
  desc = "Modem and DNS server UPS"
  mfr = CyberPower
  model = "CyberShield CSN27U12V"
  rules = "OL=^0;OB=0;LB=3;RB=1;DISCHRG=0&^6;BYPASS=6;"
  default.battery.charge.low = 20

πŸ›‘ SHUTDOWN COMMAND πŸ›‘

This driver does not support shutdown command. So yeah β€” no shutdown era for this one. πŸ’€

πŸ“¦ INSTALLATION πŸ“¦

This driver is not built by default. You can build it by installing libgpiod and running configure --with-gpio=yes.

You also need to give proper permissions on the local serial device file (/dev/gpiochip0 for example) to allow the run-time NUT driver user account to access it, like by adding the following rule to Linux rules.d directory:

SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c '\
chown -R nut:nut /dev/gpiochip0 && chmod -R 700 /dev/gpiochip0\

πŸ–‹οΈ AUTHOR πŸ–‹οΈ

Modris Berzonis <modrisb@apollo.lv>

πŸ‘€ SEE ALSO πŸ‘€

🧸 The core driver: 🧸

nutupsdrv(8), ups.conf(5)

🌐 Internet resources: 🌐


πŸ’– That's the whole page, bestie β€” Network UPS Tools 2.8.2, dated 04/01/2025, signing off with main character energy. πŸŽ€

πŸ“¦ where this page comes from