* 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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36267 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
19049c8bd3
commit
2c49465329
@ -1,18 +1,15 @@
|
||||
//
|
||||
// kb_mouse_driver.h
|
||||
//
|
||||
#ifndef _KB_MOUSE_DRIVER_H
|
||||
#define _KB_MOUSE_DRIVER_H
|
||||
/*
|
||||
* 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>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define KEY_Scroll 0x0f
|
||||
#define KEY_Pause 0x10
|
||||
#define KEY_Num 0x22
|
||||
@ -75,60 +72,55 @@ enum {
|
||||
|
||||
|
||||
typedef struct {
|
||||
bigtime_t timestamp;
|
||||
uint32 be_keycode;
|
||||
bool is_keydown;
|
||||
bigtime_t timestamp;
|
||||
uint32 keycode;
|
||||
bool is_keydown;
|
||||
} raw_key_info;
|
||||
|
||||
|
||||
typedef struct {
|
||||
bigtime_t timestamp;
|
||||
uint8 scancode;
|
||||
bool is_keydown;
|
||||
} at_kbd_io;
|
||||
|
||||
|
||||
typedef struct {
|
||||
bool num_lock;
|
||||
bool caps_lock;
|
||||
bool scroll_lock;
|
||||
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;
|
||||
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;
|
||||
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
|
||||
{
|
||||
|
||||
typedef struct {
|
||||
uint8 buttons;
|
||||
uint32 xPosition;
|
||||
uint32 yPosition;
|
||||
@ -141,9 +133,5 @@ typedef struct
|
||||
// 12 maximum reportable width; extrem wide contact
|
||||
} touchpad_movement;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _KB_MOUSE_DRIVER_H
|
@ -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 @@ KeyboardDevice::KeyboardDevice(KeyboardInputDevice* owner, const char* path)
|
||||
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 @@ KeyboardDevice::_ControlThread()
|
||||
|
||||
_UpdateSettings(0);
|
||||
|
||||
uint8 buffer[16];
|
||||
raw_key_info keyInfo;
|
||||
uint8 activeDeadKey = 0;
|
||||
uint32 lastKeyCode = 0;
|
||||
uint32 repeatCount = 1;
|
||||
@ -284,7 +281,7 @@ KeyboardDevice::_ControlThread()
|
||||
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 @@ KeyboardDevice::_ControlThread()
|
||||
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 :");
|
||||
|
||||
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;
|
||||
}
|
||||
LOG_EVENT("KB_READ: %Ld, %02x, %02lx\n", keyInfo.timestamp, isKeyDown,
|
||||
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 @@ KeyboardDevice::_ControlThread()
|
||||
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 @@ KeyboardDevice::_ControlThread()
|
||||
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);
|
||||
|
@ -1,6 +1,8 @@
|
||||
/*
|
||||
* Copyright 2004-2008, Jérôme Duval. All rights reserved.
|
||||
* Copyright 2005-2010, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2008, Stephan Aßmus, superstippi@gmx.de.
|
||||
*
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef KEYBOARD_INPUT_DEVICE_H
|
||||
@ -55,7 +57,6 @@ private:
|
||||
thread_id fThread;
|
||||
kb_settings fSettings;
|
||||
volatile bool fActive;
|
||||
bool fIsAT;
|
||||
volatile bool fInputMethodStarted;
|
||||
uint32 fModifiers;
|
||||
uint32 fCommandKey;
|
||||
|
@ -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
|
||||
|
@ -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 @@ keyboard_handle_int(ps2_dev *dev)
|
||||
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 @@ keyboard_handle_int(ps2_dev *dev)
|
||||
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 @@ keyboard_handle_int(ps2_dev *dev)
|
||||
}
|
||||
|
||||
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 @@ keyboard_handle_int(ps2_dev *dev)
|
||||
|
||||
|
||||
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 @@ keyboard_open(const char *name, uint32 flags, void **_cookie)
|
||||
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 @@ keyboard_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
|
||||
} 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));
|
||||
|
@ -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@eldarshany.com)
|
||||
* Stefano Ceccherini (burton666@libero.it)
|
||||
@ -12,51 +10,54 @@
|
||||
* Clemens Zeidler <czeidler@gmx.de>
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 @@ const char* kIntelliMousePath[4] = {
|
||||
"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 @@ ps2_set_sample_rate(ps2_dev *dev, uint8 rate)
|
||||
}
|
||||
|
||||
|
||||
/** 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 @@ ps2_packet_to_movement(standard_mouse_cookie *cookie, uint8 packet[],
|
||||
}
|
||||
|
||||
|
||||
/** 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 @@ standard_mouse_read_event(standard_mouse_cookie *cookie,
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
void
|
||||
standard_mouse_disconnect(ps2_dev *dev)
|
||||
{
|
||||
@ -191,12 +196,12 @@ standard_mouse_disconnect(ps2_dev *dev)
|
||||
}
|
||||
|
||||
|
||||
/** 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)
|
||||
{
|
||||
|
@ -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@overhagen.de>
|
||||
* Clemens Zeidler <czeidler@gmx.de>
|
||||
*/
|
||||
|
||||
#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 @@ typedef struct
|
||||
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 */
|
||||
|
@ -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] = {
|
||||
|
@ -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@Clemens-Zeidler.de)
|
||||
*/
|
||||
#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
|
||||
|
@ -1,9 +1,20 @@
|
||||
/*
|
||||
* Copyright 2009-2010, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Clemens Zeidler (haiku@Clemens-Zeidler.de)
|
||||
*/
|
||||
|
||||
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "kb_mouse_driver.h"
|
||||
#include <keyboard_mouse_driver.h>
|
||||
|
||||
#include "ps2_trackpoint.h"
|
||||
|
||||
|
||||
const char* kTrackpointPath[4] = {
|
||||
"input/mouse/ps2/ibm_trackpoint_0",
|
||||
"input/mouse/ps2/ibm_trackpoint_1",
|
||||
|
@ -3,6 +3,7 @@
|
||||
* Distributed under the terms of the MIT license.
|
||||
*/
|
||||
|
||||
|
||||
#include <new>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -18,14 +19,14 @@
|
||||
#include "HIDReport.h"
|
||||
#include "HIDReportItem.h"
|
||||
|
||||
// input server private for raw_key_info, KB_READ, etc...
|
||||
#include "kb_mouse_driver.h"
|
||||
#include <keyboard_mouse_driver.h>
|
||||
|
||||
|
||||
#define LEFT_ALT_KEY 0x04
|
||||
#define RIGHT_ALT_KEY 0x40
|
||||
#define ALT_KEYS (LEFT_ALT_KEY | RIGHT_ALT_KEY)
|
||||
|
||||
|
||||
static usb_id sDebugKeyboardPipe = 0;
|
||||
static size_t sDebugKeyboardReportSize = 0;
|
||||
static int32 sDebuggerCommandAdded = 0;
|
||||
@ -296,7 +297,7 @@ void
|
||||
KeyboardDevice::_WriteKey(uint32 key, bool down)
|
||||
{
|
||||
raw_key_info info;
|
||||
info.be_keycode = key;
|
||||
info.keycode = key;
|
||||
info.is_keydown = down;
|
||||
info.timestamp = system_time();
|
||||
RingBufferWrite(&info, sizeof(raw_key_info));
|
||||
|
@ -1,8 +1,11 @@
|
||||
/*
|
||||
Driver for USB Human Interface Devices.
|
||||
Copyright (C) 2008-2009 Michael Lotz <mmlr@mlotz.ch>
|
||||
Distributed under the terms of the MIT license.
|
||||
*/
|
||||
* Copyright 2008-2009 Michael Lotz <mmlr@mlotz.ch>
|
||||
* Distributed under the terms of the MIT license.
|
||||
*/
|
||||
|
||||
|
||||
//! Driver for USB Human Interface Devices.
|
||||
|
||||
|
||||
#include "Driver.h"
|
||||
#include "MouseDevice.h"
|
||||
@ -15,8 +18,7 @@
|
||||
#include <string.h>
|
||||
#include <usb/USB_hid.h>
|
||||
|
||||
// input server private for mouse_movement, MS_READ, etc...
|
||||
#include "kb_mouse_driver.h"
|
||||
#include <keyboard_mouse_driver.h>
|
||||
|
||||
|
||||
MouseDevice::MouseDevice(HIDReport *report, HIDReportItem *xAxis,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2009, Haiku, Inc.
|
||||
* Copyright 2008-2010, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -14,7 +14,7 @@
|
||||
#include <File.h>
|
||||
#include <String.h>
|
||||
|
||||
#include "kb_mouse_driver.h"
|
||||
#include <keyboard_mouse_driver.h>
|
||||
|
||||
|
||||
TouchpadPref::TouchpadPref()
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2009, Haiku, Inc.
|
||||
* Copyright 2008-2010, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -27,7 +27,7 @@
|
||||
#include <SpaceLayoutItem.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include "kb_mouse_driver.h"
|
||||
#include <keyboard_mouse_driver.h>
|
||||
|
||||
|
||||
const uint32 SCROLL_X_DRAG = 'sxdr';
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2002-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
#include "InputServer.h"
|
||||
#include "InputServerTypes.h"
|
||||
#include "BottomlineWindow.h"
|
||||
#include "kb_mouse_driver.h"
|
||||
#include "MethodReplicant.h"
|
||||
|
||||
#include <safemode_defs.h>
|
||||
|
@ -20,9 +20,8 @@
|
||||
#include <InterfaceDefs.h>
|
||||
#include <OS.h>
|
||||
|
||||
#include <kb_mouse_driver.h>
|
||||
#include <keyboard_mouse_driver.h>
|
||||
|
||||
#include "ATKeymap.h"
|
||||
#include "SystemKeymap.h"
|
||||
#include "Keymap.h"
|
||||
|
||||
@ -30,7 +29,6 @@
|
||||
struct console {
|
||||
int console_fd;
|
||||
int keyboard_fd;
|
||||
bool is_at;
|
||||
|
||||
int tty_master_fd;
|
||||
int tty_slave_fd;
|
||||
@ -89,26 +87,12 @@ keyboard_reader(void* arg)
|
||||
keymap.LoadCurrent();
|
||||
|
||||
for (;;) {
|
||||
char buffer[16];
|
||||
if (ioctl(con->keyboard_fd, KB_READ, &buffer) != 0)
|
||||
raw_key_info rawKeyInfo;
|
||||
if (ioctl(con->keyboard_fd, KB_READ, &rawKeyInfo) != 0)
|
||||
break;
|
||||
|
||||
uint32 keycode = 0;
|
||||
bool isKeyDown = false;
|
||||
bigtime_t timestamp = 0;
|
||||
|
||||
if (con->is_at) {
|
||||
at_kbd_io* atKeyboard = (at_kbd_io*)buffer;
|
||||
if (atKeyboard->scancode > 0)
|
||||
keycode = kATKeycodeMap[atKeyboard->scancode - 1];
|
||||
isKeyDown = atKeyboard->is_keydown;
|
||||
timestamp = atKeyboard->timestamp;
|
||||
} else {
|
||||
raw_key_info* rawKeyInfo= (raw_key_info*)buffer;
|
||||
isKeyDown = rawKeyInfo->is_keydown;
|
||||
timestamp = rawKeyInfo->timestamp;
|
||||
keycode = rawKeyInfo->be_keycode;
|
||||
}
|
||||
uint32 keycode = rawKeyInfo.keycode;
|
||||
bool isKeyDown = rawKeyInfo.is_keydown;
|
||||
|
||||
if (keycode == 0)
|
||||
continue;
|
||||
@ -197,11 +181,9 @@ console_writer(void* arg)
|
||||
|
||||
/*! Opens the first keyboard driver it finds starting from the given
|
||||
location \a start that supports the debugger extension.
|
||||
\a isAT determines whether this is an AT keyboard (that returns
|
||||
different keycodes) or not.
|
||||
*/
|
||||
static int
|
||||
open_keyboard(const char* start, bool& isAT)
|
||||
open_keyboard(const char* start)
|
||||
{
|
||||
DIR* dir = opendir(start);
|
||||
if (dir == NULL)
|
||||
@ -226,16 +208,15 @@ open_keyboard(const char* start, bool& isAT)
|
||||
continue;
|
||||
|
||||
if (S_ISDIR(stat.st_mode))
|
||||
return open_keyboard(path, isAT);
|
||||
return open_keyboard(path);
|
||||
|
||||
// Try to open it as a device
|
||||
fd = open(path, O_RDONLY);
|
||||
if (fd >= 0) {
|
||||
// Turn on debugger mode
|
||||
if (ioctl(fd, KB_SET_DEBUG_READER, NULL, 0) == 0) {
|
||||
isAT = strstr(path, "keyboard/at") != NULL;
|
||||
if (ioctl(fd, KB_SET_DEBUG_READER, NULL, 0) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
@ -261,7 +242,7 @@ start_console(struct console* con)
|
||||
if (con->console_fd < 0)
|
||||
return -2;
|
||||
|
||||
con->keyboard_fd = open_keyboard("/dev/input/keyboard", con->is_at);
|
||||
con->keyboard_fd = open_keyboard("/dev/input/keyboard");
|
||||
if (con->keyboard_fd < 0)
|
||||
return -3;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user