요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
==============
Userspace LEDs
==============
The uleds driver supports userspace LEDs. This can be useful for testing
triggers and can also be used to implement virtual LEDs.
Usage
=====
When the driver is loaded, a character device is created at /dev/uleds. To
create a new LED class device, open /dev/uleds and write a uleds_user_dev
structure to it (found in kernel public header file linux/uleds.h)::
#define LED_MAX_NAME_SIZE 64
struct uleds_user_dev {
char name[LED_MAX_NAME_SIZE];
};
A new LED class device will be created with the name given. The name can be
any valid sysfs device node name, but consider using the LED class naming
convention of "devicename:color:function".
The current brightness is found by reading a single byte from the character
device. Values are unsigned: 0 to 255. Reading will block until the brightness
changes. The device node can also be polled to notify when the brightness value
changes.
The LED class device will be removed when the open file handle to /dev/uleds
is closed.
Multiple LED class devices are created by opening additional file handles to
/dev/uleds.
See tools/leds/uledmon.c for an example userspace program.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Userspace LED 생성
1-19`uleds` driver는 userspace LED를 지원합니다. Trigger 시험과 virtual LED 구현에 사용할 수 있습니다.
Driver를 load하면 `/dev/uleds` character device가 생깁니다. 새 LED class device를 만들려면 `/dev/uleds`를 열고 kernel public header `linux/uleds.h`의 `uleds_user_dev` 구조체를 씁니다.
구조체는 `LED_MAX_NAME_SIZE` 64-byte 크기의 `name` 배열 하나를 갖습니다.
Character device에 쓰는 public 구조체입니다.
==============
Userspace LEDs
==============
The uleds driver supports userspace LEDs. This can be useful for testing
triggers and can also be used to implement virtual LEDs.
Usage
=====
When the driver is loaded, a character device is created at /dev/uleds. To
create a new LED class device, open /dev/uleds and write a uleds_user_dev
structure to it (found in kernel public header file linux/uleds.h)::
#define LED_MAX_NAME_SIZE 64
struct uleds_user_dev {
char name[LED_MAX_NAME_SIZE];
Brightness와 file handle 수명
20-37새 LED class device는 구조체의 name으로 생성됩니다. 유효한 sysfs device node 이름이면 무엇이든 가능하지만 `devicename:color:function` LED class naming convention을 권장합니다.
Character device에서 한 byte를 읽으면 현재 brightness를 얻습니다. 값은 unsigned 0~255이며 brightness가 바뀔 때까지 read가 block됩니다. Poll로 brightness 변경 notification을 받을 수도 있습니다.
열려 있는 `/dev/uleds` file handle을 닫으면 대응 LED class device가 제거됩니다. 추가 file handle을 열 때마다 별도 LED class device를 만들 수 있습니다.
Userspace 예제 program은 `tools/leds/uledmon.c`에 있습니다.
File handle 하나가 virtual LED 하나의 수명을 소유합니다.
};
A new LED class device will be created with the name given. The name can be
any valid sysfs device node name, but consider using the LED class naming
convention of "devicename:color:function".
The current brightness is found by reading a single byte from the character
device. Values are unsigned: 0 to 255. Reading will block until the brightness
changes. The device node can also be polled to notify when the brightness value
changes.
The LED class device will be removed when the open file handle to /dev/uleds
is closed.
Multiple LED class devices are created by opening additional file handles to
/dev/uleds.
See tools/leds/uledmon.c for an example userspace program.
요약·해설
uleds.rst:1-37열린 `/dev/uleds` handle 하나가 LED class device 하나의 생성과 제거 수명을 소유합니다.