PS/2 bus manager: style fixes only
This commit is contained in:
@@ -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.
|
||||
*
|
||||
* PS/2 bus manager
|
||||
*
|
||||
* Authors (in chronological order):
|
||||
* Marcus Overhagen ([email protected])
|
||||
* Clemens Zeidler ([email protected])
|
||||
*/
|
||||
|
||||
|
||||
/*! PS/2 bus manager */
|
||||
|
||||
#include "ps2_dev.h"
|
||||
#include "ps2_service.h"
|
||||
|
||||
@@ -167,8 +167,10 @@ ps2_dev_init(void)
|
||||
goto err;
|
||||
}
|
||||
return B_OK;
|
||||
|
||||
err:
|
||||
ps2_dev_exit();
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -176,8 +178,7 @@ err:
|
||||
void
|
||||
ps2_dev_exit(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < PS2_DEVICE_COUNT; i++) {
|
||||
for (int i = 0; i < PS2_DEVICE_COUNT; i++) {
|
||||
ps2_dev* dev = &ps2_device[i];
|
||||
if (dev->result_sem >= 0) {
|
||||
delete_sem(dev->result_sem);
|
||||
@@ -503,19 +504,25 @@ ps2_dev_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out,
|
||||
status_t
|
||||
ps2_dev_sliced_command(ps2_dev* dev, uint8 cmd)
|
||||
{
|
||||
uint8 val;
|
||||
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_SCALE11) != B_OK)
|
||||
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)
|
||||
return B_ERROR;
|
||||
|
||||
val = (cmd >> 4) & 3;
|
||||
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
|
||||
return B_ERROR;
|
||||
|
||||
val = (cmd >> 2) & 3;
|
||||
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
|
||||
return B_ERROR;
|
||||
|
||||
val = cmd & 3;
|
||||
if (ps2_dev_command(dev, PS2_CMD_MOUSE_SET_RES, &val, 1) != B_OK)
|
||||
return B_ERROR;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
* PS/2 bus manager
|
||||
*
|
||||
* Authors (in chronological order):
|
||||
* Marcus Overhagen ([email protected])
|
||||
* Clemens Zeidler ([email protected])
|
||||
*/
|
||||
#ifndef __PS2_DEV_H
|
||||
#define __PS2_DEV_H
|
||||
@@ -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);
|
||||
status_t ps2_dev_sliced_command(ps2_dev *dev, uint8 cmd);
|
||||
|
||||
|
||||
status_t ps2_reset_mouse(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.
|
||||
*
|
||||
* Authors (in chronological order):
|
||||
* Elad Lahav ([email protected])
|
||||
* Stefano Ceccherini ([email protected])
|
||||
* Elad Lahav, [email protected]
|
||||
* Stefano Ceccherini, [email protected]
|
||||
* Axel Dörfler, [email protected]
|
||||
* Marcus Overhagen <[email protected]>
|
||||
* Clemens Zeidler <[email protected]>
|
||||
* Marcus Overhagen, [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_3"
|
||||
};
|
||||
|
||||
const char* kIntelliMousePath[4] = {
|
||||
"input/mouse/ps2/intelli_0",
|
||||
"input/mouse/ps2/intelli_1",
|
||||
@@ -77,8 +79,7 @@ const char* kIntelliMousePath[4] = {
|
||||
};
|
||||
|
||||
|
||||
/*! 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)
|
||||
{
|
||||
@@ -86,8 +87,7 @@ 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)
|
||||
@@ -115,7 +115,7 @@ ps2_packet_to_movement(standard_mouse_cookie *cookie, uint8 packet[],
|
||||
if (packet[3] & 0x08)
|
||||
yDeltaWheel |= ~0x07;
|
||||
}
|
||||
/*
|
||||
#if 0
|
||||
if (cookie->flags & F_MOUSE_TYPE_2WHEELS) {
|
||||
switch (packet[3] & 0x0F) {
|
||||
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
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
// TRACE("packet: %02x %02x %02x %02x: xd %d, yd %d, 0x%x (%d), w-xd %d, "
|
||||
// "w-yd %d\n", packet[0], packet[1], packet[2], packet[3],
|
||||
// xDelta, yDelta, buttons, cookie->click_count, xDeltaWheel,
|
||||
// yDeltaWheel);
|
||||
#if 0
|
||||
TRACE("packet: %02x %02x %02x %02x: xd %d, yd %d, 0x%x (%d), w-xd %d, "
|
||||
"w-yd %d\n", packet[0], packet[1], packet[2], packet[3],
|
||||
xDelta, yDelta, buttons, cookie->click_count, xDeltaWheel,
|
||||
yDeltaWheel);
|
||||
#endif
|
||||
|
||||
if (pos) {
|
||||
if (pos != NULL) {
|
||||
pos->xdelta = xDelta;
|
||||
pos->ydelta = yDelta;
|
||||
pos->buttons = buttons;
|
||||
@@ -148,8 +150,7 @@ 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)
|
||||
@@ -184,7 +185,7 @@ standard_mouse_read_event(standard_mouse_cookie *cookie,
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
// #pragma mark - Interrupt handler functions
|
||||
|
||||
|
||||
void
|
||||
@@ -214,17 +215,18 @@ standard_mouse_handle_int(ps2_dev *dev)
|
||||
data >> 4 & 1, data >> 3 & 1, data >> 2 & 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");
|
||||
return B_HANDLED_INTERRUPT;
|
||||
}
|
||||
|
||||
// Workarounds for active multiplexing keyboard controllers
|
||||
// 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");
|
||||
return B_HANDLED_INTERRUPT;
|
||||
}
|
||||
|
||||
if (cookie->packet_index == 1) {
|
||||
int xDelta
|
||||
= ((cookie->buffer[0] & 0x10) ? 0xFFFFFF00 : 0) | data;
|
||||
@@ -263,11 +265,12 @@ standard_mouse_handle_int(ps2_dev *dev)
|
||||
}
|
||||
|
||||
release_sem_etc(cookie->standard_mouse_sem, 1, B_DO_NOT_RESCHEDULE);
|
||||
|
||||
return B_INVOKE_SCHEDULER;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
// #pragma mark - probe_standard_mouse()
|
||||
|
||||
|
||||
status_t
|
||||
@@ -337,11 +340,13 @@ standard_mouse_open(const char *name, uint32 flags, void **_cookie)
|
||||
dev = &ps2_device[i];
|
||||
break;
|
||||
}
|
||||
/*if (0 == strcmp(g_passthrough_dev.name, name)) {
|
||||
#if 0
|
||||
if (0 == strcmp(g_passthrough_dev.name, name)) {
|
||||
dev = &g_passthrough_dev;
|
||||
isSynapticsPTDevice = true;
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (dev == NULL) {
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
* PS/2 mouse device driver
|
||||
*
|
||||
* Authors (in chronological order):
|
||||
* Elad Lahav ([email protected])
|
||||
* Stefano Ceccherini ([email protected])
|
||||
* Elad Lahav, [email protected]
|
||||
* Stefano Ceccherini, [email protected]
|
||||
* Axel Dörfler, [email protected]
|
||||
* Marcus Overhagen <[email protected]>
|
||||
* Clemens Zeidler <[email protected]>
|
||||
* Marcus Overhagen, [email protected]
|
||||
* Clemens Zeidler, [email protected]
|
||||
* John Scipione, [email protected]
|
||||
*/
|
||||
#ifndef __PS2_STANDARD_MOUSE_H
|
||||
#define __PS2_STANDARD_MOUSE_H
|
||||
|
||||
Reference in New Issue
Block a user