File: gpiocli_top.rst

package info (click to toggle)
libgpiod 2.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,108 kB
  • sloc: ansic: 26,612; sh: 7,554; cpp: 4,944; python: 2,426; makefile: 811; xml: 49
file content (110 lines) | stat: -rw-r--r-- 2,538 bytes parent folder | download | duplicates (2)
1
2
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
..
   SPDX-License-Identifier: CC-BY-SA-4.0
   SPDX-FileCopyrightText: 2025 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

..
   This file is part of libgpiod.

   GPIO D-Bus command-line client documentation

Command-line client
===================

With the manager running the user can run ``gpiocli`` to control GPIOs by
asking the ``gpio-manager`` to act on their behalf.

Examples
--------

Detect chips in the system:

.. code-block:: none

   $ gpiocli detect
   gpiochip0 [INT34C6:00] (463 lines)

Request a set of lines:

.. note::
   **gpiocli** exits immediately but the state of the lines is retained
   because it's the **gpio-manager** that requested them.

.. code-block:: none

   $ gpiocli request --output foo=active
   request0

Previous invocation printed out the name of the request by which the caller
can refer to it later. All active requests can also be inspected at any time:

.. code-block:: none

   $ gpiocli requests
   request0 (gpiochip1) Offsets: [5]


Print the information about the requested line using the information above:

.. code-block:: none

   $ gpiocli info --chip=gpiochip1 5
   gpiochip1   5:      "foo"           [used,consumer="gpiocli request",managed="request0",output,push-pull]

Change the value of the line:

.. code-block:: none

   $ gpiocli set foo=inactive

Read it back:

.. code-block:: none

   $ gpiocli get foo
   "foo"=inactive

We can even reconfigure it to input and enable edge-detection:

.. code-block:: none

   $ gpiocli reconfigure --input --both-edges request0

And wait for edge events:

.. code-block:: none

   $ gpiocli monitor cos
   21763952894920 rising  "foo"

And finally release the request:

.. code-block:: none

   $ gpiocli release request0

.. note::
   For more information please refer to the output of ``gpiocli --help`` as
   well as ``gpiocli <command> --help`` which prints detailed info on every
   available command.

.. note::
   Users can talk to **gpio-manager** using any **D-Bus** library available
   and are not limited to the provided client.

.. toctree::
   :maxdepth: 1
   :caption: Manual entries

   gpiocli<gpiocli>
   gpiocli-detect<gpiocli-detect>
   gpiocli-find<gpiocli-find>
   gpiocli-info<gpiocli-info>
   gpiocli-get<gpiocli-get>
   gpiocli-monitor<gpiocli-monitor>
   gpiocli-notify<gpiocli-notify>
   gpiocli-reconfigure<gpiocli-reconfigure>
   gpiocli-release<gpiocli-release>
   gpiocli-request<gpiocli-request>
   gpiocli-requests<gpiocli-requests>
   gpiocli-set<gpiocli-set>
   gpiocli-wait<gpiocli-wait>