Author: axeld Date: 2010-04-14 21:19:14 +0200 (Wed, 14 Apr 2010) New Revision: 36267 Changeset: http://dev.haiku-os.org/changeset/36267/haiku Added: haiku/trunk/headers/private/input/keyboard_mouse_driver.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ATKeymap.h Removed: haiku/trunk/headers/private/input/kb_mouse_driver.h haiku/trunk/src/add-ons/input_server/devices/keyboard/ATKeymap.h Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.c haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/MouseDevice.cpp haiku/trunk/src/preferences/touchpad/TouchpadPref.cpp haiku/trunk/src/preferences/touchpad/TouchpadPrefView.cpp haiku/trunk/src/servers/input/InputServer.cpp haiku/trunk/src/tests/system/consoled/consoled.cpp Log: * Removed the at_kbd_io and AT keyboard stuff; this is now done within the PS/2 driver, and that driver is using the raw_key_info structure as well. * Renamed kb_mouse_driver.h to keyboard_mouse_driver.h. * Minor cleanup. Copied: haiku/trunk/headers/private/input/keyboard_mouse_driver.h (from rev 36257, haiku/trunk/headers/private/input/kb_mouse_driver.h) =================================================================== --- haiku/trunk/headers/private/input/keyboard_mouse_driver.h (rev 0) +++ haiku/trunk/headers/private/input/keyboard_mouse_driver.h 2010-04-14 19:19:14 UTC (rev 36267) @@ -0,0 +1,137 @@ +/* + * Copyright 2002-2010, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _KEYBOARD_MOUSE_DRIVER_H +#define _KEYBOARD_MOUSE_DRIVER_H + + +#include <SupportDefs.h> +#include <Drivers.h> + + +#define KEY_Scroll 0x0f +#define KEY_Pause 0x10 +#define KEY_Num 0x22 +#define KEY_CapsLock 0x3b +#define KEY_ShiftL 0x4b +#define KEY_ShiftR 0x56 +#define KEY_ControlL 0x5c +#define KEY_CmdL 0x5d +#define KEY_AltL 0x5d +#define KEY_CmdR 0x5f +#define KEY_AltR 0x5f +#define KEY_ControlR 0x60 +#define KEY_OptL 0x66 +#define KEY_WinL 0x66 +#define KEY_OptR 0x67 +#define KEY_WinR 0x67 +#define KEY_Menu 0x68 +#define KEY_NumEqual 0x6a +#define KEY_Power 0x6b +#define KEY_SysRq 0x7e +#define KEY_Break 0x7f +#define KEY_Spacebar 0x5e + +#define KB_DEFAULT_CONTROL_ALT_DEL_TIMEOUT 4000000 + +enum { + KB_READ = B_DEVICE_OP_CODES_END, + KB_GET_KEYBOARD_ID, + KB_SET_LEDS, + KB_SET_KEY_REPEATING, + KB_SET_KEY_NONREPEATING, + KB_SET_KEY_REPEAT_RATE, + KB_GET_KEY_REPEAT_RATE, + KB_SET_KEY_REPEAT_DELAY, + KB_GET_KEY_REPEAT_DELAY, + KB_SET_CONTROL_ALT_DEL_TIMEOUT, + KB_RESERVED_1, + KB_CANCEL_CONTROL_ALT_DEL, + KB_DELAY_CONTROL_ALT_DEL, + KB_SET_DEBUG_READER, + + MS_READ = B_DEVICE_OP_CODES_END + 100, + MS_NUM_EVENTS, + MS_GET_ACCEL, + MS_SET_ACCEL, + MS_GET_TYPE, + MS_SET_TYPE, + MS_GET_MAP, + MS_SET_MAP, + MS_GET_CLICKSPEED, + MS_SET_CLICKSPEED, + MS_NUM_SERIAL_MICE, + MS_IS_TOUCHPAD, + MS_SET_TOUCHPAD_SETTINGS, + + IIC_WRITE = B_DEVICE_OP_CODES_END + 200, + RESTART_SYSTEM, + SHUTDOWN_SYSTEM +}; + + +typedef struct { + bigtime_t timestamp; + uint32 keycode; + bool is_keydown; +} raw_key_info; + + +typedef struct { + bool num_lock; + bool caps_lock; + bool scroll_lock; +} led_info; + + +typedef struct { + int32 cookie; + uint32 buttons; + int32 xdelta; + int32 ydelta; + int32 clicks; + int32 modifiers; + bigtime_t timestamp; + int32 wheel_ydelta; + int32 wheel_xdelta; +} mouse_movement; + + +typedef struct { + uint32 buttons; + float xpos; + float ypos; + bool has_contact; + float pressure; + int32 clicks; + bool eraser; + bigtime_t timestamp; + int32 wheel_ydelta; + int32 wheel_xdelta; + float tilt_x; + float tilt_y; +} tablet_movement; + + +#define B_ONE_FINGER 0x01 +#define B_TWO_FINGER 0x02 +#define B_MULTI_FINGER 0x04 +#define B_PEN 0x08 + + +typedef struct { + uint8 buttons; + uint32 xPosition; + uint32 yPosition; + uint8 zPressure; + uint8 fingers; + bool gesture; + uint8 fingerWidth; + // 1 - 4 normal width + // 5 - 11 very wide finger or palm + // 12 maximum reportable width; extrem wide contact +} touchpad_movement; + + +#endif // _KB_MOUSE_DRIVER_H Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 2010-04-14 19:16:30 UTC (rev 36266) +++ haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 2010-04-14 19:19:14 UTC (rev 36267) @@ -23,8 +23,7 @@ #include <Path.h> #include <String.h> -#include "ATKeymap.h" -#include "kb_mouse_driver.h" +#include <keyboard_mouse_driver.h> #undef TRACE @@ -143,8 +142,6 @@ fDeviceRef.type = B_KEYBOARD_DEVICE; fDeviceRef.cookie = this; - fIsAT = strstr(path, "keyboard/at") != NULL; - if (be_app->Lock()) { be_app->AddHandler(this); be_app->Unlock(); @@ -274,7 +271,7 @@ _UpdateSettings(0); - uint8 buffer[16]; + raw_key_info keyInfo; uint8 activeDeadKey = 0; uint32 lastKeyCode = 0; uint32 repeatCount = 1; @@ -284,7 +281,7 @@ memset(states, 0, sizeof(states)); while (fActive) { - if (ioctl(fFD, KB_READ, &buffer) != B_OK) { + if (ioctl(fFD, KB_READ, &keyInfo) != B_OK) { _ControlThreadCleanup(); // TOAST! return 0; @@ -296,31 +293,15 @@ fUpdateSettings = false; } - uint32 keycode = 0; - bool isKeyDown = false; - bigtime_t timestamp = 0; + uint32 keycode = keyInfo.keycode; + bool isKeyDown = keyInfo.is_keydown; - LOG_EVENT("KB_READ :"); + LOG_EVENT("KB_READ: %Ld, %02x, %02lx\n", keyInfo.timestamp, isKeyDown, + keycode); - if (fIsAT) { - at_kbd_io* atKeyboard = (at_kbd_io*)buffer; - if (atKeyboard->scancode > 0) - keycode = kATKeycodeMap[atKeyboard->scancode - 1]; - isKeyDown = atKeyboard->is_keydown; - timestamp = atKeyboard->timestamp; - LOG_EVENT(" %02x", atKeyboard->scancode); - } else { - raw_key_info* rawKeyInfo= (raw_key_info*)buffer; - isKeyDown = rawKeyInfo->is_keydown; - timestamp = rawKeyInfo->timestamp; - keycode = rawKeyInfo->be_keycode; - } - if (keycode == 0) continue; - LOG_EVENT(" %Ld, %02x, %02lx\n", timestamp, isKeyDown, keycode); - if (isKeyDown && keycode == 0x68) { // MENU KEY for Tracker bool noOtherKeyPressed = true; @@ -402,7 +383,7 @@ if (message == NULL) continue; - message->AddInt64("when", timestamp); + message->AddInt64("when", keyInfo.timestamp); message->AddInt32("be:old_modifiers", oldModifiers); message->AddInt32("modifiers", fModifiers); message->AddData("states", B_UINT8_TYPE, states, 16); @@ -440,7 +421,7 @@ else msg->what = isKeyDown ? B_UNMAPPED_KEY_DOWN : B_UNMAPPED_KEY_UP; - msg->AddInt64("when", timestamp); + msg->AddInt64("when", keyInfo.timestamp); msg->AddInt32("key", keycode); msg->AddInt32("modifiers", fModifiers); msg->AddData("states", B_UINT8_TYPE, states, 16); Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h 2010-04-14 19:16:30 UTC (rev 36266) +++ haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h 2010-04-14 19:19:14 UTC (rev 36267) @@ -1,6 +1,8 @@ /* * Copyright 2004-2008, Jérôme Duval. All rights reserved. + * Copyright 2005-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx * Copyright 2008, Stephan Aßmus, superstippi@xxxxxxx + * * Distributed under the terms of the MIT License. */ #ifndef KEYBOARD_INPUT_DEVICE_H @@ -55,7 +57,6 @@ thread_id fThread; kb_settings fSettings; volatile bool fActive; - bool fIsAT; volatile bool fInputMethodStarted; uint32 fModifiers; uint32 fCommandKey; Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2010-04-14 19:16:30 UTC (rev 36266) +++ haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2010-04-14 19:19:14 UTC (rev 36267) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2009, Haiku. + * Copyright 2004-2010, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -30,9 +30,9 @@ #include <String.h> #include <View.h> -#include "kb_mouse_settings.h" -#include "kb_mouse_driver.h" -#include "touchpad_settings.h" +#include <kb_mouse_settings.h> +#include <keyboard_mouse_driver.h> +#include <touchpad_settings.h> #undef TRACE Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ATKeymap.h (from rev 36259, haiku/trunk/src/add-ons/input_server/devices/keyboard/ATKeymap.h) =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ATKeymap.h (rev 0) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ATKeymap.h 2010-04-14 19:19:14 UTC (rev 36267) @@ -0,0 +1,307 @@ +/* + * Copyright 2004-2006, Jérôme Duval. All rights reserved. + * Copyright 2005-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx + * Distributed under the terms of the MIT License. + */ +#ifndef AT_KEYMAP_H +#define AT_KEYMAP_H + + +#include <SupportDefs.h> + + +const static uint32 kATKeycodeMap[] = { + 0x1, // Esc + 0x12, // 1 + 0x13, // 2 + 0x14, // 3 + 0x15, // 4 + 0x16, // 5 + 0x17, // 6 + 0x18, // 7 + 0x19, // 8 + 0x1a, // 9 + 0x1b, // 0 + 0x1c, // - + 0x1d, // = + 0x1e, // BACKSPACE + 0x26, // TAB + 0x27, // Q + 0x28, // W + 0x29, // E + 0x2a, // R + 0x2b, // T + 0x2c, // Y + 0x2d, // U + 0x2e, // I + 0x2f, // O + 0x30, // P + 0x31, // [ + 0x32, // ] + 0x47, // ENTER + 0x5c, // Left Control + 0x3c, // A + 0x3d, // S + 0x3e, // D + 0x3f, // F + 0x40, // G + 0x41, // H + 0x42, // J + 0x43, // K + 0x44, // L + 0x45, // ; + 0x46, // ' + 0x11, // ` + 0x4b, // Left Shift + 0x33, // \ (backslash -- note: don't remove non-white-space after BS char) + 0x4c, // Z + 0x4d, // X + 0x4e, // C + 0x4f, // V + 0x50, // B + 0x51, // N + 0x52, // M + 0x53, // , + 0x54, // . + 0x55, // / + 0x56, // Right Shift + 0x24, // * + 0x5d, // Left Alt + 0x5e, // Space + 0x3b, // Caps + 0x02, // F1 + 0x03, // F2 + 0x04, // F3 + 0x05, // F4 + 0x06, // F5 + 0x07, // F6 + 0x08, // F7 + 0x09, // F8 + 0x0a, // F9 + 0x0b, // F10 + 0x22, // Num + 0x0f, // Scroll + 0x37, // KP 7 + 0x38, // KP 8 + 0x39, // KP 9 + 0x25, // KP - + 0x48, // KP 4 + 0x49, // KP 5 + 0x4a, // KP 6 + 0x3a, // KP + + 0x58, // KP 1 + 0x59, // KP 2 + 0x5a, // KP 3 + 0x64, // KP 0 + 0x65, // KP . + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x69, // < + 0x0c, // F11 + 0x0d, // F12 + 0x00, // UNMAPPED + 0x00, // UNMAPPED 90 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 100 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 110 + 0x00, // UNMAPPED + 0x6e, // Katakana/Hiragana, second key right to spacebar, japanese + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x6b, // Ro (\\ key, japanese) + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 120 + 0x6d, // Henkan, first key right to spacebar, japanese + 0x00, // UNMAPPED + 0x6c, // Muhenkan, key left to spacebar, japanese + 0x00, // UNMAPPED + 0x6a, // Yen (macron key, japanese) + 0x70, // Keypad . on Brazilian ABNT2 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 130 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 140 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 150 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x5b, // KP Enter + 0x60, // Right Control + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 160 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 170 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 180 + 0x23, // KP / + 0x00, // UNMAPPED + 0x0e, // Print Screen + 0x5f, // Right Alt + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 190 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x7f, // Break + 0x20, // Home + 0x57, // Up Arrow 200 + 0x21, // Page Up + 0x00, // UNMAPPED + 0x61, // Left Arrow + 0x00, // UNMAPPED + 0x63, // Right Arrow + 0x00, // UNMAPPED + 0x35, // End + 0x62, // Down Arrow + 0x36, // Page Down + 0x1f, // Insert 200 + 0x34, // Delete + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x66, // Left Gui + 0x67, // Right Gui 210 + 0x68, // Menu + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED 220 + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED + 0x00, // UNMAPPED +}; + + +#endif // AT_KEYMAP_H Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp 2010-04-14 19:16:30 UTC (rev 36266) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp 2010-04-14 19:19:14 UTC (rev 36267) @@ -21,8 +21,9 @@ #include <lock.h> #include <util/AutoLock.h> +#include "ATKeymap.h" #include "ps2_service.h" -#include "kb_mouse_driver.h" +#include "keyboard_mouse_driver.h" #include "packet_buffer.h" @@ -123,7 +124,7 @@ EMERGENCY_SYS_REQ = 0x04, }; static int emergencyKeyStatus = 0; - at_kbd_io keyInfo; + raw_key_info keyInfo; uint8 scancode = dev->history[0].data; if (atomic_get(&sKeyboardOpenCount) == 0) @@ -176,7 +177,7 @@ keyInfo.timestamp = system_time(); keyInfo.is_keydown = false; for (size_t i = 0; i < sizeof(kKeys) / sizeof(kKeys[0]); i++) { - keyInfo.scancode = kKeys[i]; + keyInfo.keycode = kATKeycodeMap[kKeys[i] - 1]; if (packet_buffer_write(sKeyBuffer, (uint8 *)&keyInfo, sizeof(keyInfo)) != 0) release_sem_etc(sKeyboardSem, 1, B_DO_NOT_RESCHEDULE); @@ -186,7 +187,7 @@ } keyInfo.timestamp = dev->history[0].time; - keyInfo.scancode = scancode; + keyInfo.keycode = kATKeycodeMap[scancode - 1]; if (packet_buffer_write(sKeyBuffer, (uint8 *)&keyInfo, sizeof(keyInfo)) == 0) { @@ -203,7 +204,7 @@ static status_t -read_keyboard_packet(at_kbd_io *packet, bool isDebugger) +read_keyboard_packet(raw_key_info *packet, bool isDebugger) { status_t status; @@ -326,7 +327,8 @@ return sKeyboardSem; } - sKeyBuffer = create_packet_buffer(KEY_BUFFER_SIZE * sizeof(at_kbd_io)); + sKeyBuffer + = create_packet_buffer(KEY_BUFFER_SIZE * sizeof(raw_key_info)); if (sKeyBuffer == NULL) { delete_sem(sKeyboardSem); delete cookie; @@ -411,7 +413,7 @@ } else if (!cookie->is_debugger && !cookie->is_reader) return B_BUSY; - at_kbd_io packet; + raw_key_info packet; status_t status = read_keyboard_packet(&packet, cookie->is_debugger); TRACE("ps2: ioctl KB_READ: %s\n", strerror(status)); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c 2010-04-14 19:16:30 UTC (rev 36266) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c 2010-04-14 19:19:14 UTC (rev 36267) @@ -1,9 +1,7 @@ /* - * Copyright 2001-2008 Haiku, Inc. + * Copyright 2001-2010 Haiku, Inc. * Distributed under the terms of the MIT License. * - * PS/2 mouse device driver - * * Authors (in chronological order): * Elad Lahav (elad@xxxxxxxxxxxxxx) * Stefano Ceccherini (burton666@xxxxxxxxx) @@ -12,51 +10,54 @@ * Clemens Zeidler <czeidler@xxxxxx> */ -/* - * A PS/2 mouse is connected to the IBM 8042 controller, and gets its - * name from the IBM PS/2 personal computer, which was the first to - * use this device. All resources are shared between the keyboard, and - * the mouse, referred to as the "Auxiliary Device". - * - * I/O: - * ~~~ - * The controller has 3 I/O registers: - * 1. Status (input), mapped to port 64h - * 2. Control (output), mapped to port 64h - * 3. Data (input/output), mapped to port 60h - * - * Data: - * ~~~~ - * A packet read from the mouse data port is composed of - * three bytes: - * byte 0: status byte, where - * - bit 7: Y overflow (1 = true) - * - bit 6: X overflow (1 = true) - * - bit 5: MSB of Y offset - * - bit 4: MSB of X offset - * - bit 3: Syncronization bit (always 1) - * - bit 2: Middle button (1 = down) - * - bit 1: Right button (1 = down) - * - bit 0: Left button (1 = down) - * byte 1: X position change, since last probed (-127 to +127) - * byte 2: Y position change, since last probed (-127 to +127) - * - * Intellimouse mice send a four byte packet, where the first three - * bytes are the same as standard mice, and the last one reports the - * Z position, which is, usually, the wheel movement. - * - * Interrupts: - * ~~~~~~~~~~ - * The PS/2 mouse device is connected to interrupt 12. - * The controller uses 3 consecutive interrupts to inform the computer - * that it has new data. On the first the data register holds the status - * byte, on the second the X offset, and on the 3rd the Y offset. - */ +/*! PS/2 mouse device driver + A PS/2 mouse is connected to the IBM 8042 controller, and gets its + name from the IBM PS/2 personal computer, which was the first to + use this device. All resources are shared between the keyboard, and + the mouse, referred to as the "Auxiliary Device". + + I/O: + ~~~ + The controller has 3 I/O registers: + 1. Status (input), mapped to port 64h + 2. Control (output), mapped to port 64h + 3. Data (input/output), mapped to port 60h + + Data: + ~~~~ + A packet read from the mouse data port is composed of + three bytes: + byte 0: status byte, where + - bit 7: Y overflow (1 = true) + - bit 6: X overflow (1 = true) + - bit 5: MSB of Y offset + - bit 4: MSB of X offset + - bit 3: Syncronization bit (always 1) + - bit 2: Middle button (1 = down) + - bit 1: Right button (1 = down) + - bit 0: Left button (1 = down) + byte 1: X position change, since last probed (-127 to +127) + byte 2: Y position change, since last probed (-127 to +127) + + Intellimouse mice send a four byte packet, where the first three + bytes are the same as standard mice, and the last one reports the + Z position, which is, usually, the wheel movement. + + Interrupts: + ~~~~~~~~~~ + The PS/2 mouse device is connected to interrupt 12. + The controller uses 3 consecutive interrupts to inform the computer + that it has new data. On the first the data register holds the status + byte, on the second the X offset, and on the 3rd the Y offset. +*/ + + +#include <stdlib.h> #include <string.h> -#include <malloc.h> -#include "kb_mouse_driver.h" +#include <keyboard_mouse_driver.h> + #include "ps2_service.h" #include "ps2_standard_mouse.h" @@ -74,8 +75,9 @@ "input/mouse/ps2/intelli_3" }; -/** Set sampling rate of the ps2 port. - */ + +/*! Set sampling rate of the ps2 port. +*/ static inline status_t ps2_set_sample_rate(ps2_dev *dev, uint8 rate) { @@ -83,8 +85,8 @@ } -/** Converts a packet received by the mouse to a "movement". - */ +/*! Converts a packet received by the mouse to a "movement". +*/ static void ps2_packet_to_movement(standard_mouse_cookie *cookie, uint8 packet[], mouse_movement *pos) @@ -145,8 +147,8 @@ } -/** Read a mouse event from the mouse events chain buffer. - */ +/*! Read a mouse event from the mouse events chain buffer. +*/ static status_t standard_mouse_read_event(standard_mouse_cookie *cookie, mouse_movement *movement) @@ -181,6 +183,9 @@ } +// #pragma mark - + + void standard_mouse_disconnect(ps2_dev *dev) { @@ -191,12 +196,12 @@ } -/** Interrupt handler for the mouse device. Called whenever the I/O - * controller generates an interrupt for the PS/2 mouse. Reads mouse - * information from the data port, and stores it, so it can be accessed - * by read() operations. The full data is obtained using 3 consecutive - * calls to the handler, each holds a different byte on the data port. - */ +/*! Interrupt handler for the mouse device. Called whenever the I/O + controller generates an interrupt for the PS/2 mouse. Reads mouse + information from the data port, and stores it, so it can be accessed + by read() operations. The full data is obtained using 3 consecutive + calls to the handler, each holds a different byte on the data port. +*/ int32 standard_mouse_handle_int(ps2_dev *dev) { Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h 2010-04-14 19:16:30 UTC (rev 36266) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h 2010-04-14 19:19:14 UTC (rev 36267) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2008 Haiku, Inc. + * Copyright 2001-2010 Haiku, Inc. * Distributed under the terms of the MIT License. * * PS/2 mouse device driver @@ -11,26 +11,26 @@ * Marcus Overhagen <marcus@xxxxxxxxxxxx> * Clemens Zeidler <czeidler@xxxxxx> */ - #ifndef __PS2_STANDARD_MOUSE_H #define __PS2_STANDARD_MOUSE_H + #include <Drivers.h> #include "packet_buffer.h" + #define MOUSE_HISTORY_SIZE 256 // we record that many mouse packets before we start to drop them #define F_MOUSE_TYPE_STANDARD 0x1 #define F_MOUSE_TYPE_INTELLIMOUSE 0x2 -typedef struct -{ - ps2_dev * dev; +typedef struct { + ps2_dev* dev; sem_id standard_mouse_sem; - packet_buffer * standard_mouse_buffer; + packet_buffer* standard_mouse_buffer; bigtime_t click_last_time; bigtime_t click_speed; int click_count; @@ -38,23 +38,29 @@ int flags; size_t packet_index; uint8 packet_buffer[PS2_MAX_PACKET_SIZE]; - } standard_mouse_cookie; -status_t probe_standard_mouse(ps2_dev *dev); +#ifdef __cplusplus +extern "C" { +#endif -status_t standard_mouse_open(const char *name, uint32 flags, void **_cookie); -status_t standard_mouse_close(void *_cookie); -status_t standard_mouse_freecookie(void *_cookie); -status_t standard_mouse_ioctl(void *_cookie, uint32 op, void *buffer, +status_t probe_standard_mouse(ps2_dev* dev); + +status_t standard_mouse_open(const char* name, uint32 flags, void** _cookie); +status_t standard_mouse_close(void* _cookie); +status_t standard_mouse_freecookie(void* _cookie); +status_t standard_mouse_ioctl(void* _cookie, uint32 op, void* buffer, size_t length); -int32 standard_mouse_handle_int(ps2_dev *dev); -void standard_mouse_disconnect(ps2_dev *dev); +int32 standard_mouse_handle_int(ps2_dev* dev); +void standard_mouse_disconnect(ps2_dev* dev); device_hooks gStandardMouseDeviceHooks; +#ifdef __cplusplus +} +#endif -#endif /* __PS2_STANDARD_MOUSE_H */ +#endif /* __PS2_STANDARD_MOUSE_H */ Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2010-04-14 19:16:30 UTC (rev 36266) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2010-04-14 19:19:14 UTC (rev 36267) @@ -1,5 +1,5 @@ /* - * Copyright 2008-2009, Haiku, Inc. + * Copyright 2008-2010, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors (in chronological order): @@ -17,8 +17,9 @@ #include <string.h> #include <stdlib.h> +#include <keyboard_mouse_driver.h> + #include "ps2_service.h" -#include "kb_mouse_driver.h" const char* kSynapticsPath[4] = { Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h 2010-04-14 19:16:30 UTC (rev 36266) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h 2010-04-14 19:19:14 UTC (rev 36267) @@ -1,8 +1,8 @@ /* - * Copyright 2008-2009, Haiku, Inc. + * Copyright 2008-2010, Haiku, Inc. * Distributed under the terms of the MIT License. * - * Authors (in chronological order): + * Authors: * Clemens Zeidler (haiku@xxxxxxxxxxxxxxxxxx) */ #ifndef PS2_SYNAPTICS_H @@ -11,11 +11,12 @@ #include <KernelExport.h> -#include "kb_mouse_driver.h" +#include <keyboard_mouse_driver.h> +#include <touchpad_settings.h> + #include "movement_maker.h" #include "packet_buffer.h" #include "ps2_service.h" -#include "touchpad_settings.h" #define SYN_TOUCHPAD 0x47 Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.c 2010-04-14 19:16:30 UTC (rev 36266) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.c 2010-04-14 19:19:14 UTC (rev 36267) @@ -1,9 +1,20 @@ +/* + * Copyright 2009-2010, Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Clemens Zeidler (haiku@xxxxxxxxxxxxxxxxxx) + */ + + #include <malloc.h> #include <string.h> [... truncated: 241 lines follow ...]