GENERIC_GPIO(8)
π 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 thegeneric_gpiodriver. For info about the core driver, seenutupsdrv(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, likenut_state=[^]line_num[logical_operation[^]line_num]...;. The logical operations supported for now are not (^), and (&), and or (|).nut_stateshould correspond to a NUT state, andline_numto 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 line0- Low when operating from utility line
- Open when operating from battery
REPLACE BATTERYβ GPIO line1- Low when battery is charged
- Open when battery fails the Self Test
BATTERY MISSINGβ GPIO line6- Low when battery is present
- Open when battery is missing
LOW BATTERYβ GPIO line3- 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 inLBcase.
βοΈ 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: π§Έ
π Internet resources: π
- The NUT (Network UPS Tools) home page:
https://www.networkupstools.org/ - libgpiod home page:
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
π 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
- opensuse-leap 16.0: nut 2.8.2-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: nut 2.8.2-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: nut 2.8.2-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: nut 2.8.2-160000.2.2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms