README

Version 1 (Corentin Chary, 06/03/2009 09:49 am)

1 1 Corentin Chary
h1. README
2 1 Corentin Chary
3 1 Corentin Chary
<pre>
4 1 Corentin Chary
This package provides 2 things :
5 1 Corentin Chary
--------------------------------
6 1 Corentin Chary
7 1 Corentin Chary
- asus-laptop.o or asus-laptop.ko (for 2.6.X kernel), a kernel module to handle
8 1 Corentin Chary
  hotkey events, LEDs, Backlight, etc...
9 1 Corentin Chary
10 1 Corentin Chary
- asus_acpid, a user-level daemon, based on acpid, to handle events generated
11 1 Corentin Chary
  by the kernel module. This daemon is only provided as an example, you can use
12 1 Corentin Chary
  any tool you want, as all events reported by the driver are inserted in the
13 1 Corentin Chary
  /proc/acpi/event queue. So, if you want, you can use the regular acpid. The
14 1 Corentin Chary
  advantage of this daemon is that it can be launched by any user, and so,
15 1 Corentin Chary
  interact directly with the X session opened by this user. You may then be
16 1 Corentin Chary
  able to launch X programs with this daemon, whereas with the classical ACPI
17 1 Corentin Chary
  daemon, this is not possible easily.
18 1 Corentin Chary
19 1 Corentin Chary
20 1 Corentin Chary
Table of contents :
21 1 Corentin Chary
22 1 Corentin Chary
--------------------------------------------------------------------------------
23 1 Corentin Chary
1. Requirements
24 1 Corentin Chary
25 1 Corentin Chary
2. Compilation
26 1 Corentin Chary
 2.1 Kernel module
27 1 Corentin Chary
 2.2 asus_acpid daemon
28 1 Corentin Chary
29 1 Corentin Chary
3. Installation
30 1 Corentin Chary
 3.1 Kernel module
31 1 Corentin Chary
 3.2 asus_acpid
32 1 Corentin Chary
33 1 Corentin Chary
4. Usage
34 1 Corentin Chary
 4.1 Kernel module
35 1 Corentin Chary
 4.1.1 Display switching
36 1 Corentin Chary
 4.1.2 LED display
37 1 Corentin Chary
 4.2 asus_acpid daemon
38 1 Corentin Chary
39 1 Corentin Chary
5. Kernel support
40 1 Corentin Chary
41 1 Corentin Chary
6. Unsupported models
42 1 Corentin Chary
43 1 Corentin Chary
7. Patches, Errors, Questions:
44 1 Corentin Chary
--------------------------------------------------------------------------------
45 1 Corentin Chary
46 1 Corentin Chary
47 1 Corentin Chary
48 1 Corentin Chary
49 1 Corentin Chary
--------------------------------------------------------------------------------
50 1 Corentin Chary
1. Requirements
51 1 Corentin Chary
52 1 Corentin Chary
  Kernel 2.4.X or 2.6.X sources, configured for you computer, with ACPI support.
53 1 Corentin Chary
  You also need CONFIG_LEDS_CLASS and CONFIG_BACKLIGHT_CLASS_DEVICE.
54 1 Corentin Chary
55 1 Corentin Chary
--------------------------------------------------------------------------------
56 1 Corentin Chary
2. Compilation
57 1 Corentin Chary
58 1 Corentin Chary
  For the impatient, simply type make in the top level directory of the
59 1 Corentin Chary
  package, everything should be compiled fine. If it's not the case, read on.
60 1 Corentin Chary
61 1 Corentin Chary
 2.1 Kernel module
62 1 Corentin Chary
63 1 Corentin Chary
  Go to the driver directory : cd driver
64 1 Corentin Chary
65 1 Corentin Chary
  If your kernel tree is not in /lib/modules/<kernel_version_you_use>/build,
66 1 Corentin Chary
  you will have to edit the Makefile to change the line s
67 1 Corentin Chary
	KDIR := /lib/modules/$(KVER)/build
68 1 Corentin Chary
  to reflect the path to your kernel tree :
69 1 Corentin Chary
        KDIR = </absolute_path_to_your_kernel_tree/>
70 1 Corentin Chary
71 1 Corentin Chary
  You can also create a link from /lib/modules/<kernel_version_you_use>/build
72 1 Corentin Chary
  to your kernel source tree.
73 1 Corentin Chary
74 1 Corentin Chary
  You can edit the Makefile if you wish to change the linker (ld by default)
75 1 Corentin Chary
  and the compiler (gcc by default), or any option defined there ...
76 1 Corentin Chary
77 1 Corentin Chary
  Type make, you are done.
78 1 Corentin Chary
79 1 Corentin Chary
  To use the backlight and LEDs, you need to activate
80 1 Corentin Chary
  $ make menuconfig
81 1 Corentin Chary
  Device Drivers -->
82 1 Corentin Chary
    Graphics support  --->
83 1 Corentin Chary
      [*] Backlight & LCD device support  --->
84 1 Corentin Chary
          --- Backlight & LCD device support
85 1 Corentin Chary
	      <*>   Lowlevel Backlight controls
86 1 Corentin Chary
    LED devices  --->
87 1 Corentin Chary
      [*] LED Support
88 1 Corentin Chary
      <*>   LED Class Support
89 1 Corentin Chary
90 1 Corentin Chary
 2.2 asus_acpid daemon
91 1 Corentin Chary
92 1 Corentin Chary
  Go to the asus_acpid directory
93 1 Corentin Chary
94 1 Corentin Chary
  Edit the Makefile if you wish to change the default install directories
95 1 Corentin Chary
  (/usr/local/bin and /usr/local/share/man/man8).
96 1 Corentin Chary
97 1 Corentin Chary
  Type make, you are done.
98 1 Corentin Chary
99 1 Corentin Chary
100 1 Corentin Chary
  You can compile both the daemon and the kernel module by typing make in the
101 1 Corentin Chary
  top directory.
102 1 Corentin Chary
103 1 Corentin Chary
104 1 Corentin Chary
--------------------------------------------------------------------------------
105 1 Corentin Chary
3. Installation
106 1 Corentin Chary
107 1 Corentin Chary
  For the impatient, simply type "make install" in the top level directory of
108 1 Corentin Chary
  the package. The kernel module will be installed in
109 1 Corentin Chary
  /lib/modules/2.X.XX/kernel/drivers/misc, and the daemon in /usr/local/bin. If
110 1 Corentin Chary
  it doesn't work, read on.
111 1 Corentin Chary
112 1 Corentin Chary
113 1 Corentin Chary
 3.1 Kernel module
114 1 Corentin Chary
115 1 Corentin Chary
  Go to the driver directory : cd driver
116 1 Corentin Chary
117 1 Corentin Chary
  Type "make install", you are done, module is in
118 1 Corentin Chary
  /lib/modules/2.X.XX/kernel/drivers/misc. If the path is wrong, edit the
119 1 Corentin Chary
  Makefile and correct it.
120 1 Corentin Chary
121 1 Corentin Chary
 3.2 asus_acpid
122 1 Corentin Chary
123 1 Corentin Chary
  Go to the asus_acpid directory
124 1 Corentin Chary
125 1 Corentin Chary
  Edit the Makefile if you wish to change the default install directories
126 1 Corentin Chary
  (/usr/local/bin and /usr/local/share/man/man8).
127 1 Corentin Chary
128 1 Corentin Chary
  Type "make install", you are done.
129 1 Corentin Chary
130 1 Corentin Chary
131 1 Corentin Chary
--------------------------------------------------------------------------------
132 1 Corentin Chary
4. Usage
133 1 Corentin Chary
134 1 Corentin Chary
 4.1 Kernel module
135 1 Corentin Chary
136 1 Corentin Chary
  Try "modprobe asus_acpi". Check your dmesg (simply type dmesg). You should
137 1 Corentin Chary
  see some lines like this :
138 1 Corentin Chary
139 1 Corentin Chary
      Asus Laptop Extras version 0.40
140 1 Corentin Chary
        L2D model detected.
141 1 Corentin Chary
142 1 Corentin Chary
  If it is not the output you have on your laptop, send it (and the laptop's
143 1 Corentin Chary
  DSDT) to me.
144 1 Corentin Chary
145 1 Corentin Chary
  That's all, now, all the events generated by the hotkeys of your laptop
146 1 Corentin Chary
  should be reported in your /proc/acpi/event entry. You can check it, if you
147 1 Corentin Chary
  are root, by doing a "cat /proc/acpi/event" and pressing those hotkeys, you
148 1 Corentin Chary
  should see them appear. You won't be able to open /proc/acpi/event if it is
149 1 Corentin Chary
  already opened by another program, so check if you haven't a daemon running
150 1 Corentin Chary
  (like acpid), before reporting a bug :)
151 1 Corentin Chary
152 1 Corentin Chary
  You can modify LEDs be echoing values to /sys/class/leds/asus:*/brightness :
153 1 Corentin Chary
    echo 1 >  /sys/class/leds/asus:mail/brightness
154 1 Corentin Chary
  will switch the mail LED on ...
155 1 Corentin Chary
  You can as well know if they are on/off by reading their content and use
156 1 Corentin Chary
  kernel triggers like ide-disk or heartbeat.
157 1 Corentin Chary
158 1 Corentin Chary
  You can get informations on the version of your DSDT table by reading the
159 1 Corentin Chary
  /sys/devices/platform/asus-laptop/infos entry. If you have a question or a
160 1 Corentin Chary
  bug report to do, please include the output of this entry.
161 1 Corentin Chary
162 1 Corentin Chary
  You can control lcd backlight power and brightness with
163 1 Corentin Chary
  /sys/class/backlight/asus-laptop/. Brightness Values are between 0 and 15.
164 1 Corentin Chary
165 1 Corentin Chary
  You can turn the internal Bluetooth adapter on/off with the bluetooth entry
166 1 Corentin Chary
  (only on models with Bluetooth). This usually controls the associated LED.
167 1 Corentin Chary
  Same for Wlan adapter.
168 1 Corentin Chary
169 1 Corentin Chary
 4.1.1 Display switching
170 1 Corentin Chary
171 1 Corentin Chary
  Note: the display switching code is currently considered EXPERIMENTAL.
172 1 Corentin Chary
173 1 Corentin Chary
  Switching works for the following models:
174 1 Corentin Chary
    L3800C
175 1 Corentin Chary
    A2500H
176 1 Corentin Chary
    L5800C
177 1 Corentin Chary
    M5200N
178 1 Corentin Chary
    W1000N (albeit with some glitches)
179 1 Corentin Chary
    M6700R
180 1 Corentin Chary
    A6JC
181 1 Corentin Chary
    F3J
182 1 Corentin Chary
183 1 Corentin Chary
  Switching doesn't work for the following:
184 1 Corentin Chary
    M3700N
185 1 Corentin Chary
    L2X00D (locks the laptop under certain conditions)
186 1 Corentin Chary
187 1 Corentin Chary
  To switch the displays, echo values from 0 to 15 to
188 1 Corentin Chary
  /sys/devices/platform/asus-laptop/display. The significance of those values
189 1 Corentin Chary
  is as follows:
190 1 Corentin Chary
191 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
192 1 Corentin Chary
  | Bin   | Val | DVI | TV  | CRT | LCD |
193 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
194 1 Corentin Chary
  + 0000  +   0 +     +     +     +     +
195 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
196 1 Corentin Chary
  + 0001  +   1 +     +     +     +  X  +
197 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
198 1 Corentin Chary
  + 0010  +   2 +     +     +  X  +     +
199 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
200 1 Corentin Chary
  + 0011  +   3 +     +     +  X  +  X  +
201 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
202 1 Corentin Chary
  + 0100  +   4 +     +  X  +     +     +
203 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
204 1 Corentin Chary
  + 0101  +   5 +     +  X  +     + X   +
205 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
206 1 Corentin Chary
  + 0110  +   6 +     +  X  +  X  +     +
207 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
208 1 Corentin Chary
  + 0111  +   7 +     +  X  +  X  +  X  +
209 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
210 1 Corentin Chary
  + 1000  +   8 +  X  +     +     +     +
211 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
212 1 Corentin Chary
  + 1001  +   9 +  X  +     +     +  X  +
213 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
214 1 Corentin Chary
  + 1010  +  10 +  X  +     +  X  +     +
215 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
216 1 Corentin Chary
  + 1011  +  11 +  X  +     +  X  +  X  +
217 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
218 1 Corentin Chary
  + 1100  +  12 +  X  +  X  +     +     +
219 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
220 1 Corentin Chary
  + 1101  +  13 +  X  +  X  +     +  X  +
221 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
222 1 Corentin Chary
  + 1110  +  14 +  X  +  X  +  X  +     +
223 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
224 1 Corentin Chary
  + 1111  +  15 +  X  +  X  +  X  +  X  +
225 1 Corentin Chary
  +-------+-----+-----+-----+-----+-----+
226 1 Corentin Chary
227 1 Corentin Chary
  In most cases, the appropriate displays must be plugged in for the above
228 1 Corentin Chary
  combinations to work. TV-Out may need to be initialized at boot time.
229 1 Corentin Chary
230 1 Corentin Chary
  Debugging:
231 1 Corentin Chary
  1) Check whether the Fn+F8 key:
232 1 Corentin Chary
     a) does not lock the laptop (try disabling CONFIG_X86_UP_APIC or boot with
233 1 Corentin Chary
        noapic / nolapic if it does)
234 1 Corentin Chary
     b) generates events (0x6n, where n is the value corresponding to the
235 1 Corentin Chary
        configuration above)
236 1 Corentin Chary
     c) actually works
237 1 Corentin Chary
     Record the disp value at every configuration.
238 1 Corentin Chary
  2) Echo values from 0 to 15 to /sys/devices/platform/asus-laptop/display.
239 1 Corentin Chary
     Record its value, note any change. If nothing changes, try a broader range,
240 1 Corentin Chary
     up to 65535.
241 1 Corentin Chary
  3) Send ANY output (both positive and negative reports are needed, unless your
242 1 Corentin Chary
     machine is already listed above) to the acpi4asus-user mailing list.
243 1 Corentin Chary
244 1 Corentin Chary
  Note: on some machines (e.g. L3C), after the module has been loaded, only 0x6n
245 1 Corentin Chary
  events are generated and no actual switching occurs. In such a case, a line
246 1 Corentin Chary
  like:
247 1 Corentin Chary
248 1 Corentin Chary
    echo $((10#$arg-60)) > /sys/devices/platform/asus-laptop/display
249 1 Corentin Chary
250 1 Corentin Chary
  will usually do the trick ($arg is the 0000006n-like event passed to acpid).
251 1 Corentin Chary
252 1 Corentin Chary
  Note: there is currently no reliable way to read display status on xxN
253 1 Corentin Chary
  (Centrino) models.
254 1 Corentin Chary
255 1 Corentin Chary
 4.1.2 LED display
256 1 Corentin Chary
257 1 Corentin Chary
  Some models like the W1N have a LED display that can be used to display
258 1 Corentin Chary
  several informations.
259 1 Corentin Chary
260 1 Corentin Chary
  LED display works for the following models:
261 1 Corentin Chary
    W1000N
262 1 Corentin Chary
    W1J
263 1 Corentin Chary
264 1 Corentin Chary
  To control the LED display, use the following :
265 1 Corentin Chary
266 1 Corentin Chary
    echo 0x0T000DDD > /sys/devices/platform/asus-laptop/
267 1 Corentin Chary
268 1 Corentin Chary
  where T control the 3 letters display, and DDD the 3 digits display,
269 1 Corentin Chary
  according to the tables below.
270 1 Corentin Chary
271 1 Corentin Chary
         DDD (digits)
272 1 Corentin Chary
         000 to 999 = display digits
273 1 Corentin Chary
         AAA        = ---
274 1 Corentin Chary
         BBB to FFF = turn-off
275 1 Corentin Chary
276 1 Corentin Chary
         T  (type)
277 1 Corentin Chary
         0 = off
278 1 Corentin Chary
         1 = dvd
279 1 Corentin Chary
         2 = vcd
280 1 Corentin Chary
         3 = mp3
281 1 Corentin Chary
         4 = cd
282 1 Corentin Chary
         5 = tv
283 1 Corentin Chary
         6 = cpu
284 1 Corentin Chary
         7 = vol
285 1 Corentin Chary
286 1 Corentin Chary
  For example "echo 0x01000001 >/sys/devices/platform/asus-laptop/ledd"
287 1 Corentin Chary
  would display "DVD001".
288 1 Corentin Chary
289 1 Corentin Chary
 4.2 asus_acpid daemon
290 1 Corentin Chary
291 1 Corentin Chary
  Now, you have to get a program than can handle events reported by the kernel
292 1 Corentin Chary
  module. The ACPID daemon is perfect for this, it is certainly packaged for
293 1 Corentin Chary
  your distribution, so I suggest you install it. Then you have two solutions:
294 1 Corentin Chary
  handle the events generated by hotkeys directly in the acpid configuration
295 1 Corentin Chary
  files (generally situated in /etc/acpid/), or with an alternate daemon. As I
296 1 Corentin Chary
  mentioned earlier, the advantage of the alternate daemon is that is can be
297 1 Corentin Chary
  launched by a non privileged user and interact directly with the environment
298 1 Corentin Chary
  of this user, that is you can bind one of your hotkeys to an Xterm if you
299 1 Corentin Chary
  wish, what is impossible with the acpid daemon without making dirty hacks...
300 1 Corentin Chary
301 1 Corentin Chary
  So, now that you are convinced the alternate daemon is better, we are going
302 1 Corentin Chary
  to install it :
303 1 Corentin Chary
   1) first create a directory .asus_acpi in your home directory
304 1 Corentin Chary
   2) copy everything in samples/ to that directory (cp -r samples/*
305 1 Corentin Chary
      ~/.asus_acpi)
306 1 Corentin Chary
   3) launch asus_acpid (asus_acpid)
307 1 Corentin Chary
   4) press hotkeys, enjoy
308 1 Corentin Chary
  Check the man page of asus_acpid (man asus_acpid) to know of to change the
309 1 Corentin Chary
  configuration.
310 1 Corentin Chary
311 1 Corentin Chary
  If you have a "connection refused" message when you try to launch asus_acpid,
312 1 Corentin Chary
  it means you must set a correct path to the socket open by acpid. For this
313 1 Corentin Chary
  check the config file of your acpid daemon. when you know the path to this
314 1 Corentin Chary
  socket, just launch the asus_acpid with "-e /path_to_socket" option.
315 1 Corentin Chary
316 1 Corentin Chary
  You can also check if the events are generated by using the small perl
317 1 Corentin Chary
  program included in the asus_acpid directory.
318 1 Corentin Chary
319 1 Corentin Chary
320 1 Corentin Chary
321 1 Corentin Chary
--------------------------------------------------------------------------------
322 1 Corentin Chary
5. Kernel Support
323 1 Corentin Chary
324 1 Corentin Chary
  Starting with kernel 2.4.22 and 2.6.X, the driver is included in the vanilla
325 1 Corentin Chary
  source tree. You can still compile the driver outside the kernel tree if you
326 1 Corentin Chary
  like it this way.
327 1 Corentin Chary
328 1 Corentin Chary
329 1 Corentin Chary
--------------------------------------------------------------------------------
330 1 Corentin Chary
6. Unsupported models
331 1 Corentin Chary
332 1 Corentin Chary
  These models will never be supported by this module, as they use a completely
333 1 Corentin Chary
  different mechanism to handle LEDs and extra stuff (meaning we have no clue
334 1 Corentin Chary
  how it works):
335 1 Corentin Chary
336 1 Corentin Chary
  - ASUS A1300 (A1B), A1370D
337 1 Corentin Chary
  - ASUS L7300G
338 1 Corentin Chary
  - ASUS L8400
339 1 Corentin Chary
340 1 Corentin Chary
341 1 Corentin Chary
--------------------------------------------------------------------------------
342 1 Corentin Chary
7. Patches, Errors, Questions:
343 1 Corentin Chary
344 1 Corentin Chary
  Please, include the output of /sys/devices/platform/asus-laptop/info and
345 1 Corentin Chary
  /proc/acpi/dsdt (binary file format is just fine) if you can.
346 1 Corentin Chary
347 1 Corentin Chary
  acpi4asus-user@lists.sourceforge.net
348 1 Corentin Chary
  http://sourceforge.net/projects/acpi4asus
349 1 Corentin Chary
350 1 Corentin Chary
351 1 Corentin Chary
</pre>