요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
====================
One-shot LED Trigger
====================
This is a LED trigger useful for signaling the user of an event where there are
no clear trap points to put standard led-on and led-off settings. Using this
trigger, the application needs only to signal the trigger when an event has
happened, then the trigger turns the LED on and then keeps it off for a
specified amount of time.
This trigger is meant to be usable both for sporadic and dense events. In the
first case, the trigger produces a clear single controlled blink for each
event, while in the latter it keeps blinking at constant rate, as to signal
that the events are arriving continuously.
A one-shot LED only stays in a constant state when there are no events. An
additional "invert" property specifies if the LED has to stay off (normal) or
on (inverted) when not rearmed.
The trigger can be activated from user space on led class devices as shown
below::
echo oneshot > trigger
This adds sysfs attributes to the LED that are documented in:
Documentation/ABI/testing/sysfs-class-led-trigger-oneshot
Example use-case: network devices, initialization::
echo oneshot > trigger # set trigger for this led
echo 33 > delay_on # blink at 1 / (33 + 33) Hz on continuous traffic
echo 33 > delay_off
interface goes up::
echo 1 > invert # set led as normally-on, turn the led on
packet received/transmitted::
echo 1 > shot # led starts blinking, ignored if already blinking
interface goes down::
echo 0 > invert # set led as normally-off, turn the led off
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
One-shot trigger 동작
1-24One-shot LED trigger는 표준 LED on·off 지점을 코드에 넣기 어려운 event를 사용자에게 알릴 때 사용합니다. Application은 event가 발생했음을 trigger에 알리기만 하면 되고, trigger가 LED를 켠 뒤 지정 시간 동안 끈 상태를 유지합니다.
간헐적 event에서는 event마다 명확한 단일 blink를 만들고, 조밀한 event에서는 일정한 rate로 계속 blink하여 event가 연속 유입됨을 나타냅니다.
Event가 없을 때만 LED가 일정 상태에 머뭅니다. `invert`가 0인 normal mode에서는 재무장되지 않은 동안 off, invert mode에서는 on 상태를 유지합니다.
LED class device에서 `echo oneshot > trigger`로 활성화하며 생성되는 sysfs attribute는 `Documentation/ABI/testing/sysfs-class-led-trigger-oneshot`에 정의됩니다.
동일 trigger가 드문 event와 연속 event를 모두 표현합니다.
====================
One-shot LED Trigger
====================
This is a LED trigger useful for signaling the user of an event where there are
no clear trap points to put standard led-on and led-off settings. Using this
trigger, the application needs only to signal the trigger when an event has
happened, then the trigger turns the LED on and then keeps it off for a
specified amount of time.
This trigger is meant to be usable both for sporadic and dense events. In the
first case, the trigger produces a clear single controlled blink for each
event, while in the latter it keeps blinking at constant rate, as to signal
that the events are arriving continuously.
A one-shot LED only stays in a constant state when there are no events. An
additional "invert" property specifies if the LED has to stay off (normal) or
on (inverted) when not rearmed.
The trigger can be activated from user space on led class devices as shown
below::
echo oneshot > trigger
Network interface 예제
25-44Network initialization 예제는 trigger를 `oneshot`으로 설정하고 `delay_on`과 `delay_off`를 각각 33으로 설정합니다. 연속 traffic에서는 `1 / (33 + 33)` 밀리초 주기에 해당하는 속도로 blink합니다.
Interface가 올라오면 `invert = 1`로 normally-on 상태를 만들고 LED를 켭니다. Packet을 송수신하면 `shot = 1`로 blink를 시작하며 이미 blink 중이면 이 요청은 무시됩니다.
Interface가 내려가면 `invert = 0`으로 normally-off 상태로 되돌리고 LED를 끕니다.
Interface 상태와 packet event가 LED 상태를 바꾸는 순서입니다.
This adds sysfs attributes to the LED that are documented in:
Documentation/ABI/testing/sysfs-class-led-trigger-oneshot
Example use-case: network devices, initialization::
echo oneshot > trigger # set trigger for this led
echo 33 > delay_on # blink at 1 / (33 + 33) Hz on continuous traffic
echo 33 > delay_off
interface goes up::
echo 1 > invert # set led as normally-on, turn the led on
packet received/transmitted::
echo 1 > shot # led starts blinking, ignored if already blinking
interface goes down::
echo 0 > invert # set led as normally-off, turn the led off
요약·해설
ledtrig-oneshot.rst:1-44One-shot은 event가 없을 때의 정상 상태를 invert로 정하고, event마다 shot을 재무장합니다.