diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2007-07-18 22:45:35 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-07-21 23:38:44 -0400 |
commit | 6a38abbf2b68e37493f2d5e8702b895a6c23ba0f (patch) | |
tree | 23f4e4bad740a5b866ee31d46c907756127e5fb0 /Documentation | |
parent | 7f5d1cd6287b7b29d210f85e2343207ac4310da2 (diff) |
ACPI: thinkpad-acpi: add input device support to hotkey subdriver
Add input device support to the hotkey subdriver.
Hot keys that have a valid keycode mapping are reported through the input
layer if the input device is open. Otherwise, they will be reported as
ACPI events, as they were before.
Scan codes are reported (using EV_MSC MSC_SCAN events) along with EV_KEY
KEY_UNKNOWN events.
For backwards compatibility purposes, hot keys that used to be reported
through ACPI events are not mapped to anything meaningful by default.
Userspace is supposed to remap them if it wants to use the input device for
hot key reporting.
This patch is based on a patch by Richard Hughes <hughsient@gmail.com>.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Richard Hughes <hughsient@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/thinkpad-acpi.txt | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt index bd00d14538c6..91d08921a4ca 100644 --- a/Documentation/thinkpad-acpi.txt +++ b/Documentation/thinkpad-acpi.txt | |||
@@ -167,6 +167,17 @@ All labeled Fn-Fx key combinations generate distinct events. In | |||
167 | addition, the lid microswitch and some docking station buttons may | 167 | addition, the lid microswitch and some docking station buttons may |
168 | also generate such events. | 168 | also generate such events. |
169 | 169 | ||
170 | Hot keys also generate regular keyboard key press/release events through | ||
171 | the input layer in addition to the ibm/hotkey ACPI events. The input | ||
172 | layer support accepts the standard IOCTLs to remap the keycodes assigned | ||
173 | to each hotkey. | ||
174 | |||
175 | When the input device is open, the driver will suppress any ACPI hot key | ||
176 | events that get translated into a meaningful input layer event, in order | ||
177 | to avoid sending duplicate events to userspace. Hot keys that are | ||
178 | mapped to KEY_RESERVED are not translated, and will always generate only | ||
179 | ACPI hot key event, and no input layer events. | ||
180 | |||
170 | The bit mask allows some control over which hot keys generate ACPI | 181 | The bit mask allows some control over which hot keys generate ACPI |
171 | events. Not all bits in the mask can be modified. Not all bits that can | 182 | events. Not all bits in the mask can be modified. Not all bits that can |
172 | be modified do anything. Not all hot keys can be individually controlled | 183 | be modified do anything. Not all hot keys can be individually controlled |
@@ -248,6 +259,146 @@ sysfs notes: | |||
248 | disabled" postition, and 1 if the switch is in the | 259 | disabled" postition, and 1 if the switch is in the |
249 | "radios enabled" position. | 260 | "radios enabled" position. |
250 | 261 | ||
262 | input layer notes: | ||
263 | |||
264 | A Hot key is mapped to a single input layer EV_KEY event, possibly | ||
265 | followed by an EV_MSC MSC_SCAN event that shall contain that key's scan | ||
266 | code. An EV_SYN event will always be generated to mark the end of the | ||
267 | event block. | ||
268 | |||
269 | Do not use the EV_MSC MSC_SCAN events to process keys. They are to be | ||
270 | used as a helper to remap keys, only. They are particularly useful when | ||
271 | remapping KEY_UNKNOWN keys. | ||
272 | |||
273 | The events are available in an input device, with the following id: | ||
274 | |||
275 | Bus: BUS_HOST | ||
276 | vendor: 0x1014 (PCI_VENDOR_ID_IBM) | ||
277 | product: 0x5054 ("TP") | ||
278 | version: 0x4101 | ||
279 | |||
280 | The version will have its LSB incremented if the keymap changes in a | ||
281 | backwards-compatible way. The MSB shall always be 0x41 for this input | ||
282 | device. If the MSB is not 0x41, do not use the device as described in | ||
283 | this section, as it is either something else (e.g. another input device | ||
284 | exported by a thinkpad driver, such as HDAPS) or its functionality has | ||
285 | been changed in a non-backwards compatible way. | ||
286 | |||
287 | Adding other event types for other functionalities shall be considered a | ||
288 | backwards-compatible change for this input device. | ||
289 | |||
290 | Thinkpad-acpi Hot Key event map (version 0x4101): | ||
291 | |||
292 | ACPI Scan | ||
293 | event code Key Notes | ||
294 | |||
295 | 0x1001 0x00 FN+F1 - | ||
296 | 0x1002 0x01 FN+F2 - | ||
297 | |||
298 | 0x1003 0x02 FN+F3 Many models always report this | ||
299 | hot key, even with hot keys | ||
300 | disabled or with Fn+F3 masked | ||
301 | off | ||
302 | |||
303 | 0x1004 0x03 FN+F4 Sleep button (ACPI sleep button | ||
304 | semanthics, i.e. sleep-to-RAM). | ||
305 | It is always generate some kind | ||
306 | of event, either the hot key | ||
307 | event or a ACPI sleep button | ||
308 | event. The firmware may | ||
309 | refuse to generate further FN+F4 | ||
310 | key presses until a S3 or S4 ACPI | ||
311 | sleep cycle is performed or some | ||
312 | time passes. | ||
313 | |||
314 | 0x1005 0x04 FN+F5 Radio. Enables/disables | ||
315 | the internal BlueTooth hardware | ||
316 | and W-WAN card if left in control | ||
317 | of the firmware. Does not affect | ||
318 | the WLAN card. | ||
319 | |||
320 | 0x1006 0x05 FN+F6 - | ||
321 | |||
322 | 0x1007 0x06 FN+F7 Video output cycle. | ||
323 | Do you feel lucky today? | ||
324 | |||
325 | 0x1008 0x07 FN+F8 - | ||
326 | .. .. .. | ||
327 | 0x100B 0x0A FN+F11 - | ||
328 | |||
329 | 0x100C 0x0B FN+F12 Sleep to disk. You are always | ||
330 | supposed to handle it yourself, | ||
331 | either through the ACPI event, | ||
332 | or through a hotkey event. | ||
333 | The firmware may refuse to | ||
334 | generate further FN+F4 key | ||
335 | press events until a S3 or S4 | ||
336 | ACPI sleep cycle is performed, | ||
337 | or some time passes. | ||
338 | |||
339 | 0x100D 0x0C FN+BACKSPACE - | ||
340 | 0x100E 0x0D FN+INSERT - | ||
341 | 0x100F 0x0E FN+DELETE - | ||
342 | |||
343 | 0x1010 0x0F FN+HOME Brightness up. This key is | ||
344 | always handled by the firmware, | ||
345 | even when unmasked. Just leave | ||
346 | it alone. | ||
347 | 0x1011 0x10 FN+END Brightness down. This key is | ||
348 | always handled by the firmware, | ||
349 | even when unmasked. Just leave | ||
350 | it alone. | ||
351 | 0x1012 0x11 FN+PGUP Thinklight toggle. This key is | ||
352 | always handled by the firmware, | ||
353 | even when unmasked. | ||
354 | |||
355 | 0x1013 0x12 FN+PGDOWN - | ||
356 | |||
357 | 0x1014 0x13 FN+SPACE Zoom key | ||
358 | |||
359 | 0x1015 0x14 VOLUME UP Internal mixer volume up. This | ||
360 | key is always handled by the | ||
361 | firmware, even when unmasked. | ||
362 | 0x1016 0x15 VOLUME DOWN Internal mixer volume up. This | ||
363 | key is always handled by the | ||
364 | firmware, even when unmasked. | ||
365 | 0x1017 0x16 MUTE Mute internal mixer. This | ||
366 | key is always handled by the | ||
367 | firmware, even when unmasked. | ||
368 | |||
369 | 0x1018 0x17 THINKPAD Thinkpad/Access IBM/Lenovo key | ||
370 | |||
371 | 0x1019 0x18 unknown | ||
372 | .. .. .. | ||
373 | 0x1020 0x1F unknown | ||
374 | |||
375 | The ThinkPad firmware does not allow one to differentiate when most hot | ||
376 | keys are pressed or released (either that, or we don't know how to, yet). | ||
377 | For these keys, the driver generates a set of events for a key press and | ||
378 | immediately issues the same set of events for a key release. It is | ||
379 | unknown by the driver if the ThinkPad firmware triggered these events on | ||
380 | hot key press or release, but the firmware will do it for either one, not | ||
381 | both. | ||
382 | |||
383 | If a key is mapped to KEY_RESERVED, it generates no input events at all, | ||
384 | and it may generate a legacy thinkpad-acpi ACPI hotkey event. | ||
385 | |||
386 | If a key is mapped to KEY_UNKNOWN, it generates an input event that | ||
387 | includes an scan code, and it may also generate a legacy thinkpad-acpi | ||
388 | ACPI hotkey event. | ||
389 | |||
390 | If a key is mapped to anything else, it will only generate legacy | ||
391 | thinkpad-acpi ACPI hotkey events if nobody has opened the input device. | ||
392 | |||
393 | For userspace backwards-compatibility purposes, the keycode map is | ||
394 | initially filled with KEY_RESERVED and KEY_UNKNOWN mappings for scan codes | ||
395 | 0x00 to 0x10 (and maybe others). | ||
396 | |||
397 | Non hot-key ACPI HKEY event map: | ||
398 | 0x5001 Lid closed | ||
399 | 0x5002 Lid opened | ||
400 | 0x7000 Radio Switch may have changed state | ||
401 | |||
251 | 402 | ||
252 | Bluetooth | 403 | Bluetooth |
253 | --------- | 404 | --------- |