|
@@ -757,6 +757,7 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
|
|
|
struct input_dev *input_dev;
|
|
|
int err;
|
|
|
int i;
|
|
|
+ char *keyboard_type;
|
|
|
|
|
|
if (adbhid[id]) {
|
|
|
pr_err("Trying to reregister ADB HID on ID %d\n", id);
|
|
@@ -798,24 +799,23 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
|
|
|
|
|
|
memcpy(hid->keycode, adb_to_linux_keycodes, sizeof(adb_to_linux_keycodes));
|
|
|
|
|
|
- pr_info("Detected ADB keyboard, type ");
|
|
|
switch (original_handler_id) {
|
|
|
default:
|
|
|
- pr_cont("<unknown>.\n");
|
|
|
+ keyboard_type = "<unknown>";
|
|
|
input_dev->id.version = ADB_KEYBOARD_UNKNOWN;
|
|
|
break;
|
|
|
|
|
|
case 0x01: case 0x02: case 0x03: case 0x06: case 0x08:
|
|
|
case 0x0C: case 0x10: case 0x18: case 0x1B: case 0x1C:
|
|
|
case 0xC0: case 0xC3: case 0xC6:
|
|
|
- pr_cont("ANSI.\n");
|
|
|
+ keyboard_type = "ANSI";
|
|
|
input_dev->id.version = ADB_KEYBOARD_ANSI;
|
|
|
break;
|
|
|
|
|
|
case 0x04: case 0x05: case 0x07: case 0x09: case 0x0D:
|
|
|
case 0x11: case 0x14: case 0x19: case 0x1D: case 0xC1:
|
|
|
case 0xC4: case 0xC7:
|
|
|
- pr_cont("ISO, swapping keys.\n");
|
|
|
+ keyboard_type = "ISO, swapping keys";
|
|
|
input_dev->id.version = ADB_KEYBOARD_ISO;
|
|
|
i = hid->keycode[10];
|
|
|
hid->keycode[10] = hid->keycode[50];
|
|
@@ -824,10 +824,11 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
|
|
|
|
|
|
case 0x12: case 0x15: case 0x16: case 0x17: case 0x1A:
|
|
|
case 0x1E: case 0xC2: case 0xC5: case 0xC8: case 0xC9:
|
|
|
- pr_cont("JIS.\n");
|
|
|
+ keyboard_type = "JIS";
|
|
|
input_dev->id.version = ADB_KEYBOARD_JIS;
|
|
|
break;
|
|
|
}
|
|
|
+ pr_info("Detected ADB keyboard, type %s.\n", keyboard_type);
|
|
|
|
|
|
for (i = 0; i < 128; i++)
|
|
|
if (hid->keycode[i])
|
|
@@ -972,16 +973,13 @@ adbhid_probe(void)
|
|
|
->get it to send separate codes for left and right shift,
|
|
|
control, option keys */
|
|
|
#if 0 /* handler 5 doesn't send separate codes for R modifiers */
|
|
|
- if (adb_try_handler_change(id, 5))
|
|
|
- printk("ADB keyboard at %d, handler set to 5\n", id);
|
|
|
- else
|
|
|
+ if (!adb_try_handler_change(id, 5))
|
|
|
#endif
|
|
|
- if (adb_try_handler_change(id, 3))
|
|
|
- printk("ADB keyboard at %d, handler set to 3\n", id);
|
|
|
- else
|
|
|
- printk("ADB keyboard at %d, handler 1\n", id);
|
|
|
+ adb_try_handler_change(id, 3);
|
|
|
|
|
|
adb_get_infos(id, &default_id, &cur_handler_id);
|
|
|
+ printk(KERN_DEBUG "ADB keyboard at %d has handler 0x%X\n",
|
|
|
+ id, cur_handler_id);
|
|
|
reg |= adbhid_input_reregister(id, default_id, org_handler_id,
|
|
|
cur_handler_id, 0);
|
|
|
}
|
|
@@ -999,48 +997,44 @@ adbhid_probe(void)
|
|
|
for (i = 0; i < mouse_ids.nids; i++) {
|
|
|
int id = mouse_ids.id[i];
|
|
|
int mouse_kind;
|
|
|
+ char *desc = "standard";
|
|
|
|
|
|
adb_get_infos(id, &default_id, &org_handler_id);
|
|
|
|
|
|
if (adb_try_handler_change(id, 4)) {
|
|
|
- printk("ADB mouse at %d, handler set to 4", id);
|
|
|
mouse_kind = ADBMOUSE_EXTENDED;
|
|
|
}
|
|
|
else if (adb_try_handler_change(id, 0x2F)) {
|
|
|
- printk("ADB mouse at %d, handler set to 0x2F", id);
|
|
|
mouse_kind = ADBMOUSE_MICROSPEED;
|
|
|
}
|
|
|
else if (adb_try_handler_change(id, 0x42)) {
|
|
|
- printk("ADB mouse at %d, handler set to 0x42", id);
|
|
|
mouse_kind = ADBMOUSE_TRACKBALLPRO;
|
|
|
}
|
|
|
else if (adb_try_handler_change(id, 0x66)) {
|
|
|
- printk("ADB mouse at %d, handler set to 0x66", id);
|
|
|
mouse_kind = ADBMOUSE_MICROSPEED;
|
|
|
}
|
|
|
else if (adb_try_handler_change(id, 0x5F)) {
|
|
|
- printk("ADB mouse at %d, handler set to 0x5F", id);
|
|
|
mouse_kind = ADBMOUSE_MICROSPEED;
|
|
|
}
|
|
|
else if (adb_try_handler_change(id, 3)) {
|
|
|
- printk("ADB mouse at %d, handler set to 3", id);
|
|
|
mouse_kind = ADBMOUSE_MS_A3;
|
|
|
}
|
|
|
else if (adb_try_handler_change(id, 2)) {
|
|
|
- printk("ADB mouse at %d, handler set to 2", id);
|
|
|
mouse_kind = ADBMOUSE_STANDARD_200;
|
|
|
}
|
|
|
else {
|
|
|
- printk("ADB mouse at %d, handler 1", id);
|
|
|
mouse_kind = ADBMOUSE_STANDARD_100;
|
|
|
}
|
|
|
|
|
|
if ((mouse_kind == ADBMOUSE_TRACKBALLPRO)
|
|
|
|| (mouse_kind == ADBMOUSE_MICROSPEED)) {
|
|
|
+ desc = "Microspeed/MacPoint or compatible";
|
|
|
init_microspeed(id);
|
|
|
} else if (mouse_kind == ADBMOUSE_MS_A3) {
|
|
|
+ desc = "Mouse Systems A3 Mouse or compatible";
|
|
|
init_ms_a3(id);
|
|
|
} else if (mouse_kind == ADBMOUSE_EXTENDED) {
|
|
|
+ desc = "extended";
|
|
|
/*
|
|
|
* Register 1 is usually used for device
|
|
|
* identification. Here, we try to identify
|
|
@@ -1054,32 +1048,36 @@ adbhid_probe(void)
|
|
|
(req.reply[1] == 0x9a) && ((req.reply[2] == 0x21)
|
|
|
|| (req.reply[2] == 0x20))) {
|
|
|
mouse_kind = ADBMOUSE_TRACKBALL;
|
|
|
+ desc = "trackman/mouseman";
|
|
|
init_trackball(id);
|
|
|
}
|
|
|
else if ((req.reply_len >= 4) &&
|
|
|
(req.reply[1] == 0x74) && (req.reply[2] == 0x70) &&
|
|
|
(req.reply[3] == 0x61) && (req.reply[4] == 0x64)) {
|
|
|
mouse_kind = ADBMOUSE_TRACKPAD;
|
|
|
+ desc = "trackpad";
|
|
|
init_trackpad(id);
|
|
|
}
|
|
|
else if ((req.reply_len >= 4) &&
|
|
|
(req.reply[1] == 0x4b) && (req.reply[2] == 0x4d) &&
|
|
|
(req.reply[3] == 0x4c) && (req.reply[4] == 0x31)) {
|
|
|
mouse_kind = ADBMOUSE_TURBOMOUSE5;
|
|
|
+ desc = "TurboMouse 5";
|
|
|
init_turbomouse(id);
|
|
|
}
|
|
|
else if ((req.reply_len == 9) &&
|
|
|
(req.reply[1] == 0x4b) && (req.reply[2] == 0x4f) &&
|
|
|
(req.reply[3] == 0x49) && (req.reply[4] == 0x54)) {
|
|
|
if (adb_try_handler_change(id, 0x42)) {
|
|
|
- pr_cont("\nADB MacAlly 2-button mouse at %d, handler set to 0x42", id);
|
|
|
mouse_kind = ADBMOUSE_MACALLY2;
|
|
|
+ desc = "MacAlly 2-button";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- pr_cont("\n");
|
|
|
|
|
|
adb_get_infos(id, &default_id, &cur_handler_id);
|
|
|
+ printk(KERN_DEBUG "ADB mouse (%s) at %d has handler 0x%X\n",
|
|
|
+ desc, id, cur_handler_id);
|
|
|
reg |= adbhid_input_reregister(id, default_id, org_handler_id,
|
|
|
cur_handler_id, mouse_kind);
|
|
|
}
|
|
@@ -1092,12 +1090,10 @@ init_trackpad(int id)
|
|
|
struct adb_request req;
|
|
|
unsigned char r1_buffer[8];
|
|
|
|
|
|
- pr_cont(" (trackpad)");
|
|
|
-
|
|
|
adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
|
|
|
ADB_READREG(id,1));
|
|
|
if (req.reply_len < 8)
|
|
|
- pr_cont("bad length for reg. 1\n");
|
|
|
+ pr_err("%s: bad length for reg. 1\n", __func__);
|
|
|
else
|
|
|
{
|
|
|
memcpy(r1_buffer, &req.reply[1], 8);
|
|
@@ -1145,8 +1141,6 @@ init_trackball(int id)
|
|
|
{
|
|
|
struct adb_request req;
|
|
|
|
|
|
- pr_cont(" (trackman/mouseman)");
|
|
|
-
|
|
|
adb_request(&req, NULL, ADBREQ_SYNC, 3,
|
|
|
ADB_WRITEREG(id,1), 00,0x81);
|
|
|
|
|
@@ -1177,8 +1171,6 @@ init_turbomouse(int id)
|
|
|
{
|
|
|
struct adb_request req;
|
|
|
|
|
|
- pr_cont(" (TurboMouse 5)");
|
|
|
-
|
|
|
adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(id));
|
|
|
|
|
|
adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(3));
|
|
@@ -1213,8 +1205,6 @@ init_microspeed(int id)
|
|
|
{
|
|
|
struct adb_request req;
|
|
|
|
|
|
- pr_cont(" (Microspeed/MacPoint or compatible)");
|
|
|
-
|
|
|
adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(id));
|
|
|
|
|
|
/* This will initialize mice using the Microspeed, MacPoint and
|
|
@@ -1253,7 +1243,6 @@ init_ms_a3(int id)
|
|
|
{
|
|
|
struct adb_request req;
|
|
|
|
|
|
- pr_cont(" (Mouse Systems A3 Mouse, or compatible)");
|
|
|
adb_request(&req, NULL, ADBREQ_SYNC, 3,
|
|
|
ADB_WRITEREG(id, 0x2),
|
|
|
0x00,
|