Revert r41129 to get history back.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41133 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler 2011-03-28 08:10:26 +00:00
parent 2d93b5283f
commit 79bdca0650
15 changed files with 191 additions and 166 deletions

View File

@ -5,14 +5,14 @@ UsePrivateKernelHeaders ;
KernelAddon ps2 :
packet_buffer.cpp
ps2_alps.cpp
ps2_common.cpp
ps2_dev.cpp
ps2_alps.c
ps2_common.c
ps2_dev.c
ps2_keyboard.cpp
ps2_module.cpp
ps2_standard_mouse.cpp
ps2_synaptics.cpp
ps2_trackpoint.cpp
ps2_module.c
ps2_standard_mouse.c
ps2_synaptics.c
ps2_trackpoint.c
ps2_service.cpp
movement_maker.cpp
movement_maker.c
;

View File

@ -30,6 +30,7 @@ typedef struct {
} movement_maker;
void get_raw_movement(movement_maker *move, uint32 posX, uint32 posY);
void compute_acceleration(movement_maker *move, int8 accel_factor);
void get_movement(movement_maker *move, uint32 posX, uint32 posY);

View File

@ -6,16 +6,32 @@
#include "packet_buffer.h"
#include <KernelExport.h>
#include <util/ring_buffer.h>
#include <stdlib.h>
#include <string.h>
packet_buffer*
/** The idea behind this packet buffer is to have multi-threading safe
* implementation that can be used in interrupts on top of the
* ring_buffer implementation provided by the kernel.
* It uses a spinlock for synchronization.
*
* IOW if you don't have such high restrictions in your environment,
* you better don't want to use it at all.
*/
struct packet_buffer {
struct ring_buffer *buffer;
spinlock lock;
};
struct packet_buffer *
create_packet_buffer(size_t size)
{
packet_buffer* buffer
struct packet_buffer *buffer
= (packet_buffer *)malloc(sizeof(packet_buffer));
if (buffer == NULL)
return NULL;
@ -32,7 +48,7 @@ create_packet_buffer(size_t size)
void
delete_packet_buffer(packet_buffer* buffer)
delete_packet_buffer(struct packet_buffer *buffer)
{
delete_ring_buffer(buffer->buffer);
free(buffer);
@ -40,7 +56,7 @@ delete_packet_buffer(packet_buffer* buffer)
void
packet_buffer_clear(packet_buffer* buffer)
packet_buffer_clear(struct packet_buffer *buffer)
{
cpu_status state = disable_interrupts();
acquire_spinlock(&buffer->lock);
@ -53,7 +69,7 @@ packet_buffer_clear(packet_buffer* buffer)
size_t
packet_buffer_readable(packet_buffer* buffer)
packet_buffer_readable(struct packet_buffer *buffer)
{
cpu_status state = disable_interrupts();
acquire_spinlock(&buffer->lock);
@ -68,7 +84,7 @@ packet_buffer_readable(packet_buffer* buffer)
size_t
packet_buffer_writable(packet_buffer* buffer)
packet_buffer_writable(struct packet_buffer *buffer)
{
cpu_status state = disable_interrupts();
acquire_spinlock(&buffer->lock);
@ -83,7 +99,7 @@ packet_buffer_writable(packet_buffer* buffer)
void
packet_buffer_flush(packet_buffer* buffer, size_t length)
packet_buffer_flush(struct packet_buffer *buffer, size_t length)
{
cpu_status state = disable_interrupts();
acquire_spinlock(&buffer->lock);
@ -96,7 +112,7 @@ packet_buffer_flush(packet_buffer* buffer, size_t length)
size_t
packet_buffer_read(packet_buffer* buffer, uint8 *data, size_t length)
packet_buffer_read(struct packet_buffer *buffer, uint8 *data, size_t length)
{
cpu_status state = disable_interrupts();
acquire_spinlock(&buffer->lock);
@ -111,7 +127,7 @@ packet_buffer_read(packet_buffer* buffer, uint8 *data, size_t length)
size_t
packet_buffer_write(packet_buffer* buffer, const uint8 *data,
packet_buffer_write(struct packet_buffer *buffer, const uint8 *data,
size_t length)
{
cpu_status state = disable_interrupts();

View File

@ -6,37 +6,30 @@
#define PACKET_BUFFER_H
#include <KernelExport.h>
#include <OS.h>
struct ring_buffer;
struct packet_buffer;
typedef struct packet_buffer packet_buffer;
#ifdef __cplusplus
extern "C" {
#endif
/** The idea behind this packet buffer is to have multi-threading safe
* implementation that can be used in interrupts on top of the
* ring_buffer implementation provided by the kernel.
* It uses a spinlock for synchronization.
*
* IOW if you don't have such high restrictions in your environment,
* you better don't want to use it at all.
*/
struct packet_buffer {
struct ring_buffer* buffer;
spinlock lock;
};
struct packet_buffer *create_packet_buffer(size_t size);
void delete_packet_buffer(struct packet_buffer *buffer);
struct packet_buffer* create_packet_buffer(size_t size);
void delete_packet_buffer(struct packet_buffer* buffer);
void packet_buffer_clear(struct packet_buffer* buffer);
size_t packet_buffer_readable(struct packet_buffer* buffer);
void packet_buffer_clear(struct packet_buffer *buffer);
size_t packet_buffer_readable(struct packet_buffer *buffer);
size_t packet_buffer_writable(struct packet_buffer *buffer);
void packet_buffer_flush(struct packet_buffer* buffer, size_t bytes);
size_t packet_buffer_read(struct packet_buffer* buffer, uint8* data, size_t
void packet_buffer_flush(struct packet_buffer *buffer, size_t bytes);
size_t packet_buffer_read(struct packet_buffer *buffer, uint8 *data, size_t
length);
size_t packet_buffer_write(struct packet_buffer* buffer, const uint8* data,
size_t packet_buffer_write(struct packet_buffer *buffer, const uint8 *data,
size_t length);
#ifdef __cplusplus
}
#endif
#endif /* PACKET_BUFFER_H */

View File

@ -109,7 +109,7 @@ static alps_model_info* sFoundModel = NULL;
// touchpad proportions
#define SPEED_FACTOR 5
#define SPEED_FACTOR 4.5
#define EDGE_MOTION_WIDTH 10
#define EDGE_MOTION_SPEED (5 * SPEED_FACTOR)
// increase the touchpad size a little bit
@ -255,17 +255,17 @@ move_to_movement(alps_cookie *cookie, touch_event *event,
if (!cookie->movement_started) {
isStartOfMovement = true;
cookie->movement_started = true;
start_new_movment(&cookie->movementMaker);
start_new_movment(&cookie->movement_maker);
}
get_movement(&cookie->movementMaker, event->xPosition, event->yPosition);
get_movement(&cookie->movement_maker, event->xPosition, event->yPosition);
movement->xdelta = cookie->movementMaker.xDelta;
movement->ydelta = cookie->movementMaker.yDelta;
movement->xdelta = cookie->movement_maker.xDelta;
movement->ydelta = cookie->movement_maker.yDelta;
// tap gesture
cookie->tap_delta_x += cookie->movementMaker.xDelta;
cookie->tap_delta_y += cookie->movementMaker.yDelta;
cookie->tap_delta_x += cookie->movement_maker.xDelta;
cookie->tap_delta_y += cookie->movement_maker.yDelta;
if (cookie->tapdrag_started) {
movement->buttons = kLeftButton;
@ -348,12 +348,12 @@ check_scrolling_to_movement(alps_cookie *cookie, touch_event *event,
cookie->valid_edge_motion = false;
if (!cookie->scrolling_started) {
cookie->scrolling_started = true;
start_new_movment(&cookie->movementMaker);
start_new_movment(&cookie->movement_maker);
}
get_scrolling(&cookie->movementMaker, event->xPosition,
get_scrolling(&cookie->movement_maker, event->xPosition,
event->yPosition);
movement->wheel_ydelta = cookie->movementMaker.yDelta;
movement->wheel_xdelta = cookie->movementMaker.xDelta;
movement->wheel_ydelta = cookie->movement_maker.yDelta;
movement->wheel_xdelta = cookie->movement_maker.xDelta;
if (isSideScrollingV && !isSideScrollingH)
movement->wheel_xdelta = 0;
@ -422,11 +422,11 @@ byte 4: 0 y6 y5 y4 y3 y2 y1 y0
byte 5: 0 z6 z5 z4 z3 z2 z1 z0
*/
// debug
static uint32 minX = 50000;
static uint32 minY = 50000;
static uint32 maxX = 0;
static uint32 maxY = 0;
static uint32 maxZ = 0;
static int minX = 50000;
static int minY = 50000;
static int maxX = 0;
static int maxY = 0;
static int maxZ = 0;
// debug end
static status_t
get_alps_movment(alps_cookie *cookie, mouse_movement *movement)
@ -565,7 +565,7 @@ return B_ERROR;
}
dev->name = kALPSPath[dev->idx];
dev->packet_size = PS2_PACKET_ALPS;
dev->packet_size = -1;
return B_OK;
}
@ -609,10 +609,10 @@ alps_open(const char *name, uint32 flags, void **_cookie)
default_settings(&cookie->settings);
cookie->movementMaker.speed = 1 * SPEED_FACTOR;
cookie->movementMaker.scrolling_xStep = cookie->settings.scroll_xstepsize;
cookie->movementMaker.scrolling_yStep = cookie->settings.scroll_ystepsize;
cookie->movementMaker.scroll_acceleration
cookie->movement_maker.speed = 1 * SPEED_FACTOR;
cookie->movement_maker.scrolling_xStep = cookie->settings.scroll_xstepsize;
cookie->movement_maker.scrolling_yStep = cookie->settings.scroll_ystepsize;
cookie->movement_maker.scroll_acceleration
= cookie->settings.scroll_acceleration;
cookie->movement_started = false;
cookie->scrolling_started = false;
@ -681,7 +681,7 @@ status_t
alps_close(void *_cookie)
{
status_t status;
alps_cookie *cookie = (alps_cookie*)_cookie;
alps_cookie *cookie = _cookie;
ps2_dev_command_timeout(cookie->dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0,
150000);
@ -717,7 +717,7 @@ alps_freecookie(void *_cookie)
status_t
alps_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
{
alps_cookie *cookie = (alps_cookie*)_cookie;
alps_cookie *cookie = _cookie;
mouse_movement movement;
status_t status;
@ -735,11 +735,11 @@ alps_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
case MS_SET_TOUCHPAD_SETTINGS:
TRACE("ALPS: MS_SET_TOUCHPAD_SETTINGS");
user_memcpy(&cookie->settings, buffer, sizeof(touchpad_settings));
cookie->movementMaker.scrolling_xStep
cookie->movement_maker.scrolling_xStep
= cookie->settings.scroll_xstepsize;
cookie->movementMaker.scrolling_yStep
cookie->movement_maker.scrolling_yStep
= cookie->settings.scroll_ystepsize;
cookie->movementMaker.scroll_acceleration
cookie->movement_maker.scroll_acceleration
= cookie->settings.scroll_acceleration;
return B_OK;
@ -773,7 +773,7 @@ alps_write(void *cookie, off_t pos, const void *buffer, size_t *_length)
int32
alps_handle_int(ps2_dev *dev)
{
alps_cookie *cookie = (alps_cookie*)dev->cookie;
alps_cookie *cookie = dev->cookie;
uint8 val;
val = cookie->dev->history[0].data;
@ -793,14 +793,14 @@ alps_handle_int(ps2_dev *dev)
return B_UNHANDLED_INTERRUPT;
}
cookie->buffer[cookie->packet_index] = val;
cookie->packet_buffer[cookie->packet_index] = val;
cookie->packet_index++;
if (cookie->packet_index >= 6) {
cookie->packet_index = 0;
if (packet_buffer_write(cookie->ring_buffer,
cookie->buffer, cookie->dev->packet_size)
cookie->packet_buffer, cookie->dev->packet_size)
!= cookie->dev->packet_size) {
// buffer is full, drop new data
return B_HANDLED_INTERRUPT;
@ -817,7 +817,7 @@ alps_handle_int(ps2_dev *dev)
void
alps_disconnect(ps2_dev *dev)
{
alps_cookie *cookie = (alps_cookie*)dev->cookie;
alps_cookie *cookie = dev->cookie;
// the mouse device might not be opened at this point
INFO("ALPS: alps_disconnect %s\n", dev->name);
if ((dev->flags & PS2_FLAG_OPEN) != 0)

View File

@ -14,12 +14,12 @@ typedef struct {
ps2_dev* dev;
sem_id sem;
struct packet_buffer* ring_buffer;
packet_buffer* ring_buffer;
size_t packet_index;
uint8 buffer[PS2_PACKET_ALPS];
uint8 packet_buffer[PS2_PACKET_ALPS];
uint8 mode;
movement_maker movementMaker;
movement_maker movement_maker;
bool movement_started;
bool scrolling_started;
bool tap_started;
@ -50,7 +50,7 @@ status_t alps_ioctl(void *_cookie, uint32 op, void *buffer, size_t length);
int32 alps_handle_int(ps2_dev *dev);
void alps_disconnect(ps2_dev *dev);
extern device_hooks gALPSDeviceHooks;
device_hooks gALPSDeviceHooks;
#endif /* ALPS_H */

View File

@ -23,7 +23,49 @@
#include <string.h>
ps2_dev ps2_device[PS2_DEVICE_COUNT];
ps2_dev ps2_device[PS2_DEVICE_COUNT] = {
{
.name = "input/mouse/ps2/0",
.active = false,
.idx = 0,
.result_sem = -1,
.command = standard_command_timeout
},
{
.name = "input/mouse/ps2/1",
.active = false,
.idx = 1,
.result_sem = -1,
.command = standard_command_timeout
},
{
.name = "input/mouse/ps2/2",
.active = false,
.idx = 2,
.result_sem = -1,
.command = standard_command_timeout
},
{
.name = "input/mouse/ps2/3",
.active = false,
.idx = 3,
.result_sem = -1,
.command = standard_command_timeout
},
{
.name = "input/mouse/ps2/synaptics_passthrough",
.active = false,
.result_sem = -1,
.command = passthrough_command
},
{
.name = "input/keyboard/at/0",
.active = false,
.result_sem = -1,
.flags = PS2_FLAG_KEYB,
.command = standard_command_timeout
}
};
status_t
@ -107,41 +149,6 @@ dev_found:
status_t
ps2_dev_init(void)
{
ps2_device[0].name = "input/mouse/ps2/0";
ps2_device[0].active = false;
ps2_device[0].idx = 0;
ps2_device[0].result_sem = -1;
ps2_device[0].command = standard_command_timeout;
ps2_device[1].name = "input/mouse/ps2/1";
ps2_device[1].active = false;
ps2_device[1].idx = 1;
ps2_device[1].result_sem = -1;
ps2_device[1].command = standard_command_timeout;
ps2_device[2].name = "input/mouse/ps2/2";
ps2_device[2].active = false;
ps2_device[2].idx = 2;
ps2_device[2].result_sem = -1;
ps2_device[2].command = standard_command_timeout;
ps2_device[3].name = "input/mouse/ps2/3";
ps2_device[3].active = false;
ps2_device[3].idx = 3;
ps2_device[3].result_sem = -1;
ps2_device[3].command = standard_command_timeout;
ps2_device[4].name = "input/mouse/ps2/synaptics_passthrough";
ps2_device[4].active = false;
ps2_device[4].result_sem = -1;
ps2_device[4].command = passthrough_command;
ps2_device[5].name = "input/keyboard/at/0";
ps2_device[5].active = false;
ps2_device[5].result_sem = -1;
ps2_device[5].flags = PS2_FLAG_KEYB;
ps2_device[5].command = standard_command_timeout;
int i;
for (i = 0; i < PS2_DEVICE_COUNT; i++) {
ps2_dev *dev = &ps2_device[i];

View File

@ -45,13 +45,13 @@ std_ops(int32 op, ...)
static ps2_module_info ps2_module = {
{
{
B_PS2_MODULE_NAME,
B_KEEP_LOADED,
std_ops
.binfo = {
.minfo = {
.name = B_PS2_MODULE_NAME,
.flags = B_KEEP_LOADED,
.std_ops = std_ops,
},
NULL
.rescan = NULL,
},
&function1,
&function2,

View File

@ -227,7 +227,7 @@ standard_mouse_handle_int(ps2_dev *dev)
}
if (cookie->packet_index == 1) {
int xDelta
= ((cookie->buffer[0] & 0x10) ? 0xFFFFFF00 : 0) | data;
= ((cookie->packet_buffer[0] & 0x10) ? 0xFFFFFF00 : 0) | data;
if (xDelta < -100 || xDelta > 100) {
INFO("ps2: strange mouse data, x-delta %d, trying resync\n",
xDelta);
@ -237,7 +237,7 @@ standard_mouse_handle_int(ps2_dev *dev)
}
if (cookie->packet_index == 2) {
int yDelta
= ((cookie->buffer[0] & 0x20) ? 0xFFFFFF00 : 0) | data;
= ((cookie->packet_buffer[0] & 0x20) ? 0xFFFFFF00 : 0) | data;
if (yDelta < -100 || yDelta > 100) {
INFO("ps2: strange mouse data, y-delta %d, trying resync\n",
yDelta);
@ -246,7 +246,7 @@ standard_mouse_handle_int(ps2_dev *dev)
}
}
cookie->buffer[cookie->packet_index++] = data;
cookie->packet_buffer[cookie->packet_index++] = data;
if (cookie->packet_index != dev->packet_size) {
// packet not yet complete
@ -257,7 +257,7 @@ standard_mouse_handle_int(ps2_dev *dev)
cookie->packet_index = 0;
if (packet_buffer_write(cookie->standard_mouse_buffer,
cookie->buffer, dev->packet_size) != dev->packet_size) {
cookie->packet_buffer, dev->packet_size) != dev->packet_size) {
// buffer is full, drop new data
return B_HANDLED_INTERRUPT;
}
@ -352,7 +352,7 @@ standard_mouse_open(const char *name, uint32 flags, void **_cookie)
if (atomic_or(&dev->flags, PS2_FLAG_OPEN) & PS2_FLAG_OPEN)
return B_BUSY;
cookie = (standard_mouse_cookie*)malloc(sizeof(standard_mouse_cookie));
cookie = malloc(sizeof(standard_mouse_cookie));
if (cookie == NULL)
goto err1;

View File

@ -27,20 +27,24 @@
#define F_MOUSE_TYPE_INTELLIMOUSE 0x2
typedef struct {
ps2_dev* dev;
ps2_dev* dev;
sem_id standard_mouse_sem;
struct packet_buffer* standard_mouse_buffer;
bigtime_t click_last_time;
bigtime_t click_speed;
int click_count;
int buttons_state;
int flags;
size_t packet_index;
uint8 buffer[PS2_MAX_PACKET_SIZE];
sem_id standard_mouse_sem;
packet_buffer* standard_mouse_buffer;
bigtime_t click_last_time;
bigtime_t click_speed;
int click_count;
int buttons_state;
int flags;
size_t packet_index;
uint8 packet_buffer[PS2_MAX_PACKET_SIZE];
} standard_mouse_cookie;
#ifdef __cplusplus
extern "C" {
#endif
status_t probe_standard_mouse(ps2_dev* dev);
status_t standard_mouse_open(const char* name, uint32 flags, void** _cookie);
@ -52,7 +56,11 @@ status_t standard_mouse_ioctl(void* _cookie, uint32 op, void* buffer,
int32 standard_mouse_handle_int(ps2_dev* dev);
void standard_mouse_disconnect(ps2_dev* dev);
extern device_hooks gStandardMouseDeviceHooks;
device_hooks gStandardMouseDeviceHooks;
#ifdef __cplusplus
}
#endif
#endif /* __PS2_STANDARD_MOUSE_H */

View File

@ -186,17 +186,17 @@ move_to_movement(synaptics_cookie *cookie, touch_event *event,
if (!cookie->movement_started) {
isStartOfMovement = true;
cookie->movement_started = true;
start_new_movment(&cookie->movementMaker);
start_new_movment(&cookie->movement_maker);
}
get_movement(&cookie->movementMaker, event->xPosition, event->yPosition);
get_movement(&cookie->movement_maker, event->xPosition, event->yPosition);
movement->xdelta = cookie->movementMaker.xDelta;
movement->ydelta = cookie->movementMaker.yDelta;
movement->xdelta = cookie->movement_maker.xDelta;
movement->ydelta = cookie->movement_maker.yDelta;
// tap gesture
cookie->tap_delta_x += cookie->movementMaker.xDelta;
cookie->tap_delta_y += cookie->movementMaker.yDelta;
cookie->tap_delta_x += cookie->movement_maker.xDelta;
cookie->tap_delta_y += cookie->movement_maker.yDelta;
if (cookie->tapdrag_started) {
movement->buttons = kLeftButton;
@ -279,12 +279,12 @@ check_scrolling_to_movement(synaptics_cookie *cookie, touch_event *event,
cookie->valid_edge_motion = false;
if (!cookie->scrolling_started) {
cookie->scrolling_started = true;
start_new_movment(&cookie->movementMaker);
start_new_movment(&cookie->movement_maker);
}
get_scrolling(&cookie->movementMaker, event->xPosition,
get_scrolling(&cookie->movement_maker, event->xPosition,
event->yPosition);
movement->wheel_ydelta = cookie->movementMaker.yDelta;
movement->wheel_xdelta = cookie->movementMaker.xDelta;
movement->wheel_ydelta = cookie->movement_maker.yDelta;
movement->wheel_xdelta = cookie->movement_maker.xDelta;
if (isSideScrollingV && !isSideScrollingH)
movement->wheel_xdelta = 0;
@ -440,8 +440,7 @@ query_capability(ps2_dev *dev)
status_t
synaptics_pass_through_set_packet_size(ps2_dev *dev, uint8 size)
{
synaptics_cookie *synapticsCookie
= (synaptics_cookie*)dev->parent_dev->cookie;
synaptics_cookie *synapticsCookie = dev->parent_dev->cookie;
status_t status = ps2_dev_command(dev->parent_dev, PS2_CMD_DISABLE, NULL,
0, NULL, 0);
@ -603,10 +602,10 @@ synaptics_open(const char *name, uint32 flags, void **_cookie)
default_settings(&cookie->settings);
cookie->movementMaker.speed = 1;
cookie->movementMaker.scrolling_xStep = cookie->settings.scroll_xstepsize;
cookie->movementMaker.scrolling_yStep = cookie->settings.scroll_ystepsize;
cookie->movementMaker.scroll_acceleration
cookie->movement_maker.speed = 1;
cookie->movement_maker.scrolling_xStep = cookie->settings.scroll_xstepsize;
cookie->movement_maker.scrolling_yStep = cookie->settings.scroll_ystepsize;
cookie->movement_maker.scroll_acceleration
= cookie->settings.scroll_acceleration;
cookie->movement_started = false;
cookie->scrolling_started = false;
@ -681,7 +680,7 @@ status_t
synaptics_close(void *_cookie)
{
status_t status;
synaptics_cookie *cookie = (synaptics_cookie*)_cookie;
synaptics_cookie *cookie = _cookie;
ps2_dev_command_timeout(cookie->dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0,
150000);
@ -736,7 +735,7 @@ synaptics_write(void *cookie, off_t pos, const void *buffer, size_t *_length)
status_t
synaptics_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
{
synaptics_cookie *cookie = (synaptics_cookie*)_cookie;
synaptics_cookie *cookie = _cookie;
mouse_movement movement;
status_t status;
@ -754,11 +753,11 @@ synaptics_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
case MS_SET_TOUCHPAD_SETTINGS:
TRACE("SYNAPTICS: MS_SET_TOUCHPAD_SETTINGS");
user_memcpy(&cookie->settings, buffer, sizeof(touchpad_settings));
cookie->movementMaker.scrolling_xStep
cookie->movement_maker.scrolling_xStep
= cookie->settings.scroll_xstepsize;
cookie->movementMaker.scrolling_yStep
cookie->movement_maker.scrolling_yStep
= cookie->settings.scroll_ystepsize;
cookie->movementMaker.scroll_acceleration
cookie->movement_maker.scroll_acceleration
= cookie->settings.scroll_acceleration;
return B_OK;
@ -776,7 +775,7 @@ synaptics_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
int32
synaptics_handle_int(ps2_dev *dev)
{
synaptics_cookie *cookie = (synaptics_cookie*)dev->cookie;
synaptics_cookie *cookie = dev->cookie;
uint8 val;
val = cookie->dev->history[0].data;
@ -796,7 +795,7 @@ synaptics_handle_int(ps2_dev *dev)
cookie->packet_index = 0;
return B_UNHANDLED_INTERRUPT;
}
cookie->buffer[cookie->packet_index] = val;
cookie->packet_buffer[cookie->packet_index] = val;
cookie->packet_index++;
if (cookie->packet_index >= 6) {
@ -806,25 +805,25 @@ synaptics_handle_int(ps2_dev *dev)
// too the pass through interrupt handle
if (sPassthroughDevice->active
&& sPassthroughDevice->handle_int != NULL
&& IS_SYN_PT_PACKAGE(cookie->buffer)) {
&& IS_SYN_PT_PACKAGE(cookie->packet_buffer)) {
status_t status;
sPassthroughDevice->history[0].data = cookie->buffer[1];
sPassthroughDevice->history[0].data = cookie->packet_buffer[1];
sPassthroughDevice->handle_int(sPassthroughDevice);
sPassthroughDevice->history[0].data = cookie->buffer[4];
sPassthroughDevice->history[0].data = cookie->packet_buffer[4];
sPassthroughDevice->handle_int(sPassthroughDevice);
sPassthroughDevice->history[0].data = cookie->buffer[5];
sPassthroughDevice->history[0].data = cookie->packet_buffer[5];
status = sPassthroughDevice->handle_int(sPassthroughDevice);
if (cookie->dev->packet_size == 4) {
sPassthroughDevice->history[0].data = cookie->buffer[2];
sPassthroughDevice->history[0].data = cookie->packet_buffer[2];
status = sPassthroughDevice->handle_int(sPassthroughDevice);
}
return status;
}
if (packet_buffer_write(cookie->synaptics_ring_buffer,
cookie->buffer, cookie->dev->packet_size)
cookie->packet_buffer, cookie->dev->packet_size)
!= cookie->dev->packet_size) {
// buffer is full, drop new data
return B_HANDLED_INTERRUPT;
@ -841,7 +840,7 @@ synaptics_handle_int(ps2_dev *dev)
void
synaptics_disconnect(ps2_dev *dev)
{
synaptics_cookie *cookie = (synaptics_cookie*)dev->cookie;
synaptics_cookie *cookie = dev->cookie;
// the mouse device might not be opened at this point
INFO("SYNAPTICS: synaptics_disconnect %s\n", dev->name);
if ((dev->flags & PS2_FLAG_OPEN) != 0)

View File

@ -94,12 +94,12 @@ typedef struct {
ps2_dev* dev;
sem_id synaptics_sem;
struct packet_buffer* synaptics_ring_buffer;
packet_buffer* synaptics_ring_buffer;
size_t packet_index;
uint8 buffer[PS2_PACKET_SYNAPTICS];
uint8 packet_buffer[PS2_PACKET_SYNAPTICS];
uint8 mode;
movement_maker movementMaker;
movement_maker movement_maker;
bool movement_started;
bool scrolling_started;
bool tap_started;
@ -120,6 +120,7 @@ struct packet_buffer* synaptics_ring_buffer;
} synaptics_cookie;
status_t synaptics_pass_through_set_packet_size(ps2_dev *dev, uint8 size);
status_t passthrough_command(ps2_dev *dev, uint8 cmd, const uint8 *out,
int out_count, uint8 *in, int in_count, bigtime_t timeout);
@ -133,6 +134,6 @@ status_t synaptics_ioctl(void *_cookie, uint32 op, void *buffer, size_t length);
int32 synaptics_handle_int(ps2_dev *dev);
void synaptics_disconnect(ps2_dev *dev);
extern device_hooks gSynapticsDeviceHooks;
device_hooks gSynapticsDeviceHooks;
#endif // PS2_SYNAPTICS_H