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

Linux 6.18.37 · Userspace API

GPIO_V2_GET_LINEINFO_WATCH_IOCTL

GPIO ABI v2 line-info 변경 감시의 범위, chip_fd별 독립성, event 읽기 경로를 설명합니다.

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

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

1. 요약·해설

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

요약·해설

gpio-v2-get-lineinfo-watch-ioctl.rst:1-67

GPIO ABI v2 line-info 변경 감시의 범위, chip_fd별 독립성, event 읽기 경로를 설명합니다.

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

2. 영어 원문 전체

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

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

3. 한국어 전문 번역

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

이름과 호출 형식

1-31

`GPIO_V2_GET_LINEINFO_WATCH_IOCTL`은 GPIO line의 요청 상태와 configuration 정보 변경 감시를 활성화합니다. 호출 형식은 `int ioctl(int chip_fd, GPIO_V2_GET_LINEINFO_WATCH_IOCTL, struct gpio_v2_line_info *info)`입니다.

`chip_fd`는 GPIO character device descriptor입니다. `info`는 kernel이 현재 정보로 채울 `gpio_v2_line_info`이며 감시할 line을 선택하도록 `offset`을 미리 설정합니다.

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

대상 offset과 반환 metadata를 하나의 구조체로 전달합니다.

.. SPDX-License-Identifier: GPL-2.0

.. _GPIO_V2_GET_LINEINFO_WATCH_IOCTL:

********************************
GPIO_V2_GET_LINEINFO_WATCH_IOCTL
********************************

Name
====

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

Synopsis
========

.. c:macro:: GPIO_V2_GET_LINEINFO_WATCH_IOCTL

``int ioctl(int chip_fd, GPIO_V2_GET_LINEINFO_WATCH_IOCTL, struct gpio_v2_line_info *info)``

Arguments
=========

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

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

감시 범위와 값/event 접근

32-47

Line request, release 또는 reconfiguration이 발생하면 line info 변경 event가 생성됩니다. 이 감시는 보통 system monitoring component에서만 필요합니다.

Line info에는 line 값이 포함되지 않습니다. 값에 접근하려면 `gpio-v2-get-line-ioctl.rst`로 line을 요청하고, edge event는 line request에서 `gpio-v2-line-event-read.rst`로 읽습니다.

V2 감시 경로 구분
항목설명
Request/release/reconfigureLine info changed event
Line valueV2 line request 후 get-values
Edge eventV2 line request fd에서 event read

Metadata 변경과 값·edge event는 서로 다른 인터페이스입니다.

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-v2-get-line-ioctl.rst to access
    its value, and the line request can monitor a line for events using
    gpio-v2-line-event-read.rst.

등록과 chip_fd별 독립성

48-60

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

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

Watch는 특정 `chip_fd`에만 속하며 같은 GPIO chip을 별도의 `open()`으로 연 descriptor의 watch와 독립적입니다.

V2 line info watch
GPIO chip open모든 line unwatchedoffset별 watch 추가Line info 변경 발생chip_fd에서 changed event 읽기별도 open의 watch와 독립

각 open instance가 자체 감시 집합을 유지합니다.

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-v2-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()`.

반환값

61-67

성공하면 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.