1968ec6a6SOleksandr Tymoshenko.\" Copyright (c) 1980, 1991, 1993 2968ec6a6SOleksandr Tymoshenko.\" The Regents of the University of California. All rights reserved. 3968ec6a6SOleksandr Tymoshenko.\" 4968ec6a6SOleksandr Tymoshenko.\" Redistribution and use in source and binary forms, with or without 5968ec6a6SOleksandr Tymoshenko.\" modification, are permitted provided that the following conditions 6968ec6a6SOleksandr Tymoshenko.\" are met: 7968ec6a6SOleksandr Tymoshenko.\" 1. Redistributions of source code must retain the above copyright 8968ec6a6SOleksandr Tymoshenko.\" notice, this list of conditions and the following disclaimer. 9968ec6a6SOleksandr Tymoshenko.\" 2. Redistributions in binary form must reproduce the above copyright 10968ec6a6SOleksandr Tymoshenko.\" notice, this list of conditions and the following disclaimer in the 11968ec6a6SOleksandr Tymoshenko.\" documentation and/or other materials provided with the distribution. 12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 13968ec6a6SOleksandr Tymoshenko.\" may be used to endorse or promote products derived from this software 14968ec6a6SOleksandr Tymoshenko.\" without specific prior written permission. 15968ec6a6SOleksandr Tymoshenko.\" 16968ec6a6SOleksandr Tymoshenko.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17968ec6a6SOleksandr Tymoshenko.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18968ec6a6SOleksandr Tymoshenko.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19968ec6a6SOleksandr Tymoshenko.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20968ec6a6SOleksandr Tymoshenko.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21968ec6a6SOleksandr Tymoshenko.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22968ec6a6SOleksandr Tymoshenko.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23968ec6a6SOleksandr Tymoshenko.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24968ec6a6SOleksandr Tymoshenko.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25968ec6a6SOleksandr Tymoshenko.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26968ec6a6SOleksandr Tymoshenko.\" SUCH DAMAGE. 27968ec6a6SOleksandr Tymoshenko.\" 28*69b96cd3SRomain Tartière.Dd June 6, 2018 29*69b96cd3SRomain Tartière.Dt GPIOCTL 8 30968ec6a6SOleksandr Tymoshenko.Os 31968ec6a6SOleksandr Tymoshenko.Sh NAME 32968ec6a6SOleksandr Tymoshenko.Nm gpioctl 33968ec6a6SOleksandr Tymoshenko.Nd GPIO control utility 34968ec6a6SOleksandr Tymoshenko.Sh SYNOPSIS 35968ec6a6SOleksandr Tymoshenko.Nm 3622e3858cSSean Bruno.Op Fl f Ar ctldev 37d752f0f6SLuiz Otavio O Souza.Cm -l 38968ec6a6SOleksandr Tymoshenko.Op Fl v 39968ec6a6SOleksandr Tymoshenko.Nm 4022e3858cSSean Bruno.Op Fl f Ar ctldev 413b2bb133SOleksandr Tymoshenko.Op Fl pN 42d752f0f6SLuiz Otavio O Souza.Cm -t 43968ec6a6SOleksandr Tymoshenko.Ar pin 44968ec6a6SOleksandr Tymoshenko.Nm 4522e3858cSSean Bruno.Op Fl f Ar ctldev 463b2bb133SOleksandr Tymoshenko.Op Fl pN 47d752f0f6SLuiz Otavio O Souza.Cm -c 48968ec6a6SOleksandr Tymoshenko.Ar pin 49968ec6a6SOleksandr Tymoshenko.Ar flag 50968ec6a6SOleksandr Tymoshenko.Op flag ... 51968ec6a6SOleksandr Tymoshenko.Nm 52d752f0f6SLuiz Otavio O Souza.Op Fl f Ar ctldev 533b2bb133SOleksandr Tymoshenko.Op Fl pN 54d752f0f6SLuiz Otavio O Souza.Cm -n 55d752f0f6SLuiz Otavio O Souza.Ar pin 56d752f0f6SLuiz Otavio O Souza.Ar pin-name 57d752f0f6SLuiz Otavio O Souza.Nm 5822e3858cSSean Bruno.Op Cm -f Ar ctldev 593b2bb133SOleksandr Tymoshenko.Op Fl pN 60968ec6a6SOleksandr Tymoshenko.Ar pin 61968ec6a6SOleksandr Tymoshenko.Ar [0|1] 62968ec6a6SOleksandr Tymoshenko.Sh DESCRIPTION 63968ec6a6SOleksandr TymoshenkoThe 64968ec6a6SOleksandr Tymoshenko.Nm 65968ec6a6SOleksandr Tymoshenkoutility could be used to manage GPIO pins from userland and list available pins. 66968ec6a6SOleksandr Tymoshenko.Pp 673b2bb133SOleksandr TymoshenkoThe 683b2bb133SOleksandr Tymoshenko.Pa pin 693b2bb133SOleksandr Tymoshenkoargument can either be a 703b2bb133SOleksandr Tymoshenko.Pa pin-number 713b2bb133SOleksandr Tymoshenkoor a 723b2bb133SOleksandr Tymoshenko.Pa pin-name . 733b2bb133SOleksandr TymoshenkoIf it is a number and a pin has this number as its name and you did not use 743b2bb133SOleksandr Tymoshenko.Fl N 753b2bb133SOleksandr Tymoshenkoor 763b2bb133SOleksandr Tymoshenko.Fl p 773b2bb133SOleksandr Tymoshenko, then 783b2bb133SOleksandr Tymoshenko.Nm 793b2bb133SOleksandr Tymoshenkoexits. 803b2bb133SOleksandr Tymoshenko.Pp 81968ec6a6SOleksandr TymoshenkoThe options are as follows: 82968ec6a6SOleksandr Tymoshenko.Bl -tag -width ".Fl f Ar ctldev" 83968ec6a6SOleksandr Tymoshenko.It Fl c Ar pin Ar flag Op flag ... 84de85f85aSLuiz Otavio O SouzaConfigure pin by setting provided flags. 85de85f85aSLuiz Otavio O SouzaThe following flags are currently defined: 86968ec6a6SOleksandr Tymoshenko.Bl -tag -offset indent -width ".Cm PULSE" 87968ec6a6SOleksandr Tymoshenko.It Cm IN 88968ec6a6SOleksandr TymoshenkoInput pin 89968ec6a6SOleksandr Tymoshenko.It Cm OUT 90968ec6a6SOleksandr TymoshenkoOutput pin 91968ec6a6SOleksandr Tymoshenko.It Cm OD 92968ec6a6SOleksandr TymoshenkoOpen drain pin 93968ec6a6SOleksandr Tymoshenko.It Cm PP 94968ec6a6SOleksandr TymoshenkoPush pull pin 95968ec6a6SOleksandr Tymoshenko.It Cm TS 96968ec6a6SOleksandr TymoshenkoTristate pin 97968ec6a6SOleksandr Tymoshenko.It Cm PU 98968ec6a6SOleksandr TymoshenkoPull-up pin 99968ec6a6SOleksandr Tymoshenko.It Cm PD 100968ec6a6SOleksandr TymoshenkoPull-down pin 101968ec6a6SOleksandr Tymoshenko.It Cm II 102968ec6a6SOleksandr TymoshenkoInverted input pin 103968ec6a6SOleksandr Tymoshenko.It Cm IO 104968ec6a6SOleksandr TymoshenkoInverted output pin 105968ec6a6SOleksandr Tymoshenko.El 106968ec6a6SOleksandr Tymoshenko.It Fl f Ar ctldev 107968ec6a6SOleksandr TymoshenkoGPIO controller device to use 10822e3858cSSean BrunoIf not specified, defaults to 10922e3858cSSean Bruno.Pa /dev/gpioc0 110968ec6a6SOleksandr Tymoshenko.It Fl l 111968ec6a6SOleksandr Tymoshenkolist available pins 112d752f0f6SLuiz Otavio O Souza.It Fl n Ar pin Ar pin-name 113d752f0f6SLuiz Otavio O Souzaset the name used to describe the pin 114968ec6a6SOleksandr Tymoshenko.It Fl t Ar pin 1153b2bb133SOleksandr Tymoshenkotoggle value of provided pin 116968ec6a6SOleksandr Tymoshenko.It Fl v 117968ec6a6SOleksandr Tymoshenkobe verbose: for each listed pin print current configuration 1183b2bb133SOleksandr Tymoshenko.It Fl p 1193b2bb133SOleksandr TymoshenkoForce 1203b2bb133SOleksandr Tymoshenko.Pa pin 1213b2bb133SOleksandr Tymoshenkoto be interpreted as a pin number 1223b2bb133SOleksandr Tymoshenko.It Fl N 1233b2bb133SOleksandr TymoshenkoForce 1243b2bb133SOleksandr Tymoshenko.Pa pin 1253b2bb133SOleksandr Tymoshenkoto be interpreted as a pin name 126968ec6a6SOleksandr Tymoshenko.El 127968ec6a6SOleksandr Tymoshenko.Sh EXAMPLES 128968ec6a6SOleksandr Tymoshenko.Bl -bullet 129968ec6a6SOleksandr Tymoshenko.It 130e74fe876SBenedict ReuschlingList pins available on GPIO controller defined by device /dev/gpioc0 131968ec6a6SOleksandr Tymoshenko.Pp 132e74fe876SBenedict Reuschlinggpioctl -f /dev/gpioc0 -l 133968ec6a6SOleksandr Tymoshenko.It 134968ec6a6SOleksandr TymoshenkoSet the value of pin 12 to 1 135968ec6a6SOleksandr Tymoshenko.Pp 136e74fe876SBenedict Reuschlinggpioctl -f /dev/gpioc0 12 1 137968ec6a6SOleksandr Tymoshenko.It 138968ec6a6SOleksandr TymoshenkoConfigure pin 12 to be input pin 139968ec6a6SOleksandr Tymoshenko.Pp 140e74fe876SBenedict Reuschlinggpioctl -f /dev/gpioc0 -c 12 IN 1413b2bb133SOleksandr Tymoshenko.It 1423b2bb133SOleksandr TymoshenkoSet the name of pin 12 to test 1433b2bb133SOleksandr Tymoshenko.Pp 1443b2bb133SOleksandr Tymoshenkogpioctl -f /dev/gpioc0 -n 12 test 1453b2bb133SOleksandr Tymoshenko.It 1463b2bb133SOleksandr TymoshenkoToggle the value the pin named test 1473b2bb133SOleksandr Tymoshenko.Pp 1483b2bb133SOleksandr Tymoshenkogpioctl -f /dev/gpioc0 -t test 1493b2bb133SOleksandr Tymoshenko.It 1503b2bb133SOleksandr TymoshenkoToggle the value of pin number 12 even if another pin has the name 12 1513b2bb133SOleksandr Tymoshenko.Pp 1523b2bb133SOleksandr Tymoshenkogpioctl -f /dev/gpioc0 -pt 12 153968ec6a6SOleksandr Tymoshenko.El 154dbcb0e96SSean Bruno.Sh SEE ALSO 155914f6e62SJoel Dahl.Xr gpio 4 , 156914f6e62SJoel Dahl.Xr gpioiic 4 , 1578ce07fe7SLuiz Otavio O Souza.Xr gpioled 4 158968ec6a6SOleksandr Tymoshenko.Sh HISTORY 159968ec6a6SOleksandr TymoshenkoThe 160968ec6a6SOleksandr Tymoshenko.Nm 161968ec6a6SOleksandr Tymoshenkoutility appeared in 162968ec6a6SOleksandr Tymoshenko.Fx 9.0 . 163968ec6a6SOleksandr Tymoshenko.Sh AUTHORS 164968ec6a6SOleksandr Tymoshenko.An -nosplit 165968ec6a6SOleksandr TymoshenkoThe 166968ec6a6SOleksandr Tymoshenko.Nm 167968ec6a6SOleksandr Tymoshenkoutility and this manual page were written by 16801c2b8acSBaptiste Daroussin.An Oleksandr Tymoshenko Aq Mt gonzo@freebsd.org . 169