PS/2 bus manager: style fixes only

This commit is contained in:
John Scipione
2014-07-07 17:38:55 -04:00
parent 7a28891db4
commit 819b454750
4 changed files with 110 additions and 101 deletions
+30 -23
View File
@@ -1,15 +1,15 @@
/* /*
* Copyright 2005-2007 Haiku, Inc. * Copyright 2005-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* PS/2 bus manager
*
* Authors (in chronological order): * Authors (in chronological order):
* Marcus Overhagen ([email protected]) * Marcus Overhagen ([email protected])
* Clemens Zeidler ([email protected]) * Clemens Zeidler ([email protected])
*/ */
/*! PS/2 bus manager */
#include "ps2_dev.h" #include "ps2_dev.h"
#include "ps2_service.h" #include "ps2_service.h"
@@ -28,7 +28,7 @@ ps2_dev ps2_device[PS2_DEVICE_COUNT];
status_t status_t
ps2_reset_mouse(ps2_dev *dev) ps2_reset_mouse(ps2_dev* dev)
{ {
uint8 data[2]; uint8 data[2];
status_t status; status_t status;
@@ -40,8 +40,8 @@ ps2_reset_mouse(ps2_dev *dev)
if (status == B_OK && data[0] == 0xFE && data[1] == 0xAA) { if (status == B_OK && data[0] == 0xFE && data[1] == 0xAA) {
// workaround for HP/Compaq KBCs timeout condition. #2867 #3594 #4315 // workaround for HP/Compaq KBCs timeout condition. #2867 #3594 #4315
TRACE("ps2: KBC has timed out the mouse reset request. " TRACE("ps2: KBC has timed out the mouse reset request. "
"Response was: 0x%02x 0x%02x. Requesting the answer data.\n", "Response was: 0x%02x 0x%02x. Requesting the answer data.\n",
data[0], data[1]); data[0], data[1]);
status = ps2_dev_command(dev, PS2_CMD_RESEND, NULL, 0, data, 2); status = ps2_dev_command(dev, PS2_CMD_RESEND, NULL, 0, data, 2);
} }
@@ -60,7 +60,7 @@ ps2_reset_mouse(ps2_dev *dev)
status_t status_t
ps2_dev_detect_pointing(ps2_dev *dev, device_hooks **hooks) ps2_dev_detect_pointing(ps2_dev* dev, device_hooks** hooks)
{ {
status_t status = ps2_reset_mouse(dev); status_t status = ps2_reset_mouse(dev);
if (status != B_OK) { if (status != B_OK) {
@@ -161,14 +161,16 @@ ps2_dev_init(void)
int i; int i;
for (i = 0; i < PS2_DEVICE_COUNT; i++) { for (i = 0; i < PS2_DEVICE_COUNT; i++) {
ps2_dev *dev = &ps2_device[i]; ps2_dev* dev = &ps2_device[i];
dev->result_sem = create_sem(0, "ps2 result"); dev->result_sem = create_sem(0, "ps2 result");
if (dev->result_sem < 0) if (dev->result_sem < 0)
goto err; goto err;
} }
return B_OK; return B_OK;
err: err:
ps2_dev_exit(); ps2_dev_exit();
return B_ERROR; return B_ERROR;
} }
@@ -176,9 +178,8 @@ err:
void void
ps2_dev_exit(void) ps2_dev_exit(void)
{ {
int i; for (int i = 0; i < PS2_DEVICE_COUNT; i++) {
for (i = 0; i < PS2_DEVICE_COUNT; i++) { ps2_dev* dev = &ps2_device[i];
ps2_dev *dev = &ps2_device[i];
if (dev->result_sem >= 0) { if (dev->result_sem >= 0) {
delete_sem(dev->result_sem); delete_sem(dev->result_sem);
dev->result_sem = -1; dev->result_sem = -1;
@@ -188,7 +189,7 @@ ps2_dev_exit(void)
void void
ps2_dev_publish(ps2_dev *dev) ps2_dev_publish(ps2_dev* dev)
{ {
status_t status = B_OK; status_t status = B_OK;
TRACE("ps2: ps2_dev_publish %s\n", dev->name); TRACE("ps2: ps2_dev_publish %s\n", dev->name);
@@ -218,7 +219,7 @@ ps2_dev_publish(ps2_dev *dev)
} }
if (status == B_OK) { if (status == B_OK) {
device_hooks *hooks; device_hooks* hooks;
status = ps2_dev_detect_pointing(dev, &hooks); status = ps2_dev_detect_pointing(dev, &hooks);
if (status == B_OK) { if (status == B_OK) {
status = devfs_publish_device(dev->name, hooks); status = devfs_publish_device(dev->name, hooks);
@@ -234,7 +235,7 @@ ps2_dev_publish(ps2_dev *dev)
void void
ps2_dev_unpublish(ps2_dev *dev) ps2_dev_unpublish(ps2_dev* dev)
{ {
status_t status; status_t status;
TRACE("ps2: ps2_dev_unpublish %s\n", dev->name); TRACE("ps2: ps2_dev_unpublish %s\n", dev->name);
@@ -255,7 +256,7 @@ ps2_dev_unpublish(ps2_dev *dev)
int32 int32
ps2_dev_handle_int(ps2_dev *dev) ps2_dev_handle_int(ps2_dev* dev)
{ {
const uint8 data = dev->history[0].data; const uint8 data = dev->history[0].data;
uint32 flags; uint32 flags;
@@ -365,8 +366,8 @@ pass_to_handler:
status_t status_t
standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, standard_command_timeout(ps2_dev* dev, uint8 cmd, const uint8* out,
int out_count, uint8 *in, int in_count, bigtime_t timeout) int out_count, uint8* in, int in_count, bigtime_t timeout)
{ {
status_t res; status_t res;
bigtime_t start; bigtime_t start;
@@ -484,8 +485,8 @@ standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out,
status_t status_t
ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, ps2_dev_command(ps2_dev* dev, uint8 cmd, const uint8* out, int out_count,
uint8 *in, int in_count) uint8* in, int in_count)
{ {
return ps2_dev_command_timeout(dev, cmd, out, out_count, in, in_count, return ps2_dev_command_timeout(dev, cmd, out, out_count, in, in_count,
4000000); 4000000);
@@ -493,29 +494,35 @@ ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count,
status_t status_t
ps2_dev_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, ps2_dev_command_timeout(ps2_dev* dev, uint8 cmd, const uint8* out,
int out_count, uint8 *in, int in_count, bigtime_t timeout) int out_count, uint8* in, int in_count, bigtime_t timeout)
{ {
return dev->command(dev, cmd, out, out_count, in, in_count, timeout); return dev->command(dev, cmd, out, out_count, in, in_count, timeout);
} }
status_t status_t
ps2_dev_sliced_command(ps2_dev *dev, uint8 cmd) ps2_dev_sliced_command(ps2_dev* dev, uint8 cmd)
{ {
uint8 val;
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11) != B_OK) if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11) != B_OK)
return B_ERROR; return B_ERROR;
uint8 val = (cmd >> 6) & 3;
val = (cmd >> 6) & 3;
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK) if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
return B_ERROR; return B_ERROR;
val = (cmd >> 4) & 3; val = (cmd >> 4) & 3;
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK) if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
return B_ERROR; return B_ERROR;
val = (cmd >> 2) & 3; val = (cmd >> 2) & 3;
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK) if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
return B_ERROR; return B_ERROR;
val = cmd & 3; val = cmd & 3;
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK) if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
return B_ERROR; return B_ERROR;
return B_OK; return B_OK;
} }
+10 -12
View File
@@ -1,11 +1,10 @@
/* /*
* Copyright 2005-2010 Haiku, Inc. * Copyright 2005-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* PS/2 bus manager
*
* Authors (in chronological order): * Authors (in chronological order):
* Marcus Overhagen ([email protected]) * Marcus Overhagen ([email protected])
* Clemens Zeidler ([email protected])
*/ */
#ifndef __PS2_DEV_H #ifndef __PS2_DEV_H
#define __PS2_DEV_H #define __PS2_DEV_H
@@ -24,24 +23,24 @@ typedef struct {
} data_history; } data_history;
struct ps2_dev { struct ps2_dev {
const char * name; const char* name;
bool active; bool active;
uint8 idx; uint8 idx;
sem_id result_sem; sem_id result_sem;
int32 flags; int32 flags;
uint8 * result_buf; uint8* result_buf;
int result_buf_idx; int result_buf_idx;
int result_buf_cnt; int result_buf_cnt;
void * cookie; void* cookie;
data_history history[2]; data_history history[2];
ps2_dev * parent_dev; ps2_dev* parent_dev;
size_t packet_size; size_t packet_size;
// functions // functions
void (*disconnect)(ps2_dev *); void (*disconnect)(ps2_dev *);
int32 (*handle_int)(ps2_dev *); int32 (*handle_int)(ps2_dev *);
status_t (*command)(ps2_dev *dev, uint8 cmd, const uint8 *out, status_t (*command)(ps2_dev *dev, uint8 cmd, const uint8 *out,
int out_count, uint8 *in, int in_count, bigtime_t timeout); int out_count, uint8 *in, int in_count, bigtime_t timeout);
}; };
#define PS2_DEVICE_COUNT 6 #define PS2_DEVICE_COUNT 6
@@ -82,7 +81,6 @@ status_t ps2_dev_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out,
int out_count, uint8 *in, int in_count, bigtime_t timeout); int out_count, uint8 *in, int in_count, bigtime_t timeout);
status_t ps2_dev_sliced_command(ps2_dev *dev, uint8 cmd); status_t ps2_dev_sliced_command(ps2_dev *dev, uint8 cmd);
status_t ps2_reset_mouse(ps2_dev *dev); status_t ps2_reset_mouse(ps2_dev *dev);
void ps2_dev_publish(ps2_dev *dev); void ps2_dev_publish(ps2_dev *dev);
@@ -1,13 +1,14 @@
/* /*
* Copyright 2001-2010 Haiku, Inc. * Copyright 2001-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors (in chronological order): * Authors (in chronological order):
* Elad Lahav ([email protected]) * Elad Lahav, [email protected]
* Stefano Ceccherini ([email protected]) * Stefano Ceccherini, [email protected]
* Axel Dörfler, [email protected] * Axel Dörfler, [email protected]
* Marcus Overhagen <[email protected]> * Marcus Overhagen, [email protected]
* Clemens Zeidler <[email protected]> * Clemens Zeidler, [email protected]
* John Scipione, [email protected]
*/ */
@@ -69,6 +70,7 @@ const char* kStandardMousePath[4] = {
"input/mouse/ps2/standard_2", "input/mouse/ps2/standard_2",
"input/mouse/ps2/standard_3" "input/mouse/ps2/standard_3"
}; };
const char* kIntelliMousePath[4] = { const char* kIntelliMousePath[4] = {
"input/mouse/ps2/intelli_0", "input/mouse/ps2/intelli_0",
"input/mouse/ps2/intelli_1", "input/mouse/ps2/intelli_1",
@@ -77,20 +79,18 @@ const char* kIntelliMousePath[4] = {
}; };
/*! Set sampling rate of the ps2 port. //! Set sampling rate of the ps2 port.
*/
static inline status_t static inline status_t
ps2_set_sample_rate(ps2_dev *dev, uint8 rate) ps2_set_sample_rate(ps2_dev* dev, uint8 rate)
{ {
return ps2_dev_command(dev, PS2_CMD_SET_SAMPLE_RATE, &rate, 1, NULL, 0); return ps2_dev_command(dev, PS2_CMD_SET_SAMPLE_RATE, &rate, 1, NULL, 0);
} }
/*! Converts a packet received by the mouse to a "movement". //! Converts a packet received by the mouse to a "movement".
*/
static void static void
ps2_packet_to_movement(standard_mouse_cookie *cookie, uint8 packet[], ps2_packet_to_movement(standard_mouse_cookie* cookie, uint8 packet[],
mouse_movement *pos) mouse_movement* pos)
{ {
int buttons = packet[0] & 7; int buttons = packet[0] & 7;
int xDelta = ((packet[0] & 0x10) ? ~0xff : 0) | packet[1]; int xDelta = ((packet[0] & 0x10) ? ~0xff : 0) | packet[1];
@@ -115,7 +115,7 @@ ps2_packet_to_movement(standard_mouse_cookie *cookie, uint8 packet[],
if (packet[3] & 0x08) if (packet[3] & 0x08)
yDeltaWheel |= ~0x07; yDeltaWheel |= ~0x07;
} }
/* #if 0
if (cookie->flags & F_MOUSE_TYPE_2WHEELS) { if (cookie->flags & F_MOUSE_TYPE_2WHEELS) {
switch (packet[3] & 0x0F) { switch (packet[3] & 0x0F) {
case 0x01: yDeltaWheel = +1; break; // wheel 1 down case 0x01: yDeltaWheel = +1; break; // wheel 1 down
@@ -124,14 +124,16 @@ ps2_packet_to_movement(standard_mouse_cookie *cookie, uint8 packet[],
case 0x0E: xDeltaWheel = -1; break; // wheel 2 up case 0x0E: xDeltaWheel = -1; break; // wheel 2 up
} }
} }
*/ #endif
// TRACE("packet: %02x %02x %02x %02x: xd %d, yd %d, 0x%x (%d), w-xd %d, " #if 0
// "w-yd %d\n", packet[0], packet[1], packet[2], packet[3], TRACE("packet: %02x %02x %02x %02x: xd %d, yd %d, 0x%x (%d), w-xd %d, "
// xDelta, yDelta, buttons, cookie->click_count, xDeltaWheel, "w-yd %d\n", packet[0], packet[1], packet[2], packet[3],
// yDeltaWheel); xDelta, yDelta, buttons, cookie->click_count, xDeltaWheel,
yDeltaWheel);
#endif
if (pos) { if (pos != NULL) {
pos->xdelta = xDelta; pos->xdelta = xDelta;
pos->ydelta = yDelta; pos->ydelta = yDelta;
pos->buttons = buttons; pos->buttons = buttons;
@@ -148,11 +150,10 @@ 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 static status_t
standard_mouse_read_event(standard_mouse_cookie *cookie, standard_mouse_read_event(standard_mouse_cookie* cookie,
mouse_movement *movement) mouse_movement* movement)
{ {
uint8 packet[PS2_MAX_PACKET_SIZE]; uint8 packet[PS2_MAX_PACKET_SIZE];
status_t status; status_t status;
@@ -184,16 +185,16 @@ standard_mouse_read_event(standard_mouse_cookie *cookie,
} }
// #pragma mark - // #pragma mark - Interrupt handler functions
void void
standard_mouse_disconnect(ps2_dev *dev) standard_mouse_disconnect(ps2_dev* dev)
{ {
// the mouse device might not be opened at this point // the mouse device might not be opened at this point
INFO("ps2: ps2_standard_mouse_disconnect %s\n", dev->name); INFO("ps2: ps2_standard_mouse_disconnect %s\n", dev->name);
if (dev->flags & PS2_FLAG_OPEN) if (dev->flags & PS2_FLAG_OPEN)
release_sem(((standard_mouse_cookie *)dev->cookie)->standard_mouse_sem); release_sem(((standard_mouse_cookie*)dev->cookie)->standard_mouse_sem);
} }
@@ -204,27 +205,28 @@ standard_mouse_disconnect(ps2_dev *dev)
calls to the handler, each holds a different byte on the data port. calls to the handler, each holds a different byte on the data port.
*/ */
int32 int32
standard_mouse_handle_int(ps2_dev *dev) standard_mouse_handle_int(ps2_dev* dev)
{ {
standard_mouse_cookie *cookie = (standard_mouse_cookie*)dev->cookie; standard_mouse_cookie* cookie = (standard_mouse_cookie*)dev->cookie;
const uint8 data = dev->history[0].data; const uint8 data = dev->history[0].data;
TRACE("ps2: standard mouse: %1x\t%1x\t%1x\t%1x\t%1x\t%1x\t%1x\t%1x\n", TRACE("ps2: standard mouse: %1x\t%1x\t%1x\t%1x\t%1x\t%1x\t%1x\t%1x\n",
data >> 7 & 1, data >> 6 & 1, data >> 5 & 1, data >> 7 & 1, data >> 6 & 1, data >> 5 & 1,
data >> 4 & 1, data >> 3 & 1, data >> 2 & 1, data >> 4 & 1, data >> 3 & 1, data >> 2 & 1,
data >> 1 & 1, data >> 0 & 1); data >> 1 & 1, data >> 0 & 1);
if (cookie->packet_index == 0 && !(data & 8)) { if (cookie->packet_index == 0 && (data & 8) == 0) {
INFO("ps2: bad mouse data, trying resync\n"); INFO("ps2: bad mouse data, trying resync\n");
return B_HANDLED_INTERRUPT; return B_HANDLED_INTERRUPT;
} }
// Workarounds for active multiplexing keyboard controllers // Workarounds for active multiplexing keyboard controllers
// that lose data or send them to the wrong port. // that lose data or send them to the wrong port.
if (cookie->packet_index == 0 && (data & 0xc0)) { if (cookie->packet_index == 0 && (data & 0xc0) != 0) {
INFO("ps2: strange mouse data, x/y overflow, trying resync\n"); INFO("ps2: strange mouse data, x/y overflow, trying resync\n");
return B_HANDLED_INTERRUPT; return B_HANDLED_INTERRUPT;
} }
if (cookie->packet_index == 1) { if (cookie->packet_index == 1) {
int xDelta int xDelta
= ((cookie->buffer[0] & 0x10) ? 0xFFFFFF00 : 0) | data; = ((cookie->buffer[0] & 0x10) ? 0xFFFFFF00 : 0) | data;
@@ -263,15 +265,16 @@ standard_mouse_handle_int(ps2_dev *dev)
} }
release_sem_etc(cookie->standard_mouse_sem, 1, B_DO_NOT_RESCHEDULE); release_sem_etc(cookie->standard_mouse_sem, 1, B_DO_NOT_RESCHEDULE);
return B_INVOKE_SCHEDULER; return B_INVOKE_SCHEDULER;
} }
// #pragma mark - // #pragma mark - probe_standard_mouse()
status_t status_t
probe_standard_mouse(ps2_dev * dev) probe_standard_mouse(ps2_dev* dev)
{ {
status_t status; status_t status;
uint8 deviceId = 0; uint8 deviceId = 0;
@@ -323,11 +326,11 @@ probe_standard_mouse(ps2_dev * dev)
status_t status_t
standard_mouse_open(const char *name, uint32 flags, void **_cookie) standard_mouse_open(const char* name, uint32 flags, void** _cookie)
{ {
standard_mouse_cookie *cookie; standard_mouse_cookie* cookie;
status_t status; status_t status;
ps2_dev *dev = NULL; ps2_dev* dev = NULL;
int i; int i;
TRACE("ps2: standard_mouse_open %s\n", name); TRACE("ps2: standard_mouse_open %s\n", name);
@@ -337,11 +340,13 @@ standard_mouse_open(const char *name, uint32 flags, void **_cookie)
dev = &ps2_device[i]; dev = &ps2_device[i];
break; break;
} }
/*if (0 == strcmp(g_passthrough_dev.name, name)) { #if 0
if (0 == strcmp(g_passthrough_dev.name, name)) {
dev = &g_passthrough_dev; dev = &g_passthrough_dev;
isSynapticsPTDevice = true; isSynapticsPTDevice = true;
break; break;
}*/ }
#endif
} }
if (dev == NULL) { if (dev == NULL) {
@@ -412,9 +417,9 @@ err1:
status_t status_t
standard_mouse_close(void *_cookie) standard_mouse_close(void* _cookie)
{ {
standard_mouse_cookie *cookie = (standard_mouse_cookie*)_cookie; standard_mouse_cookie* cookie = (standard_mouse_cookie*)_cookie;
TRACE("ps2: standard_mouse_close %s enter\n", cookie->dev->name); TRACE("ps2: standard_mouse_close %s enter\n", cookie->dev->name);
@@ -433,16 +438,16 @@ standard_mouse_close(void *_cookie)
status_t status_t
standard_mouse_freecookie(void *_cookie) standard_mouse_freecookie(void* _cookie)
{ {
standard_mouse_cookie *cookie = (standard_mouse_cookie*)_cookie; standard_mouse_cookie* cookie = (standard_mouse_cookie*)_cookie;
free(cookie); free(cookie);
return B_OK; return B_OK;
} }
static status_t static status_t
standard_mouse_read(void *cookie, off_t pos, void *buffer, size_t *_length) standard_mouse_read(void* cookie, off_t pos, void* buffer, size_t* _length)
{ {
*_length = 0; *_length = 0;
return B_NOT_ALLOWED; return B_NOT_ALLOWED;
@@ -450,8 +455,8 @@ standard_mouse_read(void *cookie, off_t pos, void *buffer, size_t *_length)
static status_t static status_t
standard_mouse_write(void *cookie, off_t pos, const void *buffer, standard_mouse_write(void* cookie, off_t pos, const void* buffer,
size_t *_length) size_t* _length)
{ {
*_length = 0; *_length = 0;
return B_NOT_ALLOWED; return B_NOT_ALLOWED;
@@ -459,9 +464,9 @@ standard_mouse_write(void *cookie, off_t pos, const void *buffer,
status_t status_t
standard_mouse_ioctl(void *_cookie, uint32 op, void *buffer, size_t length) standard_mouse_ioctl(void* _cookie, uint32 op, void* buffer, size_t length)
{ {
standard_mouse_cookie *cookie = (standard_mouse_cookie*)_cookie; standard_mouse_cookie* cookie = (standard_mouse_cookie*)_cookie;
switch (op) { switch (op) {
case MS_NUM_EVENTS: case MS_NUM_EVENTS:
@@ -1,15 +1,14 @@
/* /*
* Copyright 2001-2010 Haiku, Inc. * Copyright 2001-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* PS/2 mouse device driver
*
* Authors (in chronological order): * Authors (in chronological order):
* Elad Lahav ([email protected]) * Elad Lahav, [email protected]
* Stefano Ceccherini ([email protected]) * Stefano Ceccherini, [email protected]
* Axel Dörfler, [email protected] * Axel Dörfler, [email protected]
* Marcus Overhagen <[email protected]> * Marcus Overhagen, [email protected]
* Clemens Zeidler <[email protected]> * Clemens Zeidler, [email protected]
* John Scipione, [email protected]
*/ */
#ifndef __PS2_STANDARD_MOUSE_H #ifndef __PS2_STANDARD_MOUSE_H
#define __PS2_STANDARD_MOUSE_H #define __PS2_STANDARD_MOUSE_H
@@ -27,17 +26,17 @@
#define F_MOUSE_TYPE_INTELLIMOUSE 0x2 #define F_MOUSE_TYPE_INTELLIMOUSE 0x2
typedef struct { typedef struct {
ps2_dev* dev; ps2_dev* dev;
sem_id standard_mouse_sem; sem_id standard_mouse_sem;
struct packet_buffer* standard_mouse_buffer; struct packet_buffer* standard_mouse_buffer;
bigtime_t click_last_time; bigtime_t click_last_time;
bigtime_t click_speed; bigtime_t click_speed;
int click_count; int click_count;
int buttons_state; int buttons_state;
int flags; int flags;
size_t packet_index; size_t packet_index;
uint8 buffer[PS2_MAX_PACKET_SIZE]; uint8 buffer[PS2_MAX_PACKET_SIZE];
} standard_mouse_cookie; } standard_mouse_cookie;