← Documents Documentation/leds/ledtrig-usbport.rst GitHub 원문 ↗

Linux 6.18.37 · LEDs

USB Port LED Trigger

하나의 LED로 여러 USB port와 controller의 device 존재를 표시하는 trigger입니다.

Source pathDocumentation/leds/ledtrig-usbport.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

ledtrig-usbport.rst:1-46

선택한 USB port 가운데 하나에라도 device가 있으면 LED가 켜지며 여러 hub port를 한 LED에 묶을 수 있습니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 ====================
2 USB port LED trigger
3 ====================
4
5 This LED trigger can be used for signalling to the user a presence of USB device
6 in a given port. It simply turns on LED when device appears and turns it off
7 when it disappears.
8
9 It requires selecting USB ports that should be observed. All available ones are
10 listed as separated entries in a "ports" subdirectory. Selecting is handled by
11 echoing "1" to a chosen port.
12
13 Please note that this trigger allows selecting multiple USB ports for a single
14 LED.
15
16 This can be useful in two cases:
17
18 1) Device with single USB LED and few physical ports
19 ====================================================
20
21 In such a case LED will be turned on as long as there is at least one connected
22 USB device.
23
24 2) Device with a physical port handled by few controllers
25 =========================================================
26
27 Some devices may have one controller per PHY standard. E.g. USB 3.0 physical
28 port may be handled by ohci-platform, ehci-platform and xhci-hcd. If there is
29 only one LED user will most likely want to assign ports from all 3 hubs.
30
31
32 This trigger can be activated from user space on led class devices as shown
33 below::
34
35 echo usbport > trigger
36
37 This adds sysfs attributes to the LED that are documented in:
38 Documentation/ABI/testing/sysfs-class-led-trigger-usbport
39
40 Example use-case::
41
42 echo usbport > trigger
43 echo 1 > ports/usb1-port1
44 echo 1 > ports/usb2-port1
45 cat ports/usb1-port1
46 echo 0 > ports/usb1-port1
47

3. 한국어 전문 번역

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

USB port 관찰 선택

1-16

USB port LED trigger는 지정 port에 USB device가 존재하는지 사용자에게 표시합니다. Device가 나타나면 LED를 켜고 사라지면 끕니다.

관찰할 USB port를 명시적으로 선택해야 합니다. 사용 가능한 port는 `ports` 하위 directory에 개별 entry로 나타나며 원하는 port file에 `1`을 써서 선택합니다.

하나의 LED에 여러 USB port를 연결할 수 있습니다.

USB port LED 조건
`ports` directory에서 관찰할 port 선택선택 port에 device가 하나 이상 존재LED on선택 port에서 device가 모두 사라짐LED off

선택한 port들의 device 존재 여부를 하나의 LED로 합칩니다.

====================
USB port LED trigger
====================

This LED trigger can be used for signalling to the user a presence of USB device
in a given port. It simply turns on LED when device appears and turns it off
when it disappears.

It requires selecting USB ports that should be observed. All available ones are
listed as separated entries in a "ports" subdirectory. Selecting is handled by
echoing "1" to a chosen port.

Please note that this trigger allows selecting multiple USB ports for a single
LED.

This can be useful in two cases:

다중 port와 다중 controller 사례

17-33

첫째 사례는 물리 USB port는 여러 개지만 LED는 하나인 장치입니다. 선택한 port 중 하나라도 USB device가 연결되어 있는 동안 LED가 켜집니다.

둘째 사례는 하나의 물리 port를 PHY 표준별 여러 controller가 처리하는 장치입니다. 예를 들어 USB 3.0 물리 port가 `ohci-platform`, `ehci-platform`, `xhci-hcd`의 hub port로 각각 나타날 수 있습니다.

물리 LED가 하나라면 세 hub의 해당 port를 모두 같은 LED에 배정하는 것이 일반적인 사용자 기대와 맞습니다.

USB port trigger 활용
장치 구조선택 방식LED on 조건
물리 port 여러 개, LED 하나여러 port 선택하나 이상 연결
물리 port 하나, controller 여러 개각 hub의 대응 port 선택어느 controller에서든 연결

다중 선택 기능이 필요한 두 구조입니다.


1) Device with single USB LED and few physical ports
====================================================

In such a case LED will be turned on as long as there is at least one connected
USB device.

2) Device with a physical port handled by few controllers
=========================================================

Some devices may have one controller per PHY standard. E.g. USB 3.0 physical
port may be handled by ohci-platform, ehci-platform and xhci-hcd. If there is
only one LED user will most likely want to assign ports from all 3 hubs.


This trigger can be activated from user space on led class devices as shown
below::

Sysfs 활성화 예제

34-46

LED class device에서 `echo usbport > trigger`로 활성화합니다. 추가 sysfs attribute는 `Documentation/ABI/testing/sysfs-class-led-trigger-usbport`에 문서화되어 있습니다.

예제는 `ports/usb1-port1`과 `ports/usb2-port1`에 각각 `1`을 써서 두 port를 선택하고, `cat ports/usb1-port1`으로 선택 상태를 읽은 뒤 `0`을 써서 첫 port를 해제합니다.


  echo usbport > trigger

This adds sysfs attributes to the LED that are documented in:
Documentation/ABI/testing/sysfs-class-led-trigger-usbport

Example use-case::

  echo usbport > trigger
  echo 1 > ports/usb1-port1
  echo 1 > ports/usb2-port1
  cat ports/usb1-port1
  echo 0 > ports/usb1-port1