Source
x
static int adbhid_kbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
// SPDX-License-Identifier: GPL-2.0
/*
* 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
*/
MODULE_AUTHOR("Franz Sirl <Franz.Sirl-kernel@lauterbach.com>");
static int restore_capslock_events;
module_param(restore_capslock_events, int, 0644);
MODULE_PARM_DESC(restore_capslock_events,
"Produce keypress events for capslock on both keyup and keydown.");
/* register # for key up/down data */
/* register # for leds on ADB keyboard */
/* 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 */
static const u16 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 */