← Documents Documentation/userspace-api/gpio/gpio-get-lineinfo-watch-ioctl.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API

GPIO_GET_LINEINFO_WATCH_IOCTL

ABI v1에서 line 요청·해제·재구성 정보를 chip_fd별로 감시하는 ioctl을 설명합니다.

Source pathDocumentation/userspace-api/gpio/gpio-get-lineinfo-watch-ioctl.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

gpio-get-lineinfo-watch-ioctl.rst:1-74

ABI v1에서 line 요청·해제·재구성 정보를 chip_fd별로 감시하는 ioctl을 설명합니다.

원문의 read/ioctl prototype, struct, flag, errno, clock, buffer 규칙과 줄 좌표를 보존해 전문 번역했습니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 .. _GPIO_GET_LINEINFO_WATCH_IOCTL:
4
5 *****************************
6 GPIO_GET_LINEINFO_WATCH_IOCTL
7 *****************************
8
9 .. warning::
10 This ioctl is part of chardev_v1.rst and is obsoleted by
11 gpio-v2-get-lineinfo-watch-ioctl.rst.
12
13 Name
14 ====
15
16 GPIO_GET_LINEINFO_WATCH_IOCTL - Enable watching a line for changes to its
17 request state and configuration information.
18
19 Synopsis
20 ========
21
22 .. c:macro:: GPIO_GET_LINEINFO_WATCH_IOCTL
23
24 ``int ioctl(int chip_fd, GPIO_GET_LINEINFO_WATCH_IOCTL, struct gpioline_info *info)``
25
26 Arguments
27 =========
28
29 ``chip_fd``
30 The file descriptor of the GPIO character device returned by `open()`.
31
32 ``info``
33 The :c:type:`line_info<gpioline_info>` struct to be populated, with
34 the ``offset`` set to indicate the line to watch
35
36 Description
37 ===========
38
39 Enable watching a line for changes to its request state and configuration
40 information. Changes to line info include a line being requested, released
41 or reconfigured.
42
43 .. note::
44 Watching line info is not generally required, and would typically only be
45 used by a system monitoring component.
46
47 The line info does NOT include the line value.
48
49 The line must be requested using gpio-get-linehandle-ioctl.rst or
50 gpio-get-lineevent-ioctl.rst to access its value, and the line event can
51 monitor a line for events using gpio-lineevent-data-read.rst.
52
53 By default all lines are unwatched when the GPIO chip is opened.
54
55 Multiple lines may be watched simultaneously by adding a watch for each.
56
57 Once a watch is set, any changes to line info will generate events which can be
58 read from the ``chip_fd`` as described in
59 gpio-lineinfo-changed-read.rst.
60
61 Adding a watch to a line that is already watched is an error (**EBUSY**).
62
63 Watches are specific to the ``chip_fd`` and are independent of watches
64 on the same GPIO chip opened with a separate call to `open()`.
65
66 First added in 5.7.
67
68 Return Value
69 ============
70
71 On success 0 and ``info`` is populated with the current line info.
72
73 On error -1 and the ``errno`` variable is set appropriately.
74 Common error codes are described in error-codes.rst.
75

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

상태, 이름, 호출 형식

1-35

`GPIO_GET_LINEINFO_WATCH_IOCTL`은 GPIO line의 요청 상태와 configuration 정보가 바뀌는지 감시하도록 설정합니다. ABI v1의 ioctl이며 `gpio-v2-get-lineinfo-watch-ioctl.rst`로 대체되었습니다.

호출 형식은 `int ioctl(int chip_fd, GPIO_GET_LINEINFO_WATCH_IOCTL, struct gpioline_info *info)`입니다. `chip_fd`는 GPIO character device를 `open()`해 얻습니다. `info`는 kernel이 채울 `gpioline_info` 구조체이며, 감시할 line을 고르도록 호출 전에 `offset`을 설정합니다.

Line info watch 인자
항목설명
chip_fdGPIO character device file descriptor
info.offset감시할 line offset
info현재 line info가 채워질 구조체

입출력 구조체가 감시 대상과 현재 정보를 함께 전달합니다.

.. SPDX-License-Identifier: GPL-2.0

.. _GPIO_GET_LINEINFO_WATCH_IOCTL:

*****************************
GPIO_GET_LINEINFO_WATCH_IOCTL
*****************************

.. warning::
    This ioctl is part of chardev_v1.rst and is obsoleted by
    gpio-v2-get-lineinfo-watch-ioctl.rst.

Name
====

GPIO_GET_LINEINFO_WATCH_IOCTL - Enable watching a line for changes to its
request state and configuration information.

Synopsis
========

.. c:macro:: GPIO_GET_LINEINFO_WATCH_IOCTL

``int ioctl(int chip_fd, GPIO_GET_LINEINFO_WATCH_IOCTL, struct gpioline_info *info)``

Arguments
=========

``chip_fd``
    The file descriptor of the GPIO character device returned by `open()`.

``info``
    The :c:type:`line_info<gpioline_info>` struct to be populated, with
    the ``offset`` set to indicate the line to watch

감시 대상과 값 접근

36-52

감시 대상은 line의 요청 상태와 configuration 정보입니다. Line이 요청되거나 해제되거나 재구성되면 line info 변경으로 간주합니다.

일반적인 프로그램에는 line info 감시가 필요하지 않으며 보통 system monitoring component가 사용합니다. Line info에는 line 값이 포함되지 않습니다.

값에 접근하려면 `gpio-get-linehandle-ioctl.rst` 또는 `gpio-get-lineevent-ioctl.rst`로 line을 요청해야 합니다. Line event의 edge event는 `gpio-lineevent-data-read.rst`로 감시합니다.

감시되는 변경과 감시되지 않는 정보
항목설명
Line requestedLine info event 생성
Line releasedLine info event 생성
Line reconfiguredLine info event 생성
Line valueLine info에 포함되지 않음
Edge eventLine event fd에서 별도로 읽음

Line metadata 감시와 값/edge 감시는 별도 경로입니다.

Description
===========

Enable watching a line for changes to its request state and configuration
information. Changes to line info include a line being requested, released
or reconfigured.

.. note::
    Watching line info is not generally required, and would typically only be
    used by a system monitoring component.

    The line info does NOT include the line value.

    The line must be requested using gpio-get-linehandle-ioctl.rst or
    gpio-get-lineevent-ioctl.rst to access its value, and the line event can
    monitor a line for events using gpio-lineevent-data-read.rst.

등록, 이벤트 읽기, fd별 독립성

53-67

GPIO chip을 열면 기본적으로 모든 line은 감시하지 않는 상태입니다. 여러 line을 동시에 감시하려면 각 line에 watch를 하나씩 추가합니다.

Watch를 설정한 뒤 line info가 바뀌면 event가 생성되고 `gpio-lineinfo-changed-read.rst`의 방식으로 `chip_fd`에서 읽을 수 있습니다. 이미 감시 중인 line에 watch를 다시 추가하면 `EBUSY`입니다.

Watch는 특정 `chip_fd`에 속합니다. 같은 GPIO chip을 별도의 `open()` 호출로 열어 만든 다른 descriptor의 watch와는 독립적입니다. 이 ioctl은 Linux 5.7에서 처음 추가되었습니다.

Line info watch 수명
GPIO chip open모든 line이 unwatched 상태offset별 watch 추가Request/release/reconfigure 발생chip_fd에서 changed event 읽기다른 open의 chip_fd에는 영향 없음

각 chip_fd가 자체 감시 집합과 event stream을 가집니다.

By default all lines are unwatched when the GPIO chip is opened.

Multiple lines may be watched simultaneously by adding a watch for each.

Once a watch is set, any changes to line info will generate events which can be
read from the ``chip_fd`` as described in
gpio-lineinfo-changed-read.rst.

Adding a watch to a line that is already watched is an error (**EBUSY**).

Watches are specific to the ``chip_fd`` and are independent of watches
on the same GPIO chip opened with a separate call to `open()`.

First added in 5.7.

반환값

68-74

성공하면 0을 반환하고 `info`를 현재 line 정보로 채웁니다. 실패하면 -1을 반환하고 `errno`를 설정합니다. 공통 오류 코드는 `error-codes.rst`에 설명되어 있습니다.

Return Value
============

On success 0 and ``info`` is populated with the current line info.

On error -1 and the ``errno`` variable is set appropriately.
Common error codes are described in error-codes.rst.