| 1 |
.. |
| 2 |
SPDX-License-Identifier: CC-BY-SA-4.0 |
| 3 |
SPDX-FileCopyrightText: 2025 Bartosz Golaszewski <[email protected]> |
| 4 |
|
| 5 |
.. |
| 6 |
This file is part of libgpiod. |
| 7 |
|
| 8 |
GPIO D-Bus command-line client documentation |
| 9 |
|
| 10 |
Command-line client |
| 11 |
=================== |
| 12 |
|
| 13 |
With the manager running the user can run ``gpiocli`` to control GPIOs by |
| 14 |
asking the ``gpio-manager`` to act on their behalf. |
| 15 |
|
| 16 |
Examples |
| 17 |
-------- |
| 18 |
|
| 19 |
Detect chips in the system: |
| 20 |
|
| 21 |
.. code-block:: none |
| 22 |
|
| 23 |
$ gpiocli detect |
| 24 |
gpiochip0 [INT34C6:00] (463 lines) |
| 25 |
|
| 26 |
Request a set of lines: |
| 27 |
|
| 28 |
.. note:: |
| 29 |
**gpiocli** exits immediately but the state of the lines is retained |
| 30 |
because it's the **gpio-manager** that requested them. |
| 31 |
|
| 32 |
.. code-block:: none |
| 33 |
|
| 34 |
$ gpiocli request --output foo=active |
| 35 |
request0 |
| 36 |
|
| 37 |
Previous invocation printed out the name of the request by which the caller |
| 38 |
can refer to it later. All active requests can also be inspected at any time: |
| 39 |
|
| 40 |
.. code-block:: none |
| 41 |
|
| 42 |
$ gpiocli requests |
| 43 |
request0 (gpiochip1) Offsets: [5] |
| 44 |
|
| 45 |
|
| 46 |
Print the information about the requested line using the information above: |
| 47 |
|
| 48 |
.. code-block:: none |
| 49 |
|
| 50 |
$ gpiocli info --chip=gpiochip1 5 |
| 51 |
gpiochip1 5: "foo" [used,consumer="gpiocli request",managed="request0",output,push-pull] |
| 52 |
|
| 53 |
Change the value of the line: |
| 54 |
|
| 55 |
.. code-block:: none |
| 56 |
|
| 57 |
$ gpiocli set foo=inactive |
| 58 |
|
| 59 |
Read it back: |
| 60 |
|
| 61 |
.. code-block:: none |
| 62 |
|
| 63 |
$ gpiocli get foo |
| 64 |
"foo"=inactive |
| 65 |
|
| 66 |
We can even reconfigure it to input and enable edge-detection: |
| 67 |
|
| 68 |
.. code-block:: none |
| 69 |
|
| 70 |
$ gpiocli reconfigure --input --both-edges request0 |
| 71 |
|
| 72 |
And wait for edge events: |
| 73 |
|
| 74 |
.. code-block:: none |
| 75 |
|
| 76 |
$ gpiocli monitor cos |
| 77 |
21763952894920 rising "foo" |
| 78 |
|
| 79 |
And finally release the request: |
| 80 |
|
| 81 |
.. code-block:: none |
| 82 |
|
| 83 |
$ gpiocli release request0 |
| 84 |
|
| 85 |
.. note:: |
| 86 |
For more information please refer to the output of ``gpiocli --help`` as |
| 87 |
well as ``gpiocli <command> --help`` which prints detailed info on every |
| 88 |
available command. |
| 89 |
|
| 90 |
.. note:: |
| 91 |
Users can talk to **gpio-manager** using any **D-Bus** library available |
| 92 |
and are not limited to the provided client. |
| 93 |
|
| 94 |
.. toctree:: |
| 95 |
:maxdepth: 1 |
| 96 |
:caption: Manual entries |
| 97 |
|
| 98 |
gpiocli<gpiocli> |
| 99 |
gpiocli-detect<gpiocli-detect> |
| 100 |
gpiocli-find<gpiocli-find> |
| 101 |
gpiocli-info<gpiocli-info> |
| 102 |
gpiocli-get<gpiocli-get> |
| 103 |
gpiocli-monitor<gpiocli-monitor> |
| 104 |
gpiocli-notify<gpiocli-notify> |
| 105 |
gpiocli-reconfigure<gpiocli-reconfigure> |
| 106 |
gpiocli-release<gpiocli-release> |
| 107 |
gpiocli-request<gpiocli-request> |
| 108 |
gpiocli-requests<gpiocli-requests> |
| 109 |
gpiocli-set<gpiocli-set> |
| 110 |
gpiocli-wait<gpiocli-wait> |