| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 
 | GENERIC GPIO(8)
===============
NAME
----
generic_gpio - Driver for GPIO connected UPSes
SYNOPSIS
--------
*generic_gpio* -h
*generic_gpio* -a 'gpiochip0' ['OPTIONS']
NOTE: This man page only documents the specific features of the *generic_gpio*
driver. For information about the core driver, see linkman:nutupsdrv[8].
SUPPORTED HARDWARE
------------------
This is the driver for GPIO attached UPS devices.
The driver has been tested against CyberPower CyberShield CSN27U12V attached to
Orange Pi Zero GPIO.
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
linkman:ups.conf[5] file:
Driver control:
~~~~~~~~~~~~~~
*rules*='value'::
A string consisting of sub-strings. Each sub-string describes GPIO line
states conversion formula to specific NUT state, like
`nut_state=[^]line_num[logical_operation[^]line_num]...;`. Not (^) , and (&) , or
(|)operations are supported for now. nut_state should correspond to NUT
state, line_num to GPIO line number connected to UPS open collector pin.
CyberShield CSN27U12V describes pins as:
|===
|Battery state|State details|GPIO line
|ON BATTERY|*Low* when operating from utility line
*Open* when operating from battery|0
|REPLACE BATTERY|*Low* when battery is charged
*Open* when battery fails the Self Test|1
|BATTERY MISSING|*Low* when battery is present
*Open* when battery is missing|6
|LOW BATTERY|*Low* when battery is near full charge capacity
*Open* when operating from a battery with < 20% capacity|3
|===
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.
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:
~~~~~~~~~~~~~~~~
linkman:nutupsdrv[8], linkman:ups.conf[5]
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/
 |