← Documents Documentation/admin-guide/laptops/sony-laptop.rst GitHub 원문 ↗

Linux 6.18.37 · Administration / Laptops

Sony Notebook Control Driver (SNC) Readme

Sony Vaio의 SNC·SPIC hotkey, backlight, platform sysfs, rfkill과 reverse-engineering 개발 위험을 설명합니다.

Source pathDocumentation/admin-guide/laptops/sony-laptop.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

SNC와 hotkey

sony-laptop.rst:1-27

통합 driver와 scancode mapping을 설명합니다.

Backlight와 platform sysfs

sony-laptop.rst:28-99

brightness·장치 전원·fan file과 사용 예제를 제공합니다.

RFkill과 개발

sony-laptop.rst:100-159

rfkill 조회, debug mode와 SNC capability method 조사법을 설명합니다.

제한 사항

sony-laptop.rst:160-174

공식 문서 부재, 영구 손상 위험과 sonypi 대체 상태를 기록합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 =========================================
2 Sony Notebook Control Driver (SNC) Readme
3 =========================================
4
5 - Copyright (C) 2004- 2005 Stelian Pop <[email protected]>
6 - Copyright (C) 2007 Mattia Dongili <[email protected]>
7
8 This mini-driver drives the SNC and SPIC device present in the ACPI BIOS of the
9 Sony Vaio laptops. This driver mixes both devices functions under the same
10 (hopefully consistent) interface. This also means that the sonypi driver is
11 obsoleted by sony-laptop now.
12
13 Fn keys (hotkeys):
14 ------------------
15
16 Some models report hotkeys through the SNC or SPIC devices, such events are
17 reported both through the ACPI subsystem as acpi events and through the INPUT
18 subsystem. See the logs of /proc/bus/input/devices to find out what those
19 events are and which input devices are created by the driver.
20 Additionally, loading the driver with the debug option will report all events
21 in the kernel log.
22
23 The "scancodes" passed to the input system (that can be remapped with udev)
24 are indexes to the table "sony_laptop_input_keycode_map" in the sony-laptop.c
25 module. For example the "FN/E" key combination (EJECTCD on some models)
26 generates the scancode 20 (0x14).
27
28 Backlight control:
29 ------------------
30 If your laptop model supports it, you will find sysfs files in the
31 /sys/class/backlight/sony/
32 directory. You will be able to query and set the current screen
33 brightness:
34
35 ====================== =========================================
36 brightness get/set screen brightness (an integer
37 between 0 and 7)
38 actual_brightness reading from this file will query the HW
39 to get real brightness value
40 max_brightness the maximum brightness value
41 ====================== =========================================
42
43
44 Platform specific:
45 ------------------
46 Loading the sony-laptop module will create a
47 /sys/devices/platform/sony-laptop/
48 directory populated with some files.
49
50 You then read/write integer values from/to those files by using
51 standard UNIX tools.
52
53 The files are:
54
55 ====================== ==========================================
56 brightness_default screen brightness which will be set
57 when the laptop will be rebooted
58 cdpower power on/off the internal CD drive
59 audiopower power on/off the internal sound card
60 lanpower power on/off the internal ethernet card
61 (only in debug mode)
62 bluetoothpower power on/off the internal bluetooth device
63 fanspeed get/set the fan speed
64 ====================== ==========================================
65
66 Note that some files may be missing if they are not supported
67 by your particular laptop model.
68
69 Example usage::
70
71 # echo "1" > /sys/devices/platform/sony-laptop/brightness_default
72
73 sets the lowest screen brightness for the next and later reboots
74
75 ::
76
77 # echo "8" > /sys/devices/platform/sony-laptop/brightness_default
78
79 sets the highest screen brightness for the next and later reboots
80
81 ::
82
83 # cat /sys/devices/platform/sony-laptop/brightness_default
84
85 retrieves the value
86
87 ::
88
89 # echo "0" > /sys/devices/platform/sony-laptop/audiopower
90
91 powers off the sound card
92
93 ::
94
95 # echo "1" > /sys/devices/platform/sony-laptop/audiopower
96
97 powers on the sound card.
98
99
100 RFkill control:
101 ---------------
102 More recent Vaio models expose a consistent set of ACPI methods to
103 control radio frequency emitting devices. If you are a lucky owner of
104 such a laptop you will find the necessary rfkill devices under
105 /sys/class/rfkill. Check those starting with sony-* in::
106
107 # grep . /sys/class/rfkill/*/{state,name}
108
109
110 Development:
111 ------------
112
113 If you want to help with the development of this driver (and
114 you are not afraid of any side effects doing strange things with
115 your ACPI BIOS could have on your laptop), load the driver and
116 pass the option 'debug=1'.
117
118 REPEAT:
119 **DON'T DO THIS IF YOU DON'T LIKE RISKY BUSINESS.**
120
121 In your kernel logs you will find the list of all ACPI methods
122 the SNC device has on your laptop.
123
124 * For new models you will see a long list of meaningless method names,
125 reading the DSDT table source should reveal that:
126
127 (1) the SNC device uses an internal capability lookup table
128 (2) SN00 is used to find values in the lookup table
129 (3) SN06 and SN07 are used to call into the real methods based on
130 offsets you can obtain iterating the table using SN00
131 (4) SN02 used to enable events.
132
133 Some values in the capability lookup table are more or less known, see
134 the code for all sony_call_snc_handle calls, others are more obscure.
135
136 * For old models you can see the GCDP/GCDP methods used to pwer on/off
137 the CD drive, but there are others and they are usually different from
138 model to model.
139
140 **I HAVE NO IDEA WHAT THOSE METHODS DO.**
141
142 The sony-laptop driver creates, for some of those methods (the most
143 current ones found on several Vaio models), an entry under
144 /sys/devices/platform/sony-laptop, just like the 'cdpower' one.
145 You can create other entries corresponding to your own laptop methods by
146 further editing the source (see the 'sony_nc_values' table, and add a new
147 entry to this table with your get/set method names using the
148 SNC_HANDLE_NAMES macro).
149
150 Your mission, should you accept it, is to try finding out what
151 those entries are for, by reading/writing random values from/to those
152 files and find out what is the impact on your laptop.
153
154 Should you find anything interesting, please report it back to me,
155 I will not disavow all knowledge of your actions :)
156
157 See also http://www.linux.it/~malattia/wiki/index.php/Sony_drivers for other
158 useful info.
159
160 Bugs/Limitations:
161 -----------------
162
163 * This driver is not based on official documentation from Sony
164 (because there is none), so there is no guarantee this driver
165 will work at all, or do the right thing. Although this hasn't
166 happened to me, this driver could do very bad things to your
167 laptop, including permanent damage.
168
169 * The sony-laptop and sonypi drivers do not interact at all. In the
170 future, sonypi will be removed and replaced by sony-laptop.
171
172 * spicctrl, which is the userspace tool used to communicate with the
173 sonypi driver (through /dev/sonypi) is deprecated as well since all
174 its features are now available under the sysfs tree via sony-laptop.
175

3. 한국어 전문 번역

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

Sony Notebook Control Driver와 hotkey

1-27

Copyright (C) 2004-2005 Stelian Pop <[email protected]>

Copyright (C) 2007 Mattia Dongili <[email protected]>

이 mini-driver는 Sony Vaio laptop의 ACPI BIOS에 있는 SNC와 SPIC device를 구동합니다. 두 device 기능을 하나의 일관된 interface로 결합하며, 이 때문에 `sonypi` driver는 이제 `sony-laptop`으로 대체되었습니다.

일부 모델은 SNC 또는 SPIC를 통해 hotkey를 보고합니다. 이런 event는 ACPI subsystem의 acpi event와 INPUT subsystem 양쪽에 전달됩니다. `/proc/bus/input/devices` log에서 event와 driver가 만든 input device를 확인하십시오. `debug` option으로 driver를 load하면 모든 event를 kernel log에도 기록합니다.

input system에 전달하는 scancode는 udev로 remap할 수 있으며 `sony-laptop.c` module의 `sony_laptop_input_keycode_map` table index입니다. 예를 들어 일부 모델에서 EJECTCD인 `FN/E` 조합은 scancode 20(`0x14`)을 생성합니다.

Backlight control

28-43

모델이 지원한다면 `/sys/class/backlight/sony/` 아래에 현재 screen brightness를 조회·설정할 sysfs 파일이 있습니다.

파일설명
brightness0부터 7 사이 정수로 screen brightness를 읽고 씁니다.
actual_brightnesshardware를 조회하여 실제 brightness 값을 읽습니다.
max_brightness최대 brightness 값을 제공합니다.

Platform-specific sysfs file과 예제

44-99

`sony-laptop` module을 load하면 `/sys/devices/platform/sony-laptop/` directory가 생성되고 지원 file이 들어갑니다. 표준 UNIX tool로 정수 값을 읽고 쓸 수 있습니다.

파일설명
brightness_defaultlaptop을 reboot할 때 설정할 screen brightness
cdpowerinternal CD drive 전원 on/off
audiopowerinternal sound card 전원 on/off
lanpowerinternal ethernet card 전원 on/off, debug mode에서만 제공
bluetoothpowerinternal Bluetooth device 전원 on/off
fanspeedfan speed 읽기·설정

특정 laptop 모델이 지원하지 않는 file은 없을 수 있습니다.

다음은 이후 reboot의 기본 screen brightness를 가장 낮게 설정합니다.

# echo "1" > /sys/devices/platform/sony-laptop/brightness_default

다음은 이후 reboot의 기본 screen brightness를 가장 높게 설정합니다.

# echo "8" > /sys/devices/platform/sony-laptop/brightness_default

다음은 현재 값을 읽습니다.

# cat /sys/devices/platform/sony-laptop/brightness_default

다음 두 명령은 sound card 전원을 각각 끄고 켭니다.

# echo "0" > /sys/devices/platform/sony-laptop/audiopower
# echo "1" > /sys/devices/platform/sony-laptop/audiopower

RFkill control

100-109

최근 Vaio 모델은 radio-frequency emitting device를 제어하는 일관된 ACPI method 집합을 제공합니다. 지원 laptop에서는 `/sys/class/rfkill` 아래에 필요한 rfkill device가 있으며, 다음 명령으로 `sony-*` 이름을 확인할 수 있습니다.

# grep . /sys/class/rfkill/*/{state,name}

Debug mode와 SNC method 조사

110-159

driver 개발을 돕고 싶고 ACPI BIOS에 이상한 동작을 시켜 생길 수 있는 side effect를 감수할 수 있다면 `debug=1` option으로 driver를 load하십시오.

다시 강조합니다: 위험한 작업을 원하지 않는다면 이렇게 하지 마십시오.

kernel log에서 laptop SNC device의 모든 ACPI method 목록을 볼 수 있습니다.

새 모델에서는 의미를 알기 어려운 method 이름이 길게 나타납니다. DSDT source를 읽으면 1. SNC device가 internal capability lookup table을 사용하고, 2. `SN00`으로 table 값을 찾으며, 3. `SN06`·`SN07`이 `SN00` 순회로 얻은 offset에 따라 실제 method를 호출하고, 4. `SN02`가 event를 enable한다는 사실을 알 수 있습니다.

capability lookup table의 일부 값은 어느 정도 알려져 있습니다. 모든 `sony_call_snc_handle` 호출을 확인하십시오. 나머지는 더 불분명합니다.

구형 모델에서는 CD drive를 켜고 끄는 `GCDP/GCDP` method가 보이지만 다른 method도 있고 대개 모델마다 다릅니다. 원문 작성자는 그 method의 동작을 알지 못한다고 강하게 경고합니다.

`sony-laptop` driver는 여러 Vaio 모델에서 발견된 최신 method 일부에 대해 `cdpower`처럼 `/sys/devices/platform/sony-laptop` 아래에 entry를 만듭니다. source의 `sony_nc_values` table에 get/set method 이름과 `SNC_HANDLE_NAMES` macro를 사용한 entry를 추가하면 해당 laptop method용 entry를 더 만들 수 있습니다.

그 entry의 용도를 찾으려면 file에서 임의 값을 읽고 쓰며 laptop에 미치는 영향을 조사해야 합니다. 흥미로운 결과를 찾으면 작성자에게 보고하십시오.

Bug와 제한 사항

160-174

이 driver는 공식 Sony 문서를 기반으로 하지 않습니다. 그런 문서가 없기 때문입니다. 따라서 동작하거나 올바른 작업을 한다는 보장이 없으며, 영구 손상을 포함해 laptop에 매우 나쁜 영향을 줄 수 있습니다.

`sony-laptop`과 `sonypi` driver는 전혀 상호작용하지 않습니다. 향후 `sonypi`를 제거하고 `sony-laptop`으로 대체할 예정입니다.

`/dev/sonypi`를 통해 `sonypi` driver와 통신하는 user-space tool `spicctrl`도 deprecated되었습니다. 모든 기능을 이제 `sony-laptop`의 sysfs tree에서 사용할 수 있기 때문입니다.