Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+18 −19
Original line number Diff line number Diff line
@@ -28,11 +28,10 @@
#include "ibmasm.h"
#include "remote.h"

static int xmax = 1600;
static int ymax = 1200;
#define MOUSE_X_MAX	1600
#define MOUSE_Y_MAX	1200


static unsigned short xlate_high[XLATE_SIZE] = {
static const unsigned short xlate_high[XLATE_SIZE] = {
	[KEY_SYM_ENTER & 0xff] = KEY_ENTER,
	[KEY_SYM_KPSLASH & 0xff] = KEY_KPSLASH,
	[KEY_SYM_KPSTAR & 0xff] = KEY_KPASTERISK,
@@ -81,7 +80,8 @@ static unsigned short xlate_high[XLATE_SIZE] = {
	[KEY_SYM_NUM_LOCK & 0xff] = KEY_NUMLOCK,
	[KEY_SYM_SCR_LOCK & 0xff] = KEY_SCROLLLOCK,
};
static unsigned short xlate[XLATE_SIZE] = {

static const unsigned short xlate[XLATE_SIZE] = {
	[NO_KEYCODE] = KEY_RESERVED,
	[KEY_SYM_SPACE] = KEY_SPACE,
	[KEY_SYM_TILDE] = KEY_GRAVE,        [KEY_SYM_BKTIC] = KEY_GRAVE,
@@ -133,9 +133,6 @@ static unsigned short xlate[XLATE_SIZE] = {
	[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)
{
	if (input->type == INPUT_TYPE_MOUSE) {
@@ -180,7 +177,7 @@ static void send_keyboard_event(struct input_dev *dev,
		key = xlate_high[code & 0xff];
	else
		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);
}

@@ -228,20 +225,22 @@ int ibmasm_init_remote_input_dev(struct service_processor *sp)
	mouse_dev->id.vendor = pdev->vendor;
	mouse_dev->id.product = pdev->device;
	mouse_dev->id.version = 1;
	mouse_dev->dev.parent = sp->dev;
	mouse_dev->evbit[0]  = BIT(EV_KEY) | BIT(EV_ABS);
	mouse_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) |
		BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);
	set_bit(BTN_TOUCH, mouse_dev->keybit);
	mouse_dev->name = remote_mouse_name;
	input_set_abs_params(mouse_dev, ABS_X, 0, xmax, 0, 0);
	input_set_abs_params(mouse_dev, ABS_Y, 0, ymax, 0, 0);
	mouse_dev->name = "ibmasm RSA I remote mouse";
	input_set_abs_params(mouse_dev, ABS_X, 0, MOUSE_X_MAX, 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.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->name = remote_keybd_name;
	keybd_dev->name = "ibmasm RSA I remote keyboard";

	for (i = 0; i < XLATE_SIZE; i++) {
		if (xlate_high[i])