aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2007-11-04 00:41:30 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-01-21 01:11:06 -0500
commit72341eea6f62a91f270157d86c0c82d832627dfd (patch)
treef24740dd86e23cc647ddd02cabdbf37098824b1c /drivers/input/misc
parent1953ea2d8df48f33d2a79042ae1b4a2d5f1548a3 (diff)
Input: atlas_btns - add support for loadable keymaps
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/misc')
-rw-r--r--drivers/input/misc/atlas_btns.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c
index 4e3ad657ed80..1b871917340a 100644
--- a/drivers/input/misc/atlas_btns.c
+++ b/drivers/input/misc/atlas_btns.c
@@ -29,9 +29,10 @@
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include <acpi/acpi_drivers.h> 30#include <acpi/acpi_drivers.h>
31 31
32#define ACPI_ATLAS_NAME "Atlas ACPI" 32#define ACPI_ATLAS_NAME "Atlas ACPI"
33#define ACPI_ATLAS_CLASS "Atlas" 33#define ACPI_ATLAS_CLASS "Atlas"
34 34
35static unsigned short atlas_keymap[16];
35static struct input_dev *input_dev; 36static struct input_dev *input_dev;
36 37
37/* button handling code */ 38/* button handling code */
@@ -50,12 +51,15 @@ static acpi_status acpi_atlas_button_handler(u32 function,
50 void *handler_context, void *region_context) 51 void *handler_context, void *region_context)
51{ 52{
52 acpi_status status; 53 acpi_status status;
53 int keycode;
54 54
55 if (function == ACPI_WRITE) { 55 if (function == ACPI_WRITE) {
56 keycode = KEY_F1 + (address & 0x0F); 56 int code = address & 0x0f;
57 input_report_key(input_dev, keycode, !(address & 0x10)); 57 int key_down = !(address & 0x10);
58
59 input_event(input_dev, EV_MSC, MSC_SCAN, code);
60 input_report_key(input_dev, atlas_keymap[code], key_down);
58 input_sync(input_dev); 61 input_sync(input_dev);
62
59 status = 0; 63 status = 0;
60 } else { 64 } else {
61 printk(KERN_WARNING "atlas: shrugged on unexpected function" 65 printk(KERN_WARNING "atlas: shrugged on unexpected function"
@@ -70,6 +74,7 @@ static acpi_status acpi_atlas_button_handler(u32 function,
70static int atlas_acpi_button_add(struct acpi_device *device) 74static int atlas_acpi_button_add(struct acpi_device *device)
71{ 75{
72 acpi_status status; 76 acpi_status status;
77 int i;
73 int err; 78 int err;
74 79
75 input_dev = input_allocate_device(); 80 input_dev = input_allocate_device();
@@ -81,17 +86,19 @@ static int atlas_acpi_button_add(struct acpi_device *device)
81 input_dev->name = "Atlas ACPI button driver"; 86 input_dev->name = "Atlas ACPI button driver";
82 input_dev->phys = "ASIM0000/atlas/input0"; 87 input_dev->phys = "ASIM0000/atlas/input0";
83 input_dev->id.bustype = BUS_HOST; 88 input_dev->id.bustype = BUS_HOST;
84 input_dev->evbit[BIT_WORD(EV_KEY)] = BIT_MASK(EV_KEY); 89 input_dev->keycode = atlas_keymap;
85 90 input_dev->keycodesize = sizeof(unsigned short);
86 set_bit(KEY_F1, input_dev->keybit); 91 input_dev->keycodemax = ARRAY_SIZE(atlas_keymap);
87 set_bit(KEY_F2, input_dev->keybit); 92
88 set_bit(KEY_F3, input_dev->keybit); 93 input_set_capability(input_dev, EV_MSC, MSC_SCAN);
89 set_bit(KEY_F4, input_dev->keybit); 94 __set_bit(EV_KEY, input_dev->evbit);
90 set_bit(KEY_F5, input_dev->keybit); 95 for (i = 0; i < ARRAY_SIZE(atlas_keymap); i++) {
91 set_bit(KEY_F6, input_dev->keybit); 96 if (i < 9) {
92 set_bit(KEY_F7, input_dev->keybit); 97 atlas_keymap[i] = KEY_F1 + i;
93 set_bit(KEY_F8, input_dev->keybit); 98 __set_bit(KEY_F1 + i, input_dev->keybit);
94 set_bit(KEY_F9, input_dev->keybit); 99 } else
100 atlas_keymap[i] = KEY_RESERVED;
101 }
95 102
96 err = input_register_device(input_dev); 103 err = input_register_device(input_dev);
97 if (err) { 104 if (err) {