Commit 89454956 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Linus Torvalds

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: default avatarDmitry Torokhov <dtor@mail.ru>
Cc: Vernon Mauery <vernux@us.ibm.com>
Cc: Max Asbock <masbock@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent da6b9c92
...@@ -28,11 +28,10 @@ ...@@ -28,11 +28,10 @@
#include "ibmasm.h" #include "ibmasm.h"
#include "remote.h" #include "remote.h"
static int xmax = 1600; #define MOUSE_X_MAX 1600
static int ymax = 1200; #define MOUSE_Y_MAX 1200
static const unsigned short xlate_high[XLATE_SIZE] = {
static unsigned short xlate_high[XLATE_SIZE] = {
[KEY_SYM_ENTER & 0xff] = KEY_ENTER, [KEY_SYM_ENTER & 0xff] = KEY_ENTER,
[KEY_SYM_KPSLASH & 0xff] = KEY_KPSLASH, [KEY_SYM_KPSLASH & 0xff] = KEY_KPSLASH,
[KEY_SYM_KPSTAR & 0xff] = KEY_KPASTERISK, [KEY_SYM_KPSTAR & 0xff] = KEY_KPASTERISK,
...@@ -81,7 +80,8 @@ static unsigned short xlate_high[XLATE_SIZE] = { ...@@ -81,7 +80,8 @@ static unsigned short xlate_high[XLATE_SIZE] = {
[KEY_SYM_NUM_LOCK & 0xff] = KEY_NUMLOCK, [KEY_SYM_NUM_LOCK & 0xff] = KEY_NUMLOCK,
[KEY_SYM_SCR_LOCK & 0xff] = KEY_SCROLLLOCK, [KEY_SYM_SCR_LOCK & 0xff] = KEY_SCROLLLOCK,
}; };
static unsigned short xlate[XLATE_SIZE] = {
static const unsigned short xlate[XLATE_SIZE] = {
[NO_KEYCODE] = KEY_RESERVED, [NO_KEYCODE] = KEY_RESERVED,
[KEY_SYM_SPACE] = KEY_SPACE, [KEY_SYM_SPACE] = KEY_SPACE,
[KEY_SYM_TILDE] = KEY_GRAVE, [KEY_SYM_BKTIC] = KEY_GRAVE, [KEY_SYM_TILDE] = KEY_GRAVE, [KEY_SYM_BKTIC] = KEY_GRAVE,
...@@ -133,19 +133,16 @@ static unsigned short xlate[XLATE_SIZE] = { ...@@ -133,19 +133,16 @@ static unsigned short xlate[XLATE_SIZE] = {
[KEY_SYM_Z] = KEY_Z, [KEY_SYM_z] = KEY_Z, [KEY_SYM_Z] = KEY_Z, [KEY_SYM_z] = KEY_Z,
}; };
static char remote_mouse_name[] = "ibmasm RSA I remote mouse";
static char remote_keybd_name[] = "ibmasm RSA I remote keyboard";
static void print_input(struct remote_input *input) static void print_input(struct remote_input *input)
{ {
if (input->type == INPUT_TYPE_MOUSE) { if (input->type == INPUT_TYPE_MOUSE) {
unsigned char buttons = input->mouse_buttons; unsigned char buttons = input->mouse_buttons;
dbg("remote mouse movement: (x,y)=(%d,%d)%s%s%s%s\n", dbg("remote mouse movement: (x,y)=(%d,%d)%s%s%s%s\n",
input->data.mouse.x, input->data.mouse.y, input->data.mouse.x, input->data.mouse.y,
(buttons)?" -- buttons:":"", (buttons) ? " -- buttons:" : "",
(buttons & REMOTE_BUTTON_LEFT)?"left ":"", (buttons & REMOTE_BUTTON_LEFT) ? "left " : "",
(buttons & REMOTE_BUTTON_MIDDLE)?"middle ":"", (buttons & REMOTE_BUTTON_MIDDLE) ? "middle " : "",
(buttons & REMOTE_BUTTON_RIGHT)?"right":"" (buttons & REMOTE_BUTTON_RIGHT) ? "right" : ""
); );
} else { } else {
dbg("remote keypress (code, flag, down):" dbg("remote keypress (code, flag, down):"
...@@ -180,7 +177,7 @@ static void send_keyboard_event(struct input_dev *dev, ...@@ -180,7 +177,7 @@ static void send_keyboard_event(struct input_dev *dev,
key = xlate_high[code & 0xff]; key = xlate_high[code & 0xff];
else else
key = xlate[code]; key = xlate[code];
input_report_key(dev, key, (input->data.keyboard.key_down) ? 1 : 0); input_report_key(dev, key, input->data.keyboard.key_down);
input_sync(dev); input_sync(dev);
} }
...@@ -228,20 +225,22 @@ int ibmasm_init_remote_input_dev(struct service_processor *sp) ...@@ -228,20 +225,22 @@ int ibmasm_init_remote_input_dev(struct service_processor *sp)
mouse_dev->id.vendor = pdev->vendor; mouse_dev->id.vendor = pdev->vendor;
mouse_dev->id.product = pdev->device; mouse_dev->id.product = pdev->device;
mouse_dev->id.version = 1; mouse_dev->id.version = 1;
mouse_dev->dev.parent = sp->dev;
mouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); mouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
mouse_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | mouse_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) |
BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);
set_bit(BTN_TOUCH, mouse_dev->keybit); set_bit(BTN_TOUCH, mouse_dev->keybit);
mouse_dev->name = remote_mouse_name; mouse_dev->name = "ibmasm RSA I remote mouse";
input_set_abs_params(mouse_dev, ABS_X, 0, xmax, 0, 0); input_set_abs_params(mouse_dev, ABS_X, 0, MOUSE_X_MAX, 0, 0);
input_set_abs_params(mouse_dev, ABS_Y, 0, ymax, 0, 0); input_set_abs_params(mouse_dev, ABS_Y, 0, MOUSE_Y_MAX, 0, 0);
mouse_dev->id.bustype = BUS_PCI; keybd_dev->id.bustype = BUS_PCI;
keybd_dev->id.vendor = pdev->vendor; keybd_dev->id.vendor = pdev->vendor;
keybd_dev->id.product = pdev->device; keybd_dev->id.product = pdev->device;
mouse_dev->id.version = 2; keybd_dev->id.version = 2;
keybd_dev->dev.parent = sp->dev;
keybd_dev->evbit[0] = BIT(EV_KEY); keybd_dev->evbit[0] = BIT(EV_KEY);
keybd_dev->name = remote_keybd_name; keybd_dev->name = "ibmasm RSA I remote keyboard";
for (i = 0; i < XLATE_SIZE; i++) { for (i = 0; i < XLATE_SIZE; i++) {
if (xlate_high[i]) if (xlate_high[i])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment