← Documents Documentation/w1/slaves/w1_ds2406.rst GitHub 원문 ↗

Linux 6.18.37 · 1-Wire / Slave

Kernel driver w1_ds2406

DS2406 출력 스위치, ASCII 상태 표현, CRC 오류 처리를 설명합니다.

Source pathDocumentation/w1/slaves/w1_ds2406.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

w1_ds2406.rst:1-27

DS2406 출력 스위치, ASCII 상태 표현, CRC 오류 처리를 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 =======================
2 w1_ds2406 kernel driver
3 =======================
4
5 Supported chips:
6
7 * Maxim DS2406 (and other family 0x12) addressable switches
8
9 Author: Scott Alfter <scott@alfter.us>
10
11 Description
12 -----------
13
14 The w1_ds2406 driver allows connected devices to be switched on and off.
15 These chips also provide 128 bytes of OTP EPROM, but reading/writing it is
16 not supported. In TSOC-6 form, the DS2406 provides two switch outputs and
17 can be provided with power on a dedicated input. In TO-92 form, it provides
18 one output and uses parasitic power only.
19
20 The driver provides two sysfs files. state is readable; it gives the
21 current state of each switch, with PIO A in bit 0 and PIO B in bit 1. The
22 driver ORs this state with 0x30, so shell scripts get an ASCII 0/1/2/3 to
23 work with. output is writable; bits 0 and 1 control PIO A and B,
24 respectively. Bits 2-7 are ignored, so it's safe to write ASCII data.
25
26 CRCs are checked on read and write. Failed checks cause an I/O error to be
27 returned. On a failed write, the switch status is not changed.
28

3. 한국어 전문 번역

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

지원 칩과 작성자

1-10

`w1_ds2406` 드라이버는 Maxim DS2406과 family code `0x12`의 다른 주소 지정 스위치를 지원합니다. 문서 작성자는 Scott Alfter입니다.

DS2406 지원 정보
항목
Maxim DS2406 및 family 0x12 스위치
기능주소 지정 가능한 PIO 스위치
작성자Scott Alfter <scott@alfter.us>

드라이버가 인식하는 제품군입니다.

=======================
w1_ds2406 kernel driver
=======================

Supported chips:

  * Maxim DS2406 (and other family 0x12) addressable switches

Author: Scott Alfter <scott@alfter.us>

출력 형식과 오류 처리

11-27

드라이버는 연결된 장치를 켜고 끌 수 있게 합니다. 칩에는 128바이트 OTP EPROM도 있지만 이 드라이버는 EPROM 읽기와 쓰기를 지원하지 않습니다.

TSOC-6 패키지는 두 스위치 출력과 별도 전원 입력을 제공하고, TO-92 패키지는 한 출력만 제공하며 기생 전원만 사용합니다.

sysfs의 `state`는 읽기 전용입니다. PIO A 상태가 비트 0, PIO B 상태가 비트 1에 들어가며, 드라이버는 상태값에 `0x30`을 OR하여 셸 스크립트가 ASCII `0`, `1`, `2`, `3`으로 읽을 수 있게 합니다.

`output`은 쓰기 가능하며 비트 0과 1이 각각 PIO A와 PIO B를 제어합니다. 비트 2~7은 무시되므로 ASCII 데이터를 써도 안전합니다.

읽기와 쓰기 모두 CRC를 확인합니다. 검사가 실패하면 I/O 오류를 반환하고, 쓰기 실패 시 스위치 상태는 바뀌지 않습니다.

DS2406 sysfs
파일접근비트동작
state읽기bit 0PIO A 상태
state읽기bit 1PIO B 상태
state읽기OR 0x30ASCII 0/1/2/3 반환
output쓰기bit 0PIO A 제어
output쓰기bit 1PIO B 제어
output쓰기bit 2~7무시

노출되는 두 파일과 비트 의미입니다.

DS2406 쓰기
output에 제어 바이트 쓰기비트 0·1을 PIO A·B에 대응전송 CRC 검사성공하면 상태 변경실패하면 I/O 오류와 기존 상태 유지

출력 변경은 CRC 확인 뒤에만 확정됩니다.

Description
-----------

The w1_ds2406 driver allows connected devices to be switched on and off.
These chips also provide 128 bytes of OTP EPROM, but reading/writing it is
not supported.  In TSOC-6 form, the DS2406 provides two switch outputs and
can be provided with power on a dedicated input.  In TO-92 form, it provides
one output and uses parasitic power only.

The driver provides two sysfs files.  state is readable; it gives the
current state of each switch, with PIO A in bit 0 and PIO B in bit 1.  The
driver ORs this state with 0x30, so shell scripts get an ASCII 0/1/2/3 to
work with.  output is writable; bits 0 and 1 control PIO A and B,
respectively.  Bits 2-7 are ignored, so it's safe to write ASCII data.

CRCs are checked on read and write.  Failed checks cause an I/O error to be
returned.  On a failed write, the switch status is not changed.