/*
* drivers/macintosh/adbhid.c
*
* ADB HID driver for Power Macintosh computers.
*
* Adapted from drivers/macintosh/mac_keyb.c by Franz Sirl.
* drivers/macintosh/mac_keyb.c was Copyright (C) 1996 Paul Mackerras
* with considerable contributions from Ben Herrenschmidt and others.
*
* Copyright (C) 2000 Franz Sirl.
*
* Adapted to ADB changes and support for more devices by
* Benjamin Herrenschmidt. Adapted from code in MkLinux
* and reworked.
*
* Supported devices:
*
* - Standard 1 button mouse
* - All standard Apple Extended protocol (handler ID 4)
* - mouseman and trackman mice & trackballs
* - PowerBook Trackpad (default setup: enable tapping)
* - MicroSpeed mouse & trackball (needs testing)
* - CH Products Trackball Pro (needs testing)
* - Contour Design (Contour Mouse)
* - Hunter digital (NoHandsMouse)
* - Kensignton TurboMouse 5 (needs testing)
* - Mouse Systems A3 mice and trackballs <aidan@kublai.com>
* - MacAlly 2-buttons mouse (needs testing) <pochini@denise.shiny.it>
*
* To do:
*
* Improve Kensington support.
* Split mouse/kbd
* Move to syfs
*/
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/notifier.h>
#include <linux/input.h>
#include <linux/adb.h>
#include <linux/cuda.h>
#include <linux/pmu.h>
#include <asm/machdep.h>
#ifdef CONFIG_PPC_PMAC
#include <asm/backlight.h>
#include <asm/pmac_feature.h>
#endif
MODULE_AUTHOR("Franz Sirl <Franz.Sirl-kernel@lauterbach.com>");
#define KEYB_KEYREG 0 /* register # for key up/down data */
#define KEYB_LEDREG 2 /* register # for leds on ADB keyboard */
#define MOUSE_DATAREG 0 /* reg# for movement/button codes from mouse */
static int adb_message_handler(struct notifier_block *, unsigned long, void *);
static struct notifier_block adbhid_adb_notifier = {
.notifier_call = adb_message_handler,
};
/* Some special keys */
#define ADB_KEY_DEL 0x33
#define ADB_KEY_CMD 0x37
#define ADB_KEY_CAPSLOCK 0x39
#define ADB_KEY_FN 0x3f
#define ADB_KEY_FWDEL 0x75
#define ADB_KEY_POWER_OLD 0x7e
#define ADB_KEY_POWER 0x7f
u8 adb_to_linux_keycodes[128] = {
/* 0x00 */ KEY_A, /* 30 */
/* 0x01 */ KEY_S, /* 31 */
/* 0x02 */ KEY_D, /* 32 */
/* 0x03 */ KEY_F, /* 33 */
/* 0x04 */ KEY_H, /* 35 */
/* 0x05 */ KEY_G, /* 34 */
/* 0x06 */ KEY_Z, /* 44 */
/* 0x07 */ KEY_X, /* 45 */
/* 0x08 */ KEY_C, /* 46 */
/* 0x09 */ KEY_V, /* 47 */
/* 0x0a */ KEY_102ND, /* 86 */
/* 0x0b */ KEY_B, /* 48 */
/* 0x0c */ KEY_Q, /* 16 */
/* 0x0d */ KEY_W, /* 17 */
/* 0x0e */ KEY_E, /* 18 */
/* 0x0f */ KEY_R, /* 19 */
/* 0x10 */ KEY_Y, /* 21 */
/* 0x11 */ KEY_T, /* 20 */
/* 0x12 */ KEY_1, /* 2 */
/* 0x13 */ KEY_2, /* 3 */
/* 0x14 */ KEY_3, /* 4 */
/* 0x15 */ KEY_4, /* 5 */
/* 0x16 */ KEY_6, /* 7 */
/* 0x17 */ KEY_5, /* 6 */
/* 0x18 */ KEY_EQUAL, /* 13 */
/* 0x19 */ KEY_9, /* 10 */
/* 0x1a */ KEY_7, /* 8 */
/* 0x1b */ KEY_MINUS, /* 12 */
/* 0x1c */ KEY_8, /* 9 */
/* 0x1d */ KEY_0, /* 11 */
/* 0x1e */ KEY_RIGHTBRACE, /* 27 */
/* 0x1f */ KEY_O, /* 24 */
/* 0x20 */ KEY_U, /* 22 */
/* 0x21 */ KEY_LEFTBRACE, /* 26 */
/* 0x22 */ KEY_I, /* 23 */
/* 0x23 */ KEY_P, /* 25 */
/* 0x24 */ KEY_ENTER, /* 28 */
/* 0x25 */ KEY_L, /* 38 */
/* 0x26 */ KEY_J, /* 36 */
/* 0x27 */ KEY_APOSTROPHE, /* 40 */
/* 0x28 */ KEY_K, /* 37 */
/* 0x29 */ KEY_SEMICOLON, /* 39 */
/* 0x2a */ KEY_BACKSLASH, /* 43 */
/* 0x2b */ KEY_COMMA, /* 51 */
/* 0x2c */ KEY_SLASH, /* 53 */
/* 0x2d */ KEY_N, /* 49 */
/* 0x2e */ KEY_M, /* 50 */
/* 0x2f */ KEY_DOT, /* 52 */
/* 0x30 */ KEY_TAB, /* 15 */
/* 0x31 */ KEY_SPACE, /* 57 */
/* 0x32 */ KEY_GRAVE, /* 41 */
/* 0x33 */ KEY_BACKSPACE, /* 14 */