diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2007-07-17 07:04:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 13:23:04 -0400 |
commit | 8945495697d9f461d4c923e0ed26c0e309b0dffc (patch) | |
tree | dea70cf00e088045b3ca3eff210a7ccbe2ae198c /drivers/misc | |
parent | da6b9c92d12ee6594170d839e2e78043bd2af286 (diff) |
IBMASM: miscellaneous fixes
IBMASM: miscellaneous fixes
Fix some minor issues, such as:
- properly set up ID of keyboard device (was mixed up with mouse)
- constify translation tables
- change some variables to #defines
- set up input device's parent to form proper sysfs hierarchy
- minor formatting changes
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Vernon Mauery <vernux@us.ibm.com>
Cc: Max Asbock <masbock@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/ibmasm/remote.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/drivers/misc/ibmasm/remote.c b/drivers/misc/ibmasm/remote.c index a40fda6c402c..0550ce075fc4 100644 --- a/drivers/misc/ibmasm/remote.c +++ b/drivers/misc/ibmasm/remote.c | |||
@@ -28,11 +28,10 @@ | |||
28 | #include "ibmasm.h" | 28 | #include "ibmasm.h" |
29 | #include "remote.h" | 29 | #include "remote.h" |
30 | 30 | ||
31 | static int xmax = 1600; | 31 | #define MOUSE_X_MAX 1600 |
32 | static int ymax = 1200; | 32 | #define MOUSE_Y_MAX 1200 |
33 | 33 | ||
34 | 34 | static const unsigned short xlate_high[XLATE_SIZE] = { | |
35 | static unsigned short xlate_high[XLATE_SIZE] = { | ||
36 | [KEY_SYM_ENTER & 0xff] = KEY_ENTER, | 35 | [KEY_SYM_ENTER & 0xff] = KEY_ENTER, |
37 | [KEY_SYM_KPSLASH & 0xff] = KEY_KPSLASH, | 36 | [KEY_SYM_KPSLASH & 0xff] = KEY_KPSLASH, |
38 | [KEY_SYM_KPSTAR & 0xff] = KEY_KPASTERISK, | 37 | [KEY_SYM_KPSTAR & 0xff] = KEY_KPASTERISK, |
@@ -81,7 +80,8 @@ static unsigned short xlate_high[XLATE_SIZE] = { | |||
81 | [KEY_SYM_NUM_LOCK & 0xff] = KEY_NUMLOCK, | 80 | [KEY_SYM_NUM_LOCK & 0xff] = KEY_NUMLOCK, |
82 | [KEY_SYM_SCR_LOCK & 0xff] = KEY_SCROLLLOCK, | 81 | [KEY_SYM_SCR_LOCK & 0xff] = KEY_SCROLLLOCK, |
83 | }; | 82 | }; |
84 | static unsigned short xlate[XLATE_SIZE] = { | 83 | |
84 | static const unsigned short xlate[XLATE_SIZE] = { | ||
85 | [NO_KEYCODE] = KEY_RESERVED, | 85 | [NO_KEYCODE] = KEY_RESERVED, |
86 | [KEY_SYM_SPACE] = KEY_SPACE, | 86 | [KEY_SYM_SPACE] = KEY_SPACE, |
87 | [KEY_SYM_TILDE] = KEY_GRAVE, [KEY_SYM_BKTIC] = KEY_GRAVE, | 87 | [KEY_SYM_TILDE] = KEY_GRAVE, [KEY_SYM_BKTIC] = KEY_GRAVE, |
@@ -133,19 +133,16 @@ static unsigned short xlate[XLATE_SIZE] = { | |||
133 | [KEY_SYM_Z] = KEY_Z, [KEY_SYM_z] = KEY_Z, | 133 | [KEY_SYM_Z] = KEY_Z, [KEY_SYM_z] = KEY_Z, |
134 | }; | 134 | }; |
135 | 135 | ||
136 | static char remote_mouse_name[] = "ibmasm RSA I remote mouse"; | ||
137 | static char remote_keybd_name[] = "ibmasm RSA I remote keyboard"; | ||
138 | |||
139 | static void print_input(struct remote_input *input) | 136 | static void print_input(struct remote_input *input) |
140 | { | 137 | { |
141 | if (input->type == INPUT_TYPE_MOUSE) { | 138 | if (input->type == INPUT_TYPE_MOUSE) { |
142 | unsigned char buttons = input->mouse_buttons; | 139 | unsigned char buttons = input->mouse_buttons; |
143 | dbg("remote mouse movement: (x,y)=(%d,%d)%s%s%s%s\n", | 140 | dbg("remote mouse movement: (x,y)=(%d,%d)%s%s%s%s\n", |
144 | input->data.mouse.x, input->data.mouse.y, | 141 | input->data.mouse.x, input->data.mouse.y, |
145 | (buttons)?" -- buttons:":"", | 142 | (buttons) ? " -- buttons:" : "", |
146 | (buttons & REMOTE_BUTTON_LEFT)?"left ":"", | 143 | (buttons & REMOTE_BUTTON_LEFT) ? "left " : "", |
147 | (buttons & REMOTE_BUTTON_MIDDLE)?"middle ":"", | 144 | (buttons & REMOTE_BUTTON_MIDDLE) ? "middle " : "", |
148 | (buttons & REMOTE_BUTTON_RIGHT)?"right":"" | 145 | (buttons & REMOTE_BUTTON_RIGHT) ? "right" : "" |
149 | ); | 146 | ); |
150 | } else { | 147 | } else { |
151 | dbg("remote keypress (code, flag, down):" | 148 | dbg("remote keypress (code, flag, down):" |
@@ -180,7 +177,7 @@ static void send_keyboard_event(struct input_dev *dev, | |||
180 | key = xlate_high[code & 0xff]; | 177 | key = xlate_high[code & 0xff]; |
181 | else | 178 | else |
182 | key = xlate[code]; | 179 | key = xlate[code]; |
183 | input_report_key(dev, key, (input->data.keyboard.key_down) ? 1 : 0); | 180 | input_report_key(dev, key, input->data.keyboard.key_down); |
184 | input_sync(dev); | 181 | input_sync(dev); |
185 | } | 182 | } |
186 | 183 | ||
@@ -228,20 +225,22 @@ int ibmasm_init_remote_input_dev(struct service_processor *sp) | |||
228 | mouse_dev->id.vendor = pdev->vendor; | 225 | mouse_dev->id.vendor = pdev->vendor; |
229 | mouse_dev->id.product = pdev->device; | 226 | mouse_dev->id.product = pdev->device; |
230 | mouse_dev->id.version = 1; | 227 | mouse_dev->id.version = 1; |
228 | mouse_dev->dev.parent = sp->dev; | ||
231 | mouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | 229 | mouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); |
232 | mouse_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | | 230 | mouse_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | |
233 | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); | 231 | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); |
234 | set_bit(BTN_TOUCH, mouse_dev->keybit); | 232 | set_bit(BTN_TOUCH, mouse_dev->keybit); |
235 | mouse_dev->name = remote_mouse_name; | 233 | mouse_dev->name = "ibmasm RSA I remote mouse"; |
236 | input_set_abs_params(mouse_dev, ABS_X, 0, xmax, 0, 0); | 234 | input_set_abs_params(mouse_dev, ABS_X, 0, MOUSE_X_MAX, 0, 0); |
237 | input_set_abs_params(mouse_dev, ABS_Y, 0, ymax, 0, 0); | 235 | input_set_abs_params(mouse_dev, ABS_Y, 0, MOUSE_Y_MAX, 0, 0); |
238 | 236 | ||
239 | mouse_dev->id.bustype = BUS_PCI; | 237 | keybd_dev->id.bustype = BUS_PCI; |
240 | keybd_dev->id.vendor = pdev->vendor; | 238 | keybd_dev->id.vendor = pdev->vendor; |
241 | keybd_dev->id.product = pdev->device; | 239 | keybd_dev->id.product = pdev->device; |
242 | mouse_dev->id.version = 2; | 240 | keybd_dev->id.version = 2; |
241 | keybd_dev->dev.parent = sp->dev; | ||
243 | keybd_dev->evbit[0] = BIT(EV_KEY); | 242 | keybd_dev->evbit[0] = BIT(EV_KEY); |
244 | keybd_dev->name = remote_keybd_name; | 243 | keybd_dev->name = "ibmasm RSA I remote keyboard"; |
245 | 244 | ||
246 | for (i = 0; i < XLATE_SIZE; i++) { | 245 | for (i = 0; i < XLATE_SIZE; i++) { |
247 | if (xlate_high[i]) | 246 | if (xlate_high[i]) |